Skip to content

Commit

Permalink
Shim sql_escape_ident() for RMySQL (#1470)
Browse files Browse the repository at this point in the history
Since it doesn't appear to handle SQL objects. Fixes childesr revdep failure.
  • Loading branch information
hadley authored Mar 4, 2024
1 parent fd01c3f commit 39d9acf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 14 additions & 0 deletions R/backend-mysql.R
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,20 @@ 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 (!isS4(con)) { # for simulate_mysql()
NextMethod()
} else if (methods::is(x, "SQL")) {
x
} else {
DBI::dbQuoteIdentifier(con, x)
}
}


#' @export
supports_window_clause.MariaDBConnection <- function(con) {
TRUE
Expand Down

0 comments on commit 39d9acf

Please sign in to comment.