List:MySQL Documentation« Previous MessageNext Message »
From:晓楚 Date:October 9 2012 9:38am
Subject:[bug report] OK_Packet document bug
View as plain text  
Hi, 
in the document http://dev.mysql.com/doc/internals/en/overview.html#packet-OK_Packet  OK packet looks like :
Payload

1              [00] the OK header lenenc-int     affected rows lenenc-int     last-insert-id   if capabilities & CLIENT_PROTOCOL_41 { 2              status_flags 2              warnings   } elseif capabilities & CLIENT_TRANSACTIONS { 2              status_flags   }  string[EOF] infoand the field 'info' is EOF type, which documented here: http://dev.mysql.com/doc/internals/en/overview.html#type-string.EOF


But according to the source code,  before info field there is a "padding" which records the net field length. This is not recorded in the document.
the correct payload should look like this (if code rules):


1              [00] the OK header lenenc-int     affected rows lenenc-int     last-insert-id   if capabilities & CLIENT_PROTOCOL_41 { 2              status_flags 2              warnings   } elseif capabilities & CLIENT_TRANSACTIONS { 2              status_flags   } lenenc-int net field length string[EOF] info


 you can find related code at:
mysql-5.5.27/sql-common/client.c : cli_read_query_result()

mysql-5.5.27/sql-common/pack.c : net_field_length()





best regards ;-)


------------------
Raywill
Institute Of Computing Technology,
Chinese Academy of Sciences.
Beijing, China
http://raywill.blog.sohu.com
Thread
[bug report] OK_Packet document bug晓楚9 Oct