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