4.2 连接建立
4.2.1 Authentication Plugin
a.空(即默认,等同于mysql_native_password 或者8.0以后的caching_sha2_password)
b.mysql_native_password
c.caching_sha2_password
4.2.2 Capabilities
大部分权能标志位在建立连接之后是不能修改的。
因为dble的连接模型是预先建立后端连接池,所以在建立时候已经初始化了权能标志位。之后如果新的前端连接建立连接时候设置了不同的权能标志位,就无法生效传递给后端连接。
比如jdbc连接dble设置了CLIENT_FOUND_ROWS 相关的属性,是无法实际生效的。
又比如,dble设置了IGNORE_SPACE,所以不做任何操作的情况下 select @@sql_mode 会永远包含IGNORE_SPACE
这样带来的限制是,某些和函数同名的词会当成保留字来处理。参见MySQL文档 以及相关issue-972
当然,IGNORE_SPACE又是个特例,它可以通过session级别的sql_mode进行设置。
这里列举一下dble建立连接权能标志位的使用情况。
如:
名称 | 标记值 | 描述 | 后端连接设置值 | 模拟服务端权能位 |
---|---|---|---|---|
CLIENT_LONG_PASSWORD |
1 |
Use the improved version of Old Password Authentication.Assumed to be set since 4.1.1. | Y |
Y |
CLIENT_FOUND_ROWS |
2 |
Send found rows instead of affected rows in EOF_Packet |
Y |
Y |
CLIENT_LONG_FLAG | 4 | Get all column flags. | Y | Y |
CONNECT_WITH_DB |
8 |
Database (schema) name can be specified on connect in Handshake Response Packet. | Y |
Y |
CLIENT_NO_SCHEMA | 16 | Don't allow database.table.column. | N | N |
CLIENT_COMPRESS |
32 |
Compression protocol supported |
bootstrap.cnf的useCompression选项控制 |
|
CLIENT_ODBC | 64 | Special handling of ODBC behavior.No special behavior since 3.22. | Y | Y |
CLIENT_LOCAL_FILES |
128 |
Can use LOAD DATA LOCAL. |
Y |
Y |
CLIENT_IGNORE_SPACE |
256 |
Ignore spaces before '('. |
Y |
Y |
CLIENT_PROTOCOL_41 |
512 |
New 4.1 protocol |
Y |
Y |
CLIENT_INTERACTIVE |
1024 |
This is an interactive client. | Y | Y |
CLIENT_SSL | 2048 | Use SSL encryption for the session | N | N |
CLIENT_IGNORE_SIGPIPE |
4096 |
Client only flag.Not used. | Y | Y |
CLIENT_TRANSACTIONS |
8192 |
Client knows about transactions | Y | Y |
CLIENT_RESERVED | 16384 | DEPRECATED:Old flag for 4.1 protocol. | N | N |
CLIENT_RESERVED2 |
32768 |
DEPRECATED:Old flag for 4.1 authentication. | Y | Y |
CLIENT_MULTI_STATEMENTS |
65536 |
Enable/disable multi-stmt support |
Y |
Y |
CLIENT_MULTI_RESULTS |
131072 |
Enable/disable multi-results |
Y |
Y |
CLIENT_PS_MULTI_RESULTS | 262144 | Multi-results and OUT parameters in PS-protocol | N | N |
CLIENT_PLUGIN_AUTH | 524288 | Client supports plugin authentication. | N | Y |
CLIENT_CONNECT_ATTRS | 1048576 | Client supports connection attributes. | N | N |
CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA | 2097152 | Enable authentication response packet to be larger than 255 bytes. | N | N |
CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS | 4194304 | Don't close the connection for a user account with expired password. | N | N |
CLIENT_SESSION_TRACK | 8388608 | Capable of handling server state change information. | N | N |
CLIENT_DEPRECATE_EOF | 16777216 | Client no longer needs EOF_Packet and will use OK_Packet instead. | N | N |
CLIENT_SSL_VERIFY_SERVER_CERT | 1UL << 30 | Verify server certificate | N | N |
CLIENT_REMEMBER_OPTIONS | 1UL << 31 | Don't reset the options after an unsuccessful connect. | N | N |
权能标志位定义 :
参考 https://dev.mysql.com/doc/dev/mysql-server/8.0.13/group__group__cs__capabilities__flags.html