github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/go-sql-driver/mysql/const.go (about) 1 // Go MySQL Driver - A MySQL-Driver for Go's database/sql package 2 // 3 // Copyright 2012 The Go-MySQL-Driver Authors. All rights reserved. 4 // 5 // This Source Code Form is subject to the terms of the Mozilla Public 6 // License, v. 2.0. If a copy of the MPL was not distributed with this file, 7 // You can obtain one at http://mozilla.org/MPL/2.0/. 8 9 package mysql 10 11 const ( 12 minProtocolVersion byte = 10 13 maxPacketSize = 1<<24 - 1 14 timeFormat = "2006-01-02 15:04:05.999999" 15 ) 16 17 // MySQL constants documentation: 18 // http://dev.mysql.com/doc/internals/en/client-server-protocol.html 19 20 const ( 21 iOK byte = 0x00 22 iLocalInFile byte = 0xfb 23 iEOF byte = 0xfe 24 iERR byte = 0xff 25 ) 26 27 // https://dev.mysql.com/doc/internals/en/capability-flags.html#packet-Protocol::CapabilityFlags 28 type clientFlag uint32 29 30 const ( 31 clientLongPassword clientFlag = 1 << iota 32 clientFoundRows 33 clientLongFlag 34 clientConnectWithDB 35 clientNoSchema 36 clientCompress 37 clientODBC 38 clientLocalFiles 39 clientIgnoreSpace 40 clientProtocol41 41 clientInteractive 42 clientSSL 43 clientIgnoreSIGPIPE 44 clientTransactions 45 clientReserved 46 clientSecureConn 47 clientMultiStatements 48 clientMultiResults 49 clientPSMultiResults 50 clientPluginAuth 51 clientConnectAttrs 52 clientPluginAuthLenEncClientData 53 clientCanHandleExpiredPasswords 54 clientSessionTrack 55 clientDeprecateEOF 56 ) 57 58 const ( 59 comQuit byte = iota + 1 60 comInitDB 61 comQuery 62 comFieldList 63 comCreateDB 64 comDropDB 65 comRefresh 66 comShutdown 67 comStatistics 68 comProcessInfo 69 comConnect 70 comProcessKill 71 comDebug 72 comPing 73 comTime 74 comDelayedInsert 75 comChangeUser 76 comBinlogDump 77 comTableDump 78 comConnectOut 79 comRegisterSlave 80 comStmtPrepare 81 comStmtExecute 82 comStmtSendLongData 83 comStmtClose 84 comStmtReset 85 comSetOption 86 comStmtFetch 87 ) 88 89 // https://dev.mysql.com/doc/internals/en/com-query-response.html#packet-Protocol::ColumnType 90 const ( 91 fieldTypeDecimal byte = iota 92 fieldTypeTiny 93 fieldTypeShort 94 fieldTypeLong 95 fieldTypeFloat 96 fieldTypeDouble 97 fieldTypeNULL 98 fieldTypeTimestamp 99 fieldTypeLongLong 100 fieldTypeInt24 101 fieldTypeDate 102 fieldTypeTime 103 fieldTypeDateTime 104 fieldTypeYear 105 fieldTypeNewDate 106 fieldTypeVarChar 107 fieldTypeBit 108 ) 109 const ( 110 fieldTypeJSON byte = iota + 0xf5 111 fieldTypeNewDecimal 112 fieldTypeEnum 113 fieldTypeSet 114 fieldTypeTinyBLOB 115 fieldTypeMediumBLOB 116 fieldTypeLongBLOB 117 fieldTypeBLOB 118 fieldTypeVarString 119 fieldTypeString 120 fieldTypeGeometry 121 ) 122 123 type fieldFlag uint16 124 125 const ( 126 flagNotNULL fieldFlag = 1 << iota 127 flagPriKey 128 flagUniqueKey 129 flagMultipleKey 130 flagBLOB 131 flagUnsigned 132 flagZeroFill 133 flagBinary 134 flagEnum 135 flagAutoIncrement 136 flagTimestamp 137 flagSet 138 flagUnknown1 139 flagUnknown2 140 flagUnknown3 141 flagUnknown4 142 ) 143 144 // http://dev.mysql.com/doc/internals/en/status-flags.html 145 type statusFlag uint16 146 147 const ( 148 statusInTrans statusFlag = 1 << iota 149 statusInAutocommit 150 statusReserved // Not in documentation 151 statusMoreResultsExists 152 statusNoGoodIndexUsed 153 statusNoIndexUsed 154 statusCursorExists 155 statusLastRowSent 156 statusDbDropped 157 statusNoBackslashEscapes 158 statusMetadataChanged 159 statusQueryWasSlow 160 statusPsOutParams 161 statusInTransReadonly 162 statusSessionStateChanged 163 )