diff --git a/R/DBI.R b/R/DBI.R index 6cb13635..a09313d1 100644 --- a/R/DBI.R +++ b/R/DBI.R @@ -208,7 +208,7 @@ setClass("DatabaseConnectorDbiResult", setMethod( "dbSendQuery", signature("DatabaseConnectorJdbcConnection", "character"), - function(conn, statement, translate = FALSE, ...) { + function(conn, statement, translate = getOption("databaseConnectorTranslate", default = TRUE), ...) { if (rJava::is.jnull(conn@jConnection)) { abort("Connection is closed") } @@ -258,7 +258,7 @@ setMethod( setMethod( "dbSendQuery", signature("DatabaseConnectorDbiConnection", "character"), - function(conn, statement, translate = FALSE, ...) { + function(conn, statement, translate = getOption("databaseConnectorTranslate", default = TRUE), ...) { if (translate) { statement <- translateStatement( sql = statement, @@ -426,7 +426,7 @@ setMethod("dbGetRowsAffected", "DatabaseConnectorDbiResult", function(res, ...) setMethod( "dbGetQuery", signature("DatabaseConnectorConnection", "character"), - function(conn, statement, translate = FALSE, ...) { + function(conn, statement, translate = getOption("databaseConnectorTranslate", default = TRUE), ...) { if (translate) { statement <- translateStatement( sql = statement, @@ -447,7 +447,7 @@ setMethod( setMethod( "dbSendStatement", signature("DatabaseConnectorConnection", "character"), - function(conn, statement, translate = FALSE, ...) { + function(conn, statement, translate = getOption("databaseConnectorTranslate", default = TRUE), ...) { if (translate) { statement <- translateStatement( sql = statement, @@ -472,7 +472,7 @@ setMethod( setMethod( "dbExecute", signature("DatabaseConnectorConnection", "character"), - function(conn, statement, translate = FALSE, ...) { + function(conn, statement, translate = getOption("databaseConnectorTranslate", default = TRUE), ...) { if (isDbplyrSql(statement) && dbms(conn) %in% c("oracle", "bigquery", "spark", "hive") && grepl("^UPDATE STATISTICS", statement)) { # These platforms don't support this, so SqlRender translates to an empty string, which causes errors down the line. return(0)