Skip to content

Commit

Permalink
db/drivers/mysql: set SQL ANSI_QUOTES MODE (#3612)
Browse files Browse the repository at this point in the history
Which allow to use SQL standard double quotes instead of backticks for
escaping column name.
  • Loading branch information
tmszi authored and neteler committed Apr 23, 2024
1 parent 86e988f commit 815ef00
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions db/drivers/mysql/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 815ef00

Please sign in to comment.