SERVER_STATUS is always inited with SERVER_STATUS_AUTOCOMMIT=1

xiaoxin gao <[email protected]> Fri, 14 Sep 2012 11:44:04 +0800
Newsgroups gmane.comp.db.mysql.devel
Message-ID <CAAudSpO5TjBeum71+BkP=tGMdTsrD5a4bYrXsC0jejwW-oSYCg@mail.gmail.com>
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

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/internals