From 4708ae615fee8ced353e2f12899dfab6f380509f Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 29 Feb 2024 07:34:51 -0600 Subject: [PATCH 1/2] Shim sql_escape_ident() for RMySQL Since it doesn't appear to handle SQL objects. Fixes childesr revdep failure. --- NAMESPACE | 1 + R/backend-mysql.R | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/NAMESPACE b/NAMESPACE index d7e2931e1..b2e724c54 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -258,6 +258,7 @@ S3method(sql_escape_datetime,DBIConnection) S3method(sql_escape_datetime,MariaDBConnection) S3method(sql_escape_datetime,MySQL) S3method(sql_escape_datetime,MySQLConnection) +S3method(sql_escape_ident,MySQLConnection) S3method(sql_escape_ident,TestConnection) S3method(sql_escape_ident,default) S3method(sql_escape_logical,"Microsoft SQL Server") diff --git a/R/backend-mysql.R b/R/backend-mysql.R index 2cf4ab963..5a2fccf5d 100644 --- a/R/backend-mysql.R +++ b/R/backend-mysql.R @@ -263,6 +263,18 @@ sql_escape_datetime.MySQLConnection <- sql_escape_datetime.MariaDBConnection #' @export sql_escape_datetime.MySQL <- sql_escape_datetime.MariaDBConnection + +# dbQuoteIdentifier() for RMySQL lacks handling of SQL objects +#' @export +sql_escape_ident.MySQLConnection <- function(con, x) { + if (methods::is(x, "SQL")) { + x + } else { + DBI::dbQuoteIdentifier(con, x) + } +} + + #' @export supports_window_clause.MariaDBConnection <- function(con) { TRUE From 5197775791b4942cb6cdb543eb1d3812c7219e53 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Mon, 4 Mar 2024 07:59:15 -0600 Subject: [PATCH 2/2] Simulate is a pure S3 class --- R/backend-mysql.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/backend-mysql.R b/R/backend-mysql.R index 5a2fccf5d..427c33f19 100644 --- a/R/backend-mysql.R +++ b/R/backend-mysql.R @@ -267,7 +267,9 @@ sql_escape_datetime.MySQL <- sql_escape_datetime.MariaDBConnection # dbQuoteIdentifier() for RMySQL lacks handling of SQL objects #' @export sql_escape_ident.MySQLConnection <- function(con, x) { - if (methods::is(x, "SQL")) { + if (!isS4(con)) { # for simulate_mysql() + NextMethod() + } else if (methods::is(x, "SQL")) { x } else { DBI::dbQuoteIdentifier(con, x)