php - Changing MySQL mode per session -
i have developer supporting old application asking me change our mysql mode globally away strict - have several other databases on same server apparently require strict mode.
i believe it's possible change mode @ session level , i've tried following code it.
session_start(); include_once("./includes/conn.php"); mysql_query("set session sql_mode = ''");
but doesn't seem work - testing mode reports global , session values same.
session user : name session security : 27478239 mysql server version : 5.5.5-10.0.23-mariadb global : strict_trans_tables,no_engine_substitution session : strict_trans_tables,no_engine_substitution
is possible change sql mode @ session level (or database level) , if how can achieved?
there two syntaxes change session value (both should equivalent):
set session sql_mode = 'modes'; set @@session.sql_mode = 'modes';
to read value back:
select @@session.sql_mode;
of course, since session value:
- it won't affect global setting
- it won't survive past current session
Comments
Post a Comment