github.com/matrixorigin/matrixone@v1.2.0/pkg/frontend/mysql_protocol_predefines.go (about)

     1  // Copyright 2021 Matrix Origin
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package frontend
    16  
    17  // tuple (collation name, charset)
    18  type charsetCollationName struct {
    19  	charset       string
    20  	collationName string
    21  }
    22  
    23  // the map: collation id --> (charset, collation name)
    24  // Run the SQL below in Mysql 8.0.23 to get the map.
    25  // the SQL: select concat(RelationName,':\t\t{"',CHARACTER_SET_NAME,'",\t"',collation_name,'"},') from INFORMATION_SCHEMA.COLLATIONS order by id;
    26  var collationID2CharsetAndName = map[int]charsetCollationName{
    27  	1:   {"big5", "big5_chinese_ci"},
    28  	2:   {"latin2", "latin2_czech_cs"},
    29  	3:   {"dec8", "dec8_swedish_ci"},
    30  	4:   {"cp850", "cp850_general_ci"},
    31  	5:   {"latin1", "latin1_german1_ci"},
    32  	6:   {"hp8", "hp8_english_ci"},
    33  	7:   {"koi8r", "koi8r_general_ci"},
    34  	8:   {"latin1", "latin1_swedish_ci"},
    35  	9:   {"latin2", "latin2_general_ci"},
    36  	10:  {"swe7", "swe7_swedish_ci"},
    37  	11:  {"ascii", "ascii_general_ci"},
    38  	12:  {"ujis", "ujis_japanese_ci"},
    39  	13:  {"sjis", "sjis_japanese_ci"},
    40  	14:  {"cp1251", "cp1251_bulgarian_ci"},
    41  	15:  {"latin1", "latin1_danish_ci"},
    42  	16:  {"hebrew", "hebrew_general_ci"},
    43  	18:  {"tis620", "tis620_thai_ci"},
    44  	19:  {"euckr", "euckr_korean_ci"},
    45  	20:  {"latin7", "latin7_estonian_cs"},
    46  	21:  {"latin2", "latin2_hungarian_ci"},
    47  	22:  {"koi8u", "koi8u_general_ci"},
    48  	23:  {"cp1251", "cp1251_ukrainian_ci"},
    49  	24:  {"gb2312", "gb2312_chinese_ci"},
    50  	25:  {"greek", "greek_general_ci"},
    51  	26:  {"cp1250", "cp1250_general_ci"},
    52  	27:  {"latin2", "latin2_croatian_ci"},
    53  	28:  {"gbk", "gbk_chinese_ci"},
    54  	29:  {"cp1257", "cp1257_lithuanian_ci"},
    55  	30:  {"latin5", "latin5_turkish_ci"},
    56  	31:  {"latin1", "latin1_german2_ci"},
    57  	32:  {"armscii8", "armscii8_general_ci"},
    58  	33:  {"utf8", "utf8_general_ci"},
    59  	34:  {"cp1250", "cp1250_czech_cs"},
    60  	35:  {"ucs2", "ucs2_general_ci"},
    61  	36:  {"cp866", "cp866_general_ci"},
    62  	37:  {"keybcs2", "keybcs2_general_ci"},
    63  	38:  {"macce", "macce_general_ci"},
    64  	39:  {"macroman", "macroman_general_ci"},
    65  	40:  {"cp852", "cp852_general_ci"},
    66  	41:  {"latin7", "latin7_general_ci"},
    67  	42:  {"latin7", "latin7_general_cs"},
    68  	43:  {"macce", "macce_bin"},
    69  	44:  {"cp1250", "cp1250_croatian_ci"},
    70  	45:  {"utf8mb4", "utf8mb4_general_ci"},
    71  	46:  {"utf8mb4", "utf8mb4_bin"},
    72  	47:  {"latin1", "latin1_bin"},
    73  	48:  {"latin1", "latin1_general_ci"},
    74  	49:  {"latin1", "latin1_general_cs"},
    75  	50:  {"cp1251", "cp1251_bin"},
    76  	51:  {"cp1251", "cp1251_general_ci"},
    77  	52:  {"cp1251", "cp1251_general_cs"},
    78  	53:  {"macroman", "macroman_bin"},
    79  	54:  {"utf16", "utf16_general_ci"},
    80  	55:  {"utf16", "utf16_bin"},
    81  	56:  {"utf16le", "utf16le_general_ci"},
    82  	57:  {"cp1256", "cp1256_general_ci"},
    83  	58:  {"cp1257", "cp1257_bin"},
    84  	59:  {"cp1257", "cp1257_general_ci"},
    85  	60:  {"utf32", "utf32_general_ci"},
    86  	61:  {"utf32", "utf32_bin"},
    87  	62:  {"utf16le", "utf16le_bin"},
    88  	63:  {"binary", "binary"},
    89  	64:  {"armscii8", "armscii8_bin"},
    90  	65:  {"ascii", "ascii_bin"},
    91  	66:  {"cp1250", "cp1250_bin"},
    92  	67:  {"cp1256", "cp1256_bin"},
    93  	68:  {"cp866", "cp866_bin"},
    94  	69:  {"dec8", "dec8_bin"},
    95  	70:  {"greek", "greek_bin"},
    96  	71:  {"hebrew", "hebrew_bin"},
    97  	72:  {"hp8", "hp8_bin"},
    98  	73:  {"keybcs2", "keybcs2_bin"},
    99  	74:  {"koi8r", "koi8r_bin"},
   100  	75:  {"koi8u", "koi8u_bin"},
   101  	76:  {"utf8", "utf8_tolower_ci"},
   102  	77:  {"latin2", "latin2_bin"},
   103  	78:  {"latin5", "latin5_bin"},
   104  	79:  {"latin7", "latin7_bin"},
   105  	80:  {"cp850", "cp850_bin"},
   106  	81:  {"cp852", "cp852_bin"},
   107  	82:  {"swe7", "swe7_bin"},
   108  	83:  {"utf8", "utf8_bin"},
   109  	84:  {"big5", "big5_bin"},
   110  	85:  {"euckr", "euckr_bin"},
   111  	86:  {"gb2312", "gb2312_bin"},
   112  	87:  {"gbk", "gbk_bin"},
   113  	88:  {"sjis", "sjis_bin"},
   114  	89:  {"tis620", "tis620_bin"},
   115  	90:  {"ucs2", "ucs2_bin"},
   116  	91:  {"ujis", "ujis_bin"},
   117  	92:  {"geostd8", "geostd8_general_ci"},
   118  	93:  {"geostd8", "geostd8_bin"},
   119  	94:  {"latin1", "latin1_spanish_ci"},
   120  	95:  {"cp932", "cp932_japanese_ci"},
   121  	96:  {"cp932", "cp932_bin"},
   122  	97:  {"eucjpms", "eucjpms_japanese_ci"},
   123  	98:  {"eucjpms", "eucjpms_bin"},
   124  	99:  {"cp1250", "cp1250_polish_ci"},
   125  	101: {"utf16", "utf16_unicode_ci"},
   126  	102: {"utf16", "utf16_icelandic_ci"},
   127  	103: {"utf16", "utf16_latvian_ci"},
   128  	104: {"utf16", "utf16_romanian_ci"},
   129  	105: {"utf16", "utf16_slovenian_ci"},
   130  	106: {"utf16", "utf16_polish_ci"},
   131  	107: {"utf16", "utf16_estonian_ci"},
   132  	108: {"utf16", "utf16_spanish_ci"},
   133  	109: {"utf16", "utf16_swedish_ci"},
   134  	110: {"utf16", "utf16_turkish_ci"},
   135  	111: {"utf16", "utf16_czech_ci"},
   136  	112: {"utf16", "utf16_danish_ci"},
   137  	113: {"utf16", "utf16_lithuanian_ci"},
   138  	114: {"utf16", "utf16_slovak_ci"},
   139  	115: {"utf16", "utf16_spanish2_ci"},
   140  	116: {"utf16", "utf16_roman_ci"},
   141  	117: {"utf16", "utf16_persian_ci"},
   142  	118: {"utf16", "utf16_esperanto_ci"},
   143  	119: {"utf16", "utf16_hungarian_ci"},
   144  	120: {"utf16", "utf16_sinhala_ci"},
   145  	121: {"utf16", "utf16_german2_ci"},
   146  	122: {"utf16", "utf16_croatian_ci"},
   147  	123: {"utf16", "utf16_unicode_520_ci"},
   148  	124: {"utf16", "utf16_vietnamese_ci"},
   149  	128: {"ucs2", "ucs2_unicode_ci"},
   150  	129: {"ucs2", "ucs2_icelandic_ci"},
   151  	130: {"ucs2", "ucs2_latvian_ci"},
   152  	131: {"ucs2", "ucs2_romanian_ci"},
   153  	132: {"ucs2", "ucs2_slovenian_ci"},
   154  	133: {"ucs2", "ucs2_polish_ci"},
   155  	134: {"ucs2", "ucs2_estonian_ci"},
   156  	135: {"ucs2", "ucs2_spanish_ci"},
   157  	136: {"ucs2", "ucs2_swedish_ci"},
   158  	137: {"ucs2", "ucs2_turkish_ci"},
   159  	138: {"ucs2", "ucs2_czech_ci"},
   160  	139: {"ucs2", "ucs2_danish_ci"},
   161  	140: {"ucs2", "ucs2_lithuanian_ci"},
   162  	141: {"ucs2", "ucs2_slovak_ci"},
   163  	142: {"ucs2", "ucs2_spanish2_ci"},
   164  	143: {"ucs2", "ucs2_roman_ci"},
   165  	144: {"ucs2", "ucs2_persian_ci"},
   166  	145: {"ucs2", "ucs2_esperanto_ci"},
   167  	146: {"ucs2", "ucs2_hungarian_ci"},
   168  	147: {"ucs2", "ucs2_sinhala_ci"},
   169  	148: {"ucs2", "ucs2_german2_ci"},
   170  	149: {"ucs2", "ucs2_croatian_ci"},
   171  	150: {"ucs2", "ucs2_unicode_520_ci"},
   172  	151: {"ucs2", "ucs2_vietnamese_ci"},
   173  	159: {"ucs2", "ucs2_general_mysql500_ci"},
   174  	160: {"utf32", "utf32_unicode_ci"},
   175  	161: {"utf32", "utf32_icelandic_ci"},
   176  	162: {"utf32", "utf32_latvian_ci"},
   177  	163: {"utf32", "utf32_romanian_ci"},
   178  	164: {"utf32", "utf32_slovenian_ci"},
   179  	165: {"utf32", "utf32_polish_ci"},
   180  	166: {"utf32", "utf32_estonian_ci"},
   181  	167: {"utf32", "utf32_spanish_ci"},
   182  	168: {"utf32", "utf32_swedish_ci"},
   183  	169: {"utf32", "utf32_turkish_ci"},
   184  	170: {"utf32", "utf32_czech_ci"},
   185  	171: {"utf32", "utf32_danish_ci"},
   186  	172: {"utf32", "utf32_lithuanian_ci"},
   187  	173: {"utf32", "utf32_slovak_ci"},
   188  	174: {"utf32", "utf32_spanish2_ci"},
   189  	175: {"utf32", "utf32_roman_ci"},
   190  	176: {"utf32", "utf32_persian_ci"},
   191  	177: {"utf32", "utf32_esperanto_ci"},
   192  	178: {"utf32", "utf32_hungarian_ci"},
   193  	179: {"utf32", "utf32_sinhala_ci"},
   194  	180: {"utf32", "utf32_german2_ci"},
   195  	181: {"utf32", "utf32_croatian_ci"},
   196  	182: {"utf32", "utf32_unicode_520_ci"},
   197  	183: {"utf32", "utf32_vietnamese_ci"},
   198  	192: {"utf8", "utf8_unicode_ci"},
   199  	193: {"utf8", "utf8_icelandic_ci"},
   200  	194: {"utf8", "utf8_latvian_ci"},
   201  	195: {"utf8", "utf8_romanian_ci"},
   202  	196: {"utf8", "utf8_slovenian_ci"},
   203  	197: {"utf8", "utf8_polish_ci"},
   204  	198: {"utf8", "utf8_estonian_ci"},
   205  	199: {"utf8", "utf8_spanish_ci"},
   206  	200: {"utf8", "utf8_swedish_ci"},
   207  	201: {"utf8", "utf8_turkish_ci"},
   208  	202: {"utf8", "utf8_czech_ci"},
   209  	203: {"utf8", "utf8_danish_ci"},
   210  	204: {"utf8", "utf8_lithuanian_ci"},
   211  	205: {"utf8", "utf8_slovak_ci"},
   212  	206: {"utf8", "utf8_spanish2_ci"},
   213  	207: {"utf8", "utf8_roman_ci"},
   214  	208: {"utf8", "utf8_persian_ci"},
   215  	209: {"utf8", "utf8_esperanto_ci"},
   216  	210: {"utf8", "utf8_hungarian_ci"},
   217  	211: {"utf8", "utf8_sinhala_ci"},
   218  	212: {"utf8", "utf8_german2_ci"},
   219  	213: {"utf8", "utf8_croatian_ci"},
   220  	214: {"utf8", "utf8_unicode_520_ci"},
   221  	215: {"utf8", "utf8_vietnamese_ci"},
   222  	223: {"utf8", "utf8_general_mysql500_ci"},
   223  	224: {"utf8mb4", "utf8mb4_unicode_ci"},
   224  	225: {"utf8mb4", "utf8mb4_icelandic_ci"},
   225  	226: {"utf8mb4", "utf8mb4_latvian_ci"},
   226  	227: {"utf8mb4", "utf8mb4_romanian_ci"},
   227  	228: {"utf8mb4", "utf8mb4_slovenian_ci"},
   228  	229: {"utf8mb4", "utf8mb4_polish_ci"},
   229  	230: {"utf8mb4", "utf8mb4_estonian_ci"},
   230  	231: {"utf8mb4", "utf8mb4_spanish_ci"},
   231  	232: {"utf8mb4", "utf8mb4_swedish_ci"},
   232  	233: {"utf8mb4", "utf8mb4_turkish_ci"},
   233  	234: {"utf8mb4", "utf8mb4_czech_ci"},
   234  	235: {"utf8mb4", "utf8mb4_danish_ci"},
   235  	236: {"utf8mb4", "utf8mb4_lithuanian_ci"},
   236  	237: {"utf8mb4", "utf8mb4_slovak_ci"},
   237  	238: {"utf8mb4", "utf8mb4_spanish2_ci"},
   238  	239: {"utf8mb4", "utf8mb4_roman_ci"},
   239  	240: {"utf8mb4", "utf8mb4_persian_ci"},
   240  	241: {"utf8mb4", "utf8mb4_esperanto_ci"},
   241  	242: {"utf8mb4", "utf8mb4_hungarian_ci"},
   242  	243: {"utf8mb4", "utf8mb4_sinhala_ci"},
   243  	244: {"utf8mb4", "utf8mb4_german2_ci"},
   244  	245: {"utf8mb4", "utf8mb4_croatian_ci"},
   245  	246: {"utf8mb4", "utf8mb4_unicode_520_ci"},
   246  	247: {"utf8mb4", "utf8mb4_vietnamese_ci"},
   247  	248: {"gb18030", "gb18030_chinese_ci"},
   248  	249: {"gb18030", "gb18030_bin"},
   249  	250: {"gb18030", "gb18030_unicode_520_ci"},
   250  	255: {"utf8mb4", "utf8mb4_0900_ai_ci"},
   251  	256: {"utf8mb4", "utf8mb4_de_pb_0900_ai_ci"},
   252  	257: {"utf8mb4", "utf8mb4_is_0900_ai_ci"},
   253  	258: {"utf8mb4", "utf8mb4_lv_0900_ai_ci"},
   254  	259: {"utf8mb4", "utf8mb4_ro_0900_ai_ci"},
   255  	260: {"utf8mb4", "utf8mb4_sl_0900_ai_ci"},
   256  	261: {"utf8mb4", "utf8mb4_pl_0900_ai_ci"},
   257  	262: {"utf8mb4", "utf8mb4_et_0900_ai_ci"},
   258  	263: {"utf8mb4", "utf8mb4_es_0900_ai_ci"},
   259  	264: {"utf8mb4", "utf8mb4_sv_0900_ai_ci"},
   260  	265: {"utf8mb4", "utf8mb4_tr_0900_ai_ci"},
   261  	266: {"utf8mb4", "utf8mb4_cs_0900_ai_ci"},
   262  	267: {"utf8mb4", "utf8mb4_da_0900_ai_ci"},
   263  	268: {"utf8mb4", "utf8mb4_lt_0900_ai_ci"},
   264  	269: {"utf8mb4", "utf8mb4_sk_0900_ai_ci"},
   265  	270: {"utf8mb4", "utf8mb4_es_trad_0900_ai_ci"},
   266  	271: {"utf8mb4", "utf8mb4_la_0900_ai_ci"},
   267  	273: {"utf8mb4", "utf8mb4_eo_0900_ai_ci"},
   268  	274: {"utf8mb4", "utf8mb4_hu_0900_ai_ci"},
   269  	275: {"utf8mb4", "utf8mb4_hr_0900_ai_ci"},
   270  	277: {"utf8mb4", "utf8mb4_vi_0900_ai_ci"},
   271  	278: {"utf8mb4", "utf8mb4_0900_as_cs"},
   272  	279: {"utf8mb4", "utf8mb4_de_pb_0900_as_cs"},
   273  	280: {"utf8mb4", "utf8mb4_is_0900_as_cs"},
   274  	281: {"utf8mb4", "utf8mb4_lv_0900_as_cs"},
   275  	282: {"utf8mb4", "utf8mb4_ro_0900_as_cs"},
   276  	283: {"utf8mb4", "utf8mb4_sl_0900_as_cs"},
   277  	284: {"utf8mb4", "utf8mb4_pl_0900_as_cs"},
   278  	285: {"utf8mb4", "utf8mb4_et_0900_as_cs"},
   279  	286: {"utf8mb4", "utf8mb4_es_0900_as_cs"},
   280  	287: {"utf8mb4", "utf8mb4_sv_0900_as_cs"},
   281  	288: {"utf8mb4", "utf8mb4_tr_0900_as_cs"},
   282  	289: {"utf8mb4", "utf8mb4_cs_0900_as_cs"},
   283  	290: {"utf8mb4", "utf8mb4_da_0900_as_cs"},
   284  	291: {"utf8mb4", "utf8mb4_lt_0900_as_cs"},
   285  	292: {"utf8mb4", "utf8mb4_sk_0900_as_cs"},
   286  	293: {"utf8mb4", "utf8mb4_es_trad_0900_as_cs"},
   287  	294: {"utf8mb4", "utf8mb4_la_0900_as_cs"},
   288  	296: {"utf8mb4", "utf8mb4_eo_0900_as_cs"},
   289  	297: {"utf8mb4", "utf8mb4_hu_0900_as_cs"},
   290  	298: {"utf8mb4", "utf8mb4_hr_0900_as_cs"},
   291  	300: {"utf8mb4", "utf8mb4_vi_0900_as_cs"},
   292  	303: {"utf8mb4", "utf8mb4_ja_0900_as_cs"},
   293  	304: {"utf8mb4", "utf8mb4_ja_0900_as_cs_ks"},
   294  	305: {"utf8mb4", "utf8mb4_0900_as_ci"},
   295  	306: {"utf8mb4", "utf8mb4_ru_0900_ai_ci"},
   296  	307: {"utf8mb4", "utf8mb4_ru_0900_as_cs"},
   297  	308: {"utf8mb4", "utf8mb4_zh_0900_as_cs"},
   298  	309: {"utf8mb4", "utf8mb4_0900_bin"},
   299  }
   300  
   301  // mysql client capabilities
   302  const (
   303  	CLIENT_LONG_PASSWORD                  uint32 = 0x00000001
   304  	CLIENT_FOUND_ROWS                     uint32 = 0x00000002
   305  	CLIENT_LONG_FLAG                      uint32 = 0x00000004
   306  	CLIENT_CONNECT_WITH_DB                uint32 = 0x00000008
   307  	CLIENT_NO_SCHEMA                      uint32 = 0x00000010
   308  	CLIENT_COMPRESS                       uint32 = 0x00000020
   309  	CLIENT_LOCAL_FILES                    uint32 = 0x00000080
   310  	CLIENT_IGNORE_SPACE                   uint32 = 0x00000100
   311  	CLIENT_PROTOCOL_41                    uint32 = 0x00000200
   312  	CLIENT_INTERACTIVE                    uint32 = 0x00000400
   313  	CLIENT_SSL                            uint32 = 0x00000800
   314  	CLIENT_IGNORE_SIGPIPE                 uint32 = 0x00001000
   315  	CLIENT_TRANSACTIONS                   uint32 = 0x00002000
   316  	CLIENT_RESERVED                       uint32 = 0x00004000
   317  	CLIENT_SECURE_CONNECTION              uint32 = 0x00008000
   318  	CLIENT_MULTI_STATEMENTS               uint32 = 0x00010000
   319  	CLIENT_MULTI_RESULTS                  uint32 = 0x00020000
   320  	CLIENT_PS_MULTI_RESULTS               uint32 = 0x00040000
   321  	CLIENT_PLUGIN_AUTH                    uint32 = 0x00080000
   322  	CLIENT_CONNECT_ATTRS                  uint32 = 0x00100000
   323  	CLIENT_PLUGIN_AUTH_LENENC_CLIENT_DATA uint32 = 0x00200000
   324  	CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS   uint32 = 0x00400000
   325  	CLIENT_SESSION_TRACK                  uint32 = 0x00800000
   326  	CLIENT_DEPRECATE_EOF                  uint32 = 0x01000000
   327  )
   328  
   329  // server status
   330  const (
   331  	SERVER_STATUS_IN_TRANS             uint16 = 0x0001 // A transaction is currently active
   332  	SERVER_STATUS_AUTOCOMMIT           uint16 = 0x0002 // Autocommit mode is set
   333  	SERVER_MORE_RESULTS_EXISTS         uint16 = 0x0008 // More results exists (more packet follow)
   334  	SERVER_STATUS_NO_GOOD_INDEX_USED   uint16 = 0x0010
   335  	SERVER_STATUS_NO_INDEX_USED        uint16 = 0x0020
   336  	SERVER_STATUS_CURSOR_EXISTS        uint16 = 0x0040 // When using COM_STMT_FETCH, indicate that current cursor still has result
   337  	SERVER_STATUS_LAST_ROW_SENT        uint16 = 0x0080 // When using COM_STMT_FETCH, indicate that current cursor has finished to send results
   338  	SERVER_STATUS_DB_DROPPED           uint16 = 0x0100 // Database has been dropped
   339  	SERVER_STATUS_NO_BACKSLASH_ESCAPES uint16 = 0x0200 // Current escape mode is "no backslash escape"
   340  	SERVER_STATUS_METADATA_CHANGED     uint16 = 0x0400 // A DDL change did have an impact on an existing PREPARE (an automatic reprepare has been executed)
   341  	SERVER_QUERY_WAS_SLOW              uint16 = 0x0800
   342  	SERVER_PS_OUT_PARAMS               uint16 = 0x1000 // This resultset contain stored procedure output parameter
   343  	SERVER_STATUS_IN_TRANS_READONLY    uint16 = 0x2000 // Current transaction is a read-only transaction
   344  	SERVER_SESSION_STATE_CHANGED       uint16 = 0x4000 // Session state change. see Session change type for more information
   345  )
   346  
   347  type CommandType uint8
   348  
   349  // text protocol in mysql client protocol
   350  // iteration command
   351  const (
   352  	COM_SLEEP               CommandType = 0x00
   353  	COM_QUIT                CommandType = 0x01
   354  	COM_INIT_DB             CommandType = 0x02
   355  	COM_QUERY               CommandType = 0x03
   356  	COM_FIELD_LIST          CommandType = 0x04
   357  	COM_CREATE_DB           CommandType = 0x05
   358  	COM_DROP_DB             CommandType = 0x06
   359  	COM_REFRESH             CommandType = 0x07
   360  	COM_SHUTDOWN            CommandType = 0x08
   361  	COM_STATISTICS          CommandType = 0x09
   362  	COM_PROCESS_INFO        CommandType = 0x0a
   363  	COM_CONNECT             CommandType = 0x0b
   364  	COM_PROCESS_KILL        CommandType = 0x0c
   365  	COM_DEBUG               CommandType = 0x0d
   366  	COM_PING                CommandType = 0x0e
   367  	COM_TIME                CommandType = 0x0f
   368  	COM_DELAYED_INSERT      CommandType = 0x10
   369  	COM_CHANGE_USER         CommandType = 0x11
   370  	COM_STMT_PREPARE        CommandType = 0x16
   371  	COM_STMT_EXECUTE        CommandType = 0x17
   372  	COM_STMT_SEND_LONG_DATA CommandType = 0x18
   373  	COM_STMT_CLOSE          CommandType = 0x19
   374  	COM_STMT_RESET          CommandType = 0x1a
   375  	COM_SET_OPTION          CommandType = 0x1b
   376  	COM_STMT_FETCH          CommandType = 0x1c
   377  	COM_DAEMON              CommandType = 0x1d
   378  	COM_RESET_CONNECTION    CommandType = 0x1f
   379  )
   380  
   381  func (ct CommandType) String() string {
   382  	switch ct {
   383  	case COM_SLEEP:
   384  		return "COM_SLEEP"
   385  	case COM_QUIT:
   386  		return "COM_QUIT"
   387  	case COM_INIT_DB:
   388  		return "COM_INIT_DB"
   389  	case COM_QUERY:
   390  		return "COM_QUERY"
   391  	case COM_FIELD_LIST:
   392  		return "COM_FIELD_LIST"
   393  	case COM_CREATE_DB:
   394  		return "COM_CREATE_DB"
   395  	case COM_DROP_DB:
   396  		return "COM_DROP_DB"
   397  	case COM_REFRESH:
   398  		return "COM_REFRESH"
   399  	case COM_SHUTDOWN:
   400  		return "COM_SHUTDOWN"
   401  	case COM_STATISTICS:
   402  		return "COM_STATISTICS"
   403  	case COM_PROCESS_INFO:
   404  		return "COM_PROCESS_INFO"
   405  	case COM_CONNECT:
   406  		return "COM_CONNECT"
   407  	case COM_PROCESS_KILL:
   408  		return "COM_PROCESS_KILL"
   409  	case COM_DEBUG:
   410  		return "COM_DEBUG"
   411  	case COM_PING:
   412  		return "COM_PING"
   413  	case COM_TIME:
   414  		return "COM_TIME"
   415  	case COM_DELAYED_INSERT:
   416  		return "COM_DELAYED_INSERT"
   417  	case COM_CHANGE_USER:
   418  		return "COM_CHANGE_USER"
   419  	case COM_STMT_PREPARE:
   420  		return "COM_STMT_PREPARE"
   421  	case COM_STMT_EXECUTE:
   422  		return "COM_STMT_EXECUTE"
   423  	case COM_STMT_SEND_LONG_DATA:
   424  		return "COM_STMT_SEND_LONG_DATA"
   425  	case COM_STMT_CLOSE:
   426  		return "COM_STMT_CLOSE"
   427  	case COM_STMT_RESET:
   428  		return "COM_STMT_RESET"
   429  	case COM_SET_OPTION:
   430  		return "COM_SET_OPTION"
   431  	case COM_STMT_FETCH:
   432  		return "COM_STMT_FETCH"
   433  	case COM_DAEMON:
   434  		return "COM_DAEMON"
   435  	case COM_RESET_CONNECTION:
   436  		return "COM_RESET_CONNECTION"
   437  	default:
   438  		return ""
   439  	}
   440  }
   441  
   442  // reference to sql/query_options.h in mysql server 8.0.23
   443  const (
   444  	OPTION_AUTOCOMMIT                     uint32 = 1 << 8
   445  	OPTION_BIG_SELECTS                    uint32 = 1 << 9
   446  	OPTION_LOG_OFF                        uint32 = 1 << 10
   447  	OPTION_QUOTE_SHOW_CREATE              uint32 = 1 << 11
   448  	TMP_TABLE_ALL_COLUMNS                 uint32 = 1 << 12
   449  	OPTION_WARNINGS                       uint32 = 1 << 13
   450  	OPTION_AUTO_IS_NULL                   uint32 = 1 << 14
   451  	OPTION_FOUND_COMMENT                  uint32 = 1 << 15
   452  	OPTION_SAFE_UPDATES                   uint32 = 1 << 16
   453  	OPTION_BUFFER_RESULT                  uint32 = 1 << 17
   454  	OPTION_BIN_LOG                        uint32 = 1 << 18
   455  	OPTION_NOT_AUTOCOMMIT                 uint32 = 1 << 19
   456  	OPTION_BEGIN                          uint32 = 1 << 20
   457  	OPTION_TABLE_LOCK                     uint32 = 1 << 21
   458  	OPTION_QUICK                          uint32 = 1 << 22
   459  	OPTION_NO_CONST_TABLES                uint32 = 1 << 23
   460  	OPTION_ATTACH_ABORT_TRANSACTION_ERROR uint32 = 1 << 24 //defined in mo
   461  )