Changed how query classifier determines which statements trigger implicit commit.

Changed test makefile and rwsplit.sh script and added two example sql scripts.
This commit is contained in:
VilhoRaatikka
2014-03-26 19:10:35 +02:00
parent df02926321
commit f49df89a0c
5 changed files with 86 additions and 28 deletions

View File

@ -73,6 +73,9 @@ static bool create_parse_tree(
static skygw_query_type_t resolve_query_type(
THD* thd);
static bool skygw_stmt_causes_implicit_commit(
LEX* lex,
uint mask);
/**
* @node (write brief function description here)
@ -421,7 +424,8 @@ static skygw_query_type_t resolve_query_type(
* PRELOAD_KEYS, FLUSH, RESET, CREATE|ALTER|DROP SERVER
* SET autocommit, various other SET commands.
*/
if (sql_command_flags[lex->sql_command] & CF_AUTO_COMMIT_TRANS) {
if (skygw_stmt_causes_implicit_commit(lex, CF_AUTO_COMMIT_TRANS))
{
if (LOG_IS_ENABLED(LOGFILE_TRACE))
{
if (sql_command_flags[lex->sql_command] &
@ -642,3 +646,33 @@ return_qtype:
qtype = (skygw_query_type_t)type;
return qtype;
}
static bool skygw_stmt_causes_implicit_commit(LEX* lex, uint mask)
{
bool succp;
if (!(sql_command_flags[lex->sql_command] & mask))
{
succp = false;
goto return_succp;
}
switch (lex->sql_command) {
case SQLCOM_DROP_TABLE:
succp = !(lex->drop_temporary);
break;
case SQLCOM_ALTER_TABLE:
case SQLCOM_CREATE_TABLE:
/* If CREATE TABLE of non-temporary table, do implicit commit */
succp = !(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
break;
case SQLCOM_SET_OPTION:
succp = lex->autocommit ? true : false;
break;
default:
break;
}
return_succp:
return succp;
}