MXS-1278: Change modes when 'set sql_mode=' is encountered.
The initial setting of sql_mode affects how MaxScale initially behaves with respect to autocommit. When 'set sql_mode=[default|oracle];" is encountered, the query classifier and autocommit modes are adjusted accordingly.
This commit is contained in:
@ -112,6 +112,12 @@ session_alloc(SERVICE *service, DCB *client_dcb)
|
||||
session->stats.connect = time(0);
|
||||
session->stmt.buffer = NULL;
|
||||
session->stmt.target = NULL;
|
||||
|
||||
MXS_CONFIG *config = config_get_global_options();
|
||||
// If MaxScale is running in Oracle mode, then autocommit needs to
|
||||
// initially be off.
|
||||
bool autocommit = (config->qc_sql_mode == QC_SQL_MODE_ORACLE) ? false : true;
|
||||
session_set_autocommit(session, autocommit);
|
||||
/*<
|
||||
* Associate the session to the client DCB and set the reference count on
|
||||
* the session to indicate that there is a single reference to the
|
||||
|
@ -888,10 +888,12 @@ void set_qc_mode(MXS_SESSION* session, GWBUF** read_buffer)
|
||||
switch (sql_mode)
|
||||
{
|
||||
case SetSqlModeParser::ORACLE:
|
||||
session_set_autocommit(session, false);
|
||||
session->client_protocol_data = QC_SQL_MODE_ORACLE;
|
||||
break;
|
||||
|
||||
case SetSqlModeParser::DEFAULT:
|
||||
session_set_autocommit(session, true);
|
||||
session->client_protocol_data = QC_SQL_MODE_DEFAULT;
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user