1 module mysql.protocol.constants; 2 3 /** 4 * Server capability flags. 5 * 6 * During the connection handshake process, the server sends a uint of flags 7 * describing its capabilities. 8 * 9 * See_Also: http://dev.mysql.com/doc/internals/en/connection-phase.html#capability-flags 10 */ 11 enum SvrCapFlags: uint 12 { 13 OLD_LONG_PASSWORD = 0x0_0001, /// Long old-style passwords (Not 4.1+ passwords) 14 FOUND_NOT_AFFECTED = 0x0_0002, /// Report rows found rather than rows affected 15 ALL_COLUMN_FLAGS = 0x0_0004, /// Send all column flags 16 WITH_DB = 0x0_0008, /// Can take database as part of login 17 NO_SCHEMA = 0x0_0010, /// Can disallow database name as part of column name database.table.column 18 CAN_COMPRESS = 0x0_0020, /// Can compress packets 19 ODBC = 0x0_0040, /// Can handle ODBC 20 LOCAL_FILES = 0x0_0080, /// Can use LOAD DATA LOCAL 21 IGNORE_SPACE = 0x0_0100, /// Can ignore spaces before '$(LPAREN)' 22 PROTOCOL41 = 0x0_0200, /// Can use 4.1+ protocol 23 INTERACTIVE = 0x0_0400, /// Interactive client? 24 SSL = 0x0_0800, /// Can switch to SSL after handshake 25 IGNORE_SIGPIPE = 0x0_1000, /// Ignore sigpipes? 26 TRANSACTIONS = 0x0_2000, /// Transaction support 27 RESERVED = 0x0_4000, // Old flag for 4.1 protocol 28 SECURE_CONNECTION = 0x0_8000, /// 4.1+ authentication 29 MULTI_STATEMENTS = 0x1_0000, /// Multiple statement support 30 MULTI_RESULTS = 0x2_0000, /// Multiple result set support 31 } 32 33 /** 34 * Column type codes 35 */ 36 enum SQLType : short 37 { 38 INFER_FROM_D_TYPE = -1, 39 DECIMAL = 0x00, 40 TINY = 0x01, 41 SHORT = 0x02, 42 INT = 0x03, 43 FLOAT = 0x04, 44 DOUBLE = 0x05, 45 NULL = 0x06, 46 TIMESTAMP = 0x07, 47 LONGLONG = 0x08, 48 INT24 = 0x09, 49 DATE = 0x0a, 50 TIME = 0x0b, 51 DATETIME = 0x0c, 52 YEAR = 0x0d, 53 NEWDATE = 0x0e, 54 VARCHAR = 0x0f, // new in MySQL 5.0 55 BIT = 0x10, // new in MySQL 5.0 56 NEWDECIMAL = 0xf6, // new in MYSQL 5.0 57 ENUM = 0xf7, 58 SET = 0xf8, 59 TINYBLOB = 0xf9, 60 MEDIUMBLOB = 0xfa, 61 LONGBLOB = 0xfb, 62 BLOB = 0xfc, 63 VARSTRING = 0xfd, 64 STRING = 0xfe, 65 GEOMETRY = 0xff 66 } 67 68 /** 69 * Server refresh flags 70 */ 71 enum RefreshFlags : ubyte 72 { 73 GRANT = 1, 74 LOG = 2, 75 TABLES = 4, 76 HOSTS = 8, 77 STATUS = 16, 78 THREADS = 32, 79 SLAVE = 64, 80 MASTER = 128 81 } 82 83 /** 84 * Type of Command Packet (COM_XXX) 85 * See_Also: http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Command_Packet_.28Overview.29 86 * */ 87 enum CommandType : ubyte 88 { 89 SLEEP = 0x00, 90 QUIT = 0x01, 91 INIT_DB = 0x02, 92 QUERY = 0x03, 93 FIELD_LIST = 0x04, 94 CREATE_DB = 0x05, 95 DROP_DB = 0x06, 96 REFRESH = 0x07, 97 SHUTDOWN = 0x08, 98 STATISTICS = 0x09, 99 PROCESS_INFO = 0x0a, 100 CONNECT = 0x0b, 101 PROCESS_KILL = 0x0c, 102 DEBUG = 0x0d, 103 PING = 0x0e, 104 TIME = 0x0f, 105 DELAYED_INSERT = 0x10, 106 CHANGE_USER = 0x11, 107 BINLOG_DUBP = 0x12, 108 TABLE_DUMP = 0x13, 109 CONNECT_OUT = 0x14, 110 REGISTER_SLAVE = 0x15, 111 STMT_PREPARE = 0x16, 112 STMT_EXECUTE = 0x17, 113 STMT_SEND_LONG_DATA = 0x18, 114 STMT_CLOSE = 0x19, 115 STMT_RESET = 0x1a, 116 STMT_OPTION = 0x1b, 117 STMT_FETCH = 0x1c, 118 } 119 120 /// Magic marker sent in the first byte of mysql results in response to auth or command packets 121 enum ResultPacketMarker : ubyte 122 { 123 /** Server reports an error 124 * See_Also: http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Error_Packet 125 */ 126 error = 0xff, 127 128 /** No error, no result set. 129 * See_Also: http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#OK_Packet 130 */ 131 ok = 0x00, 132 133 /** Server reports end of data 134 * See_Also: http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#EOF_Packet 135 */ 136 eof = 0xfe, 137 } 138 139 /** Field Flags 140 * See_Also: http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol#Field_Packet 141 */ 142 enum FieldFlags : ushort 143 { 144 NOT_NULL = 0x0001, 145 PRI_KEY = 0x0002, 146 UNIQUE_KEY = 0x0004, 147 MULTIPLE_KEY = 0x0008, 148 BLOB = 0x0010, 149 UNSIGNED = 0x0020, 150 ZEROFILL = 0x0040, 151 BINARY = 0x0080, 152 ENUM = 0x0100, 153 AUTO_INCREMENT = 0x0200, 154 TIMESTAMP = 0x0400, 155 SET = 0x0800 156 }