MXS-938: Recognize transaction start

Now more information about a transaction start is provided. When
a transaction start statement is parsed, the type of the statement
with be QUERY_TYPE_BEGIN_TRX anded with QUERY_TYPE_READ or
QUERY_TYPE_WRITE if the transaction was explicitly started as READ
ONLY or READ WRITE.

Now also BEGIN WORK and [COMMIT|ROLLBACK] WORK are recognized.
"AND CHAIN" will still need to be recognized.
This commit is contained in:
Johan Wikman
2016-10-19 22:49:03 +03:00
parent 6bcb3ce4dc
commit e1ccc8afe0
4 changed files with 76 additions and 9 deletions

View File

@ -630,6 +630,14 @@ static uint32_t resolve_query_type(THD* thd)
case SQLCOM_BEGIN:
type |= QUERY_TYPE_BEGIN_TRX;
if (lex->start_transaction_opt & MYSQL_START_TRANS_OPT_READ_WRITE)
{
type |= QUERY_TYPE_WRITE;
}
else if (lex->start_transaction_opt & MYSQL_START_TRANS_OPT_READ_ONLY)
{
type |= QUERY_TYPE_READ;
}
goto return_qtype;
break;