List:Internals« Previous MessageNext Message »
From:xiaoxin gao Date:September 14 2012 3:44am
Subject:SERVER_STATUS is always inited with SERVER_STATUS_AUTOCOMMIT=1
View as plain text  
Hi all,

I am trying to parse the OK packet of mysql server to get the value of
flag  SERVER_STATUS_AUTOCOMMIT.

But I meet an odd phenomenon:
     If I start mysqld with option autocommit=0, and I send a query
"create table XXX",
the return OK packet will be with SERVER_STATUS_AUTOCOMMIT=1.

Code:
short a =(server_status & SERVER_STATUS_AUTOCOMMIT)?1:0;
a is equal to 1.

I read the mysql code of mysql 5.5, I found that the thd->server_status
will always be inited with SERVER_STATUS_AUTOCOMMIT=1, and this flag only
be reset when the user change the global/session variable autocommit with a
different value.
So If I start mysqld with option autocommit=0, and do not execute a query
"set autocommit=1", the thd->server_status will be 1 all the time, with a
different value with the global/session variable.

Is it correct?

Looking forward to any responses, and thanks in advance.

Best Regards,

Dennis GAO
Thread
SERVER_STATUS is always inited with SERVER_STATUS_AUTOCOMMIT=1xiaoxin gao14 Sep