【原创】MySQL Proxy - 协议(部分摘录)



【Generic Response Packets】->【Status Flags】
 
The status flags are a bit-field:

======     ============= ========
   flag               constant name
======     ============= ========
0x0001         SERVER_STATUS_IN_TRANS
0x0002         SERVER_STATUS_AUTOCOMMIT
0x0008         _`SERVER_MORE_RESULTS_EXISTS`
0x0010         SERVER_STATUS_NO_GOOD_INDEX_USED
0x0020         SERVER_STATUS_NO_INDEX_USED
0x0040         SERVER_STATUS_CURSOR_EXISTS
0x0080         SERVER_STATUS_LAST_ROW_SENT
0x0100         SERVER_STATUS_DB_DROPPED
0x0200         SERVER_STATUS_NO_BACKSLASH_ESCAPES
0x0400         SERVER_STATUS_METADATA_CHANGED
0x0800         SERVER_QUERY_WAS_SLOW
0x1000         SERVER_PS_OUT_PARAMS
======       ============= ========



       The capability flags are used by the client and server to indicate which features    they support and want to use.  

【Auth Challenge Packet】->【Capability flags】

====== =======================  ========================
    flags                 constant name                                    description
====== =======================  ========================
0x0001          CLIENT_LONG_PASSWORD           new more secure passwords
0x0002           CLIENT_FOUND_ROWS                 Found instead of affected rows
0x0004           CLIENT_LONG_FLAG                     Get all column flags
0x0008           CLIENT_CONNECT_WITH_DB       One can specify db on connect
0x0010           CLIENT_NO_SCHEMA                   Don't allow database.table.column
0x0020           CLIENT_COMPRESS                      Can use compression protocol
0x0040           CLIENT_ODBC                               Odbc client
0x0080           _`CLIENT_LOCAL_FILES`                Can use LOAD DATA LOCAL
0x0100           CLIENT_IGNORE_SPACE               Ignore spaces before '('
0x0200           _`CLIENT_PROTOCOL_41`             New 4.1 protocol
0x0400           CLIENT_INTERACTIVE                   This is an interactive client
0x0800           CLIENT_SSL                                   Switch to SSL after handshake
0x1000           CLIENT_IGNORE_SIGPIPE             IGNORE sigpipes
0x2000           CLIENT_TRANSACTIONS             Client knows about transactions
0x4000           CLIENT_RESERVED                       Old flag for 4.1 protocol 
0x8000           CLIENT_SECURE_CONNECTION   New 4.1 authentication
====== =======================  ========================


【Auth Response Packet】->【 Capability flags

`capability flags` are the same as defined in the `Capability flags`_ of the `Auth Challenge Packet`_ plus:

====== =======================  ======================== 
    flags                 constant name                                    description 
====== =======================  ========================   
0x00010000    _`CLIENT_MULTI_STATEMENTS`      Enable/disable multi-stmt support
0x00020000    _`CLIENT_MULTI_RESULTS`              Enable/disable multi-results
0x00040000    _`CLIENT_PS_MULTI_RESULTS`         Multi-results in PS-protocol
0x40000000    CLIENT_SSL_VERIFY_SERVER_CERT
0x80000000    CLIENT_REMEMBER_OPTIONS
====== =======================  ========================


command-type

The first byte of the payload describes the command-type like:

=== ===================  ======================== 
hex           constant name                                      description 
=== ===================  ======================== 
00       `COM_SLEEP`_                        unhandled
01       `COM_QUIT`_                         tells the server that the client wants to close the connection
02       `COM_INIT_DB`_                    change the default schema of the connection
03       `COM_QUERY`_                      tells the server to execute a text-based query
04       `COM_FIELD_LIST`_                get the column definition of a tables
05       `COM_CREATE_DB`_              create a schema
06       `COM_DROP_DB`_                 drop a schema
07       `COM_REFRESH`_                  get a list of active threads
08       `COM_SHUTDOWN`_            get a list of active threads
09       `COM_STATISTICS`_               get a list of active threads
0a       `COM_PROCESS_INFO`_        get a list of active threads
0b       `COM_CONNECT`_                unhandled
0c       `COM_PROCESS_KILL`_          ask the server to terminate a connection
0d      `COM_DEBUG`_                      dump debug info to stdout
0e       `COM_PING`_                         check if the server is alive
0f        `COM_TIME`_                         unhandled
10       `COM_DELAYED_INSERT`_    unhandled
11       `COM_CHANGE_USER`_        change the user of the current connection
12        COM_BINLOG_DUMP          (null)
13       `COM_TABLE_DUMP`_          unhandled
14       `COM_CONNECT_OUT`_        unhandled
15        COM_REGISTER_SLAVE        (null)
16       `COM_STMT_PREPARE`_       creates a prepared statement from the passed query string.
17       `COM_STMT_EXECUTE`_      asks the server to execute a prepared statement as identified by `stmt-id`.
18       `COM_STMT_SEND_LONG_DATA`_    sends the data for a column. Repeating to send it, appends the data to the parameter.
19       `COM_STMT_CLOSE`_         deallocates a prepared statement.
1a       `COM_STMT_RESET`_         resets the data of a prepared statement. Useful in together with `COM_STMT_SEND_LONG_DATA`_.
1b       `COM_SET_OPTION`_         set options for the current connection
1c       `COM_STMT_FETCH`_         (null) 
1d      `COM_DAEMON`_               unhandled
=== ===================  ========================

The unhandled   commands belong to 

* the `Old Commands`_
* the `Prepared Statements`_ Commands
* the `Stored Procedures`_ Commands
* or the Replication Commands







转载于:https://my.oschina.net/moooofly/blog/112023

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值