From 4708ae615fee8ced353e2f12899dfab6f380509f Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 29 Feb 2024 07:34:51 -0600 Subject: [PATCH] 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