From 815ef00ff6893f35a4b150cba0ba9bbc6278d8c7 Mon Sep 17 00:00:00 2001 From: Tomas Zigo <50632337+tmszi@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:24:45 +0200 Subject: [PATCH] db/drivers/mysql: set SQL ANSI_QUOTES MODE (#3612) Which allow to use SQL standard double quotes instead of backticks for escaping column name. --- db/drivers/mysql/db.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/db/drivers/mysql/db.c b/db/drivers/mysql/db.c index 5e5748c11f5..0fe72f8a359 100644 --- a/db/drivers/mysql/db.c +++ b/db/drivers/mysql/db.c @@ -62,6 +62,14 @@ int db__driver_open_database(dbHandle *handle) db_d_report_error(); return DB_FAILED; } + /* Set SQL ANSI_QUOTES MODE which allow to use double quotes instead of + * backticks */ + if (mysql_query(connection, "SET SQL_MODE=ANSI_QUOTES") != 0) { + db_d_append_error("%s %s", _("Unable to set SQL ANSI_QUOTES mode:"), + mysql_error(connection)); + db_d_report_error(); + return DB_FAILED; + } } return DB_OK;