sqlx_mysql/protocol/
capabilities.rs

1// https://dev.mysql.com/doc/dev/mysql-server/8.0.12/group__group__cs__capabilities__flags.html
2// https://mariadb.com/kb/en/library/connection/#capabilities
3//
4// MySQL defines the capabilities flags as fitting in an `int<4>` but MariaDB
5// extends this with more bits sent in a separate field.
6// For simplicity, we've chosen to combine these into one type.
7bitflags::bitflags! {
8    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
9    pub struct Capabilities: u64 {
10        // [MariaDB] MySQL compatibility
11        const MYSQL = 1;
12
13        // [*] Send found rows instead of affected rows in EOF_Packet.
14        const FOUND_ROWS = 2;
15
16        // Get all column flags.
17        const LONG_FLAG = 4;
18
19        // [*] Database (schema) name can be specified on connect in Handshake Response Packet.
20        const CONNECT_WITH_DB = 8;
21
22        // Don't allow database.table.column
23        const NO_SCHEMA = 16;
24
25        // [*] Compression protocol supported
26        const COMPRESS = 32;
27
28        // Special handling of ODBC behavior.
29        const ODBC = 64;
30
31        // Can use LOAD DATA LOCAL
32        const LOCAL_FILES = 128;
33
34        // [*] Ignore spaces before '('
35        const IGNORE_SPACE = 256;
36
37        // [*] New 4.1+ protocol
38        const PROTOCOL_41 = 512;
39
40        // This is an interactive client
41        const INTERACTIVE = 1024;
42
43        // Use SSL encryption for this session
44        const SSL = 2048;
45
46        // Client knows about transactions
47        const TRANSACTIONS = 8192;
48
49        // 4.1+ authentication
50        const SECURE_CONNECTION = 1 << 15;
51
52        // Enable/disable multi-statement support for COM_QUERY *and* COM_STMT_PREPARE
53        const MULTI_STATEMENTS = 1 << 16;
54
55        // Enable/disable multi-results for COM_QUERY
56        const MULTI_RESULTS = 1 << 17;
57
58        // Enable/disable multi-results for COM_STMT_PREPARE
59        const PS_MULTI_RESULTS = 1 << 18;
60
61        // Client supports plugin authentication
62        const PLUGIN_AUTH = 1 << 19;
63
64        // Client supports connection attributes
65        const CONNECT_ATTRS = 1 << 20;
66
67        // Enable authentication response packet to be larger than 255 bytes.
68        const PLUGIN_AUTH_LENENC_DATA = 1 << 21;
69
70        // Don't close the connection for a user account with expired password.
71        const CAN_HANDLE_EXPIRED_PASSWORDS = 1 << 22;
72
73        // Capable of handling server state change information.
74        const SESSION_TRACK = 1 << 23;
75
76        // Client no longer needs EOF_Packet and will use OK_Packet instead.
77        const DEPRECATE_EOF = 1 << 24;
78
79        // Support ZSTD protocol compression
80        const ZSTD_COMPRESSION_ALGORITHM = 1 << 26;
81
82        // Verify server certificate
83        const SSL_VERIFY_SERVER_CERT = 1 << 30;
84
85        // The client can handle optional metadata information in the resultset
86        const OPTIONAL_RESULTSET_METADATA = 1 << 25;
87
88        // Don't reset the options after an unsuccessful connect
89        const REMEMBER_OPTIONS = 1 << 31;
90
91        // Extended capabilities (MariaDB only, as of writing)
92        // Client support progress indicator (since 10.2)
93        const MARIADB_CLIENT_PROGRESS = 1 << 32;
94
95        // Permit COM_MULTI protocol
96        const MARIADB_CLIENT_MULTI = 1 << 33;
97
98        // Permit bulk insert
99        const MARIADB_CLIENT_STMT_BULK_OPERATIONS = 1 << 34;
100
101        // Add extended metadata information
102        const MARIADB_CLIENT_EXTENDED_TYPE_INFO = 1 << 35;
103
104        // Permit skipping metadata
105        const MARIADB_CLIENT_CACHE_METADATA = 1 << 36;
106
107        // when enabled, indicate that Bulk command can use STMT_BULK_FLAG_SEND_UNIT_RESULTS flag
108        // that permit to return a result-set of all affected rows and auto-increment values
109        const MARIADB_CLIENT_BULK_UNIT_RESULTS = 1 << 37;
110    }
111}