mysql

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package mysql query provides functions to transform queries.

Index

Constants

View Source
const (
	// KeywordDefault means default
	KeywordDefault = "default"

	UTF8Charset    = "utf8"
	UTF8MB4Charset = "utf8mb4"
	DefaultCharset = UTF8MB4Charset
	// DefaultCollationID is utf8mb4_bin(46)
	DefaultCollationID      = 46
	BinaryCollationID       = 63
	UTF8DefaultCollation    = "utf8_bin"
	UTF8MB4DefaultCollation = "utf8mb4_bin"
	DefaultCollationName    = UTF8MB4DefaultCollation
)

MySQL collation information.

View Source
const (
	// CharsetBin is used for marking binary charset.
	CharsetBin = "binary"
	// CollationBin is the default collation for CharsetBin.
	CollationBin = "binary"
	// CharsetUTF8 is the default charset for string types.
	CharsetUTF8 = "utf8"
	// CollationUTF8 is the default collation for CharsetUTF8.
	CollationUTF8 = "utf8_bin"
	// CharsetUTF8MB4 represents 4 bytes utf8, which works the same way as utf8 in Go.
	CharsetUTF8MB4 = "utf8mb4"
	// CollationUTF8MB4 is the default collation for CharsetUTF8MB4.
	CollationUTF8MB4 = "utf8mb4_bin"
	// CharsetASCII is a subset of UTF8.
	CharsetASCII = "ascii"
	// CollationASCII is the default collation for CharsetACSII.
	CollationASCII = "ascii_bin"
	// CharsetLatin1 is a single byte charset.
	CharsetLatin1 = "latin1"
	// CollationLatin1 is the default collation for CharsetLatin1.
	CollationLatin1 = "latin1_bin"
)
View Source
const (
	// MinProtocolVersion min protocol version
	MinProtocolVersion byte = 10
	// MaxPayloadLen max payload length
	MaxPayloadLen int = 1<<24 - 1
	// TimeFormat time format
	TimeFormat string = "2006-01-02 15:04:05"
	// ServerVersion server version
	ServerVersion string = "5.6.20-shazam"
	// MysqlNativePassword uses a salt and transmits a hash on the wire.
	MysqlNativePassword = "mysql_native_password"
	// ProtocolVersion is the current version of the protocol.
	// Always 10.
	ProtocolVersion = 10
)
View Source
const (
	OKHeader          byte = 0x00
	ErrHeader         byte = 0xff
	EOFHeader         byte = 0xfe
	LocalInFileHeader byte = 0xfb
)

Header information.

View Source
const (
	ServerStatusInTrans            uint16 = 0x0001
	ServerStatusAutocommit         uint16 = 0x0002
	ServerMoreResultsExists        uint16 = 0x0008
	ServerStatusNoGoodIndexUsed    uint16 = 0x0010
	ServerStatusNoIndexUsed        uint16 = 0x0020
	ServerStatusCursorExists       uint16 = 0x0040
	ServerStatusLastRowSend        uint16 = 0x0080
	ServerStatusDBDropped          uint16 = 0x0100
	ServerStatusNoBackslashEscaped uint16 = 0x0200
	ServerStatusMetadataChanged    uint16 = 0x0400
	ServerStatusWasSlow            uint16 = 0x0800
	ServerPSOutParams              uint16 = 0x1000
)

Server information.

View Source
const (
	ComSleep byte = iota
	ComQuit
	ComInitDB
	ComQuery
	ComFieldList
	ComCreateDB
	ComDropDB
	ComRefresh
	ComShutdown
	ComStatistics
	ComProcessInfo
	ComConnect
	ComProcessKill
	ComDebug
	ComPing
	ComTime
	ComDelayedInsert
	ComChangeUser
	ComBinlogDump
	ComTableDump
	ComConnectOut
	ComRegisterSlave
	ComStmtPrepare
	ComStmtExecute
	ComStmtSendLongData
	ComStmtClose
	ComStmtReset
	ComSetOption
	ComStmtFetch
	ComDaemon
	ComBinlogDumpGtid
	ComResetConnection
	ComEnd
)

Command information.

View Source
const (
	ClientLongPassword uint32 = 1 << iota
	ClientFoundRows
	ClientLongFlag
	ClientConnectWithDB
	ClientNoSchema
	ClientCompress
	ClientODBC
	ClientLocalFiles
	ClientIgnoreSpace
	ClientProtocol41
	ClientInteractive
	ClientSSL
	ClientIgnoreSigpipe
	ClientTransactions
	ClientReserved
	ClientSecureConnection
	ClientMultiStatements
	ClientMultiResults
	ClientPSMultiResults
	ClientPluginAuth
	ClientConnectAtts
	ClientPluginAuthLenencClientData
)

Client information.

View Source
const (
	// For arguments that have no fixed number of decimals, the decimals value is set to 31,
	// which is 1 more than the maximum number of decimals permitted for the DECIMAL, FLOAT, and DOUBLE data types.
	NotFixedDec = 31

	MaxIntWidth             = 20
	MaxRealWidth            = 23
	MaxFloatingTypeScale    = 30
	MaxFloatingTypeWidth    = 255
	MaxDecimalScale         = 30
	MaxDecimalWidth         = 65
	MaxDateWidth            = 10 // YYYY-MM-DD.
	MaxDatetimeWidthNoFsp   = 19 // YYYY-MM-DD HH:MM:SS
	MaxDatetimeWidthWithFsp = 26 // YYYY-MM-DD HH:MM:SS[.fraction]
	MaxDatetimeFullWidth    = 29 // YYYY-MM-DD HH:MM:SS.###### AM
	MaxDurationWidthNoFsp   = 10 // HH:MM:SS
	MaxDurationWidthWithFsp = 15 // HH:MM:SS[.fraction]
	MaxBlobWidth            = 16777216
)

MySQL type maximum length.

View Source
const (
	ErrErrorFirst                                            uint16 = 1000
	ErrHashchk                                                      = 1000
	ErrNisamchk                                                     = 1001
	ErrNo                                                           = 1002
	ErrYes                                                          = 1003
	ErrCantCreateFile                                               = 1004
	ErrCantCreateTable                                              = 1005
	ErrCantCreateDB                                                 = 1006
	ErrDBCreateExists                                               = 1007
	ErrDBDropExists                                                 = 1008
	ErrDBDropDelete                                                 = 1009
	ErrDBDropRmdir                                                  = 1010
	ErrCantDeleteFile                                               = 1011
	ErrCantFindSystemRec                                            = 1012
	ErrCantGetStat                                                  = 1013
	ErrCantGetWd                                                    = 1014
	ErrCantLock                                                     = 1015
	ErrCantOpenFile                                                 = 1016
	ErrFileNotFound                                                 = 1017
	ErrCantReadDir                                                  = 1018
	ErrCantSetWd                                                    = 1019
	ErrCheckread                                                    = 1020
	ErrDiskFull                                                     = 1021
	ErrDupKey                                                       = 1022
	ErrErrorOnClose                                                 = 1023
	ErrErrorOnRead                                                  = 1024
	ErrErrorOnRename                                                = 1025
	ErrErrorOnWrite                                                 = 1026
	ErrFileUsed                                                     = 1027
	ErrFilsortAbort                                                 = 1028
	ErrFormNotFound                                                 = 1029
	ErrGetErrno                                                     = 1030
	ErrIllegalHa                                                    = 1031
	ErrKeyNotFound                                                  = 1032
	ErrNotFormFile                                                  = 1033
	ErrNotKeyFile                                                   = 1034
	ErrOldKeyFile                                                   = 1035
	ErrOpenAsReadonly                                               = 1036
	ErrOutofMemory                                                  = 1037
	ErrOutOfSortMemory                                              = 1038
	ErrUnexpectedEOF                                                = 1039
	ErrConCount                                                     = 1040
	ErrOutOfResources                                               = 1041
	ErrBadHost                                                      = 1042
	ErrHandshake                                                    = 1043
	ErrDBaccessDenied                                               = 1044
	ErrAccessDenied                                                 = 1045
	ErrNoDB                                                         = 1046
	ErrUnknownCom                                                   = 1047
	ErrBadNull                                                      = 1048
	ErrBadDB                                                        = 1049
	ErrTableExists                                                  = 1050
	ErrBadTable                                                     = 1051
	ErrNonUniq                                                      = 1052
	ErrServerShutdown                                               = 1053
	ErrBadField                                                     = 1054
	ErrFieldNotInGroupBy                                            = 1055
	ErrWrongGroupField                                              = 1056
	ErrWrongSumSelect                                               = 1057
	ErrWrongValueCount                                              = 1058
	ErrTooLongIdent                                                 = 1059
	ErrDupFieldName                                                 = 1060
	ErrDupKeyName                                                   = 1061
	ErrDupEntry                                                     = 1062
	ErrWrongFieldSpec                                               = 1063
	ErrParse                                                        = 1064
	ErrEmptyQuery                                                   = 1065
	ErrNonuniqTable                                                 = 1066
	ErrInvalidDefault                                               = 1067
	ErrMultiplePriKey                                               = 1068
	ErrTooManyKeys                                                  = 1069
	ErrTooManyKeyParts                                              = 1070
	ErrTooLongKey                                                   = 1071
	ErrKeyColumnDoesNotExits                                        = 1072
	ErrBlobUsedAsKey                                                = 1073
	ErrTooBigFieldlength                                            = 1074
	ErrWrongAutoKey                                                 = 1075
	ErrReady                                                        = 1076
	ErrNormalShutdown                                               = 1077
	ErrGotSignal                                                    = 1078
	ErrShutdownComplete                                             = 1079
	ErrForcingClose                                                 = 1080
	ErrIpsock                                                       = 1081
	ErrNoSuchIndex                                                  = 1082
	ErrWrongFieldTerminators                                        = 1083
	ErrBlobsAndNoTerminated                                         = 1084
	ErrTextFileNotReadable                                          = 1085
	ErrFileExists                                                   = 1086
	ErrLoadInfo                                                     = 1087
	ErrAlterInfo                                                    = 1088
	ErrWrongSubKey                                                  = 1089
	ErrCantRemoveAllFields                                          = 1090
	ErrCantDropFieldOrKey                                           = 1091
	ErrInsertInfo                                                   = 1092
	ErrUpdateTableUsed                                              = 1093
	ErrNoSuchThread                                                 = 1094
	ErrKillDenied                                                   = 1095
	ErrNoTablesUsed                                                 = 1096
	ErrTooBigSet                                                    = 1097
	ErrNoUniqueLogFile                                              = 1098
	ErrTableNotLockedForWrite                                       = 1099
	ErrTableNotLocked                                               = 1100
	ErrBlobCantHaveDefault                                          = 1101
	ErrWrongDBName                                                  = 1102
	ErrWrongTableName                                               = 1103
	ErrTooBigSelect                                                 = 1104
	ErrUnknown                                                      = 1105
	ErrUnknownProcedure                                             = 1106
	ErrWrongParamcountToProcedure                                   = 1107
	ErrWrongParametersToProcedure                                   = 1108
	ErrUnknownTable                                                 = 1109
	ErrFieldSpecifiedTwice                                          = 1110
	ErrInvalidGroupFuncUse                                          = 1111
	ErrUnsupportedExtension                                         = 1112
	ErrTableMustHaveColumns                                         = 1113
	ErrRecordFileFull                                               = 1114
	ErrUnknownCharacterSet                                          = 1115
	ErrTooManyTables                                                = 1116
	ErrTooManyFields                                                = 1117
	ErrTooBigRowsize                                                = 1118
	ErrStackOverrun                                                 = 1119
	ErrWrongOuterJoin                                               = 1120
	ErrNullColumnInIndex                                            = 1121
	ErrCantFindUdf                                                  = 1122
	ErrCantInitializeUdf                                            = 1123
	ErrUdfNoPaths                                                   = 1124
	ErrUdfExists                                                    = 1125
	ErrCantOpenLibrary                                              = 1126
	ErrCantFindDlEntry                                              = 1127
	ErrFunctionNotDefined                                           = 1128
	ErrHostIsBlocked                                                = 1129
	ErrHostNotPrivileged                                            = 1130
	ErrPasswordAnonymousUser                                        = 1131
	ErrPasswordNotAllowed                                           = 1132
	ErrPasswordNoMatch                                              = 1133
	ErrUpdateInfo                                                   = 1134
	ErrCantCreateThread                                             = 1135
	ErrWrongValueCountOnRow                                         = 1136
	ErrCantReopenTable                                              = 1137
	ErrInvalidUseOfNull                                             = 1138
	ErrRegexp                                                       = 1139
	ErrMixOfGroupFuncAndFields                                      = 1140
	ErrNonexistingGrant                                             = 1141
	ErrTableaccessDenied                                            = 1142
	ErrColumnaccessDenied                                           = 1143
	ErrIllegalGrantForTable                                         = 1144
	ErrGrantWrongHostOrUser                                         = 1145
	ErrNoSuchTable                                                  = 1146
	ErrNonexistingTableGrant                                        = 1147
	ErrNotAllowedCommand                                            = 1148
	ErrSyntax                                                       = 1149
	ErrDelayedCantChangeLock                                        = 1150
	ErrTooManyDelayedThreads                                        = 1151
	ErrAbortingConnection                                           = 1152
	ErrNetPacketTooLarge                                            = 1153
	ErrNetReadErrorFromPipe                                         = 1154
	ErrNetFcntl                                                     = 1155
	ErrNetPacketsOutOfOrder                                         = 1156
	ErrNetUncompress                                                = 1157
	ErrNetRead                                                      = 1158
	ErrNetReadInterrupted                                           = 1159
	ErrNetErrorOnWrite                                              = 1160
	ErrNetWriteInterrupted                                          = 1161
	ErrTooLongString                                                = 1162
	ErrTableCantHandleBlob                                          = 1163
	ErrTableCantHandleAutoIncrement                                 = 1164
	ErrDelayedInsertTableLocked                                     = 1165
	ErrWrongColumnName                                              = 1166
	ErrWrongKeyColumn                                               = 1167
	ErrWrongMrgTable                                                = 1168
	ErrDupUnique                                                    = 1169
	ErrBlobKeyWithoutLength                                         = 1170
	ErrPrimaryCantHaveNull                                          = 1171
	ErrTooManyRows                                                  = 1172
	ErrRequiresPrimaryKey                                           = 1173
	ErrNoRaidCompiled                                               = 1174
	ErrUpdateWithoutKeyInSafeMode                                   = 1175
	ErrKeyDoesNotExist                                              = 1176
	ErrCheckNoSuchTable                                             = 1177
	ErrCheckNotImplemented                                          = 1178
	ErrCantDoThisDuringAnTransaction                                = 1179
	ErrErrorDuringCommit                                            = 1180
	ErrErrorDuringRollback                                          = 1181
	ErrErrorDuringFlushLogs                                         = 1182
	ErrErrorDuringCheckpoint                                        = 1183
	ErrNewAbortingConnection                                        = 1184
	ErrDumpNotImplemented                                           = 1185
	ErrFlushMasterBinlogClosed                                      = 1186
	ErrIndexRebuild                                                 = 1187
	ErrMaster                                                       = 1188
	ErrMasterNetRead                                                = 1189
	ErrMasterNetWrite                                               = 1190
	ErrFtMatchingKeyNotFound                                        = 1191
	ErrLockOrActiveTransaction                                      = 1192
	ErrUnknownSystemVariable                                        = 1193
	ErrCrashedOnUsage                                               = 1194
	ErrCrashedOnRepair                                              = 1195
	ErrWarningNotCompleteRollback                                   = 1196
	ErrTransCacheFull                                               = 1197
	ErrSlaveMustStop                                                = 1198
	ErrSlaveNotRunning                                              = 1199
	ErrBadSlave                                                     = 1200
	ErrMasterInfo                                                   = 1201
	ErrSlaveThread                                                  = 1202
	ErrTooManyUserConnections                                       = 1203
	ErrSetConstantsOnly                                             = 1204
	ErrLockWaitTimeout                                              = 1205
	ErrLockTableFull                                                = 1206
	ErrReadOnlyTransaction                                          = 1207
	ErrDropDBWithReadLock                                           = 1208
	ErrCreateDBWithReadLock                                         = 1209
	ErrWrongArguments                                               = 1210
	ErrNoPermissionToCreateUser                                     = 1211
	ErrUnionTablesInDifferentDir                                    = 1212
	ErrLockDeadlock                                                 = 1213
	ErrTableCantHandleFt                                            = 1214
	ErrCannotAddForeign                                             = 1215
	ErrNoReferencedRow                                              = 1216
	ErrRowIsReferenced                                              = 1217
	ErrConnectToMaster                                              = 1218
	ErrQueryOnMaster                                                = 1219
	ErrErrorWhenExecutingCommand                                    = 1220
	ErrWrongUsage                                                   = 1221
	ErrWrongNumberOfColumnsInSelect                                 = 1222
	ErrCantUpdateWithReadlock                                       = 1223
	ErrMixingNotAllowed                                             = 1224
	ErrDupArgument                                                  = 1225
	ErrUserLimitReached                                             = 1226
	ErrSpecificAccessDenied                                         = 1227
	ErrLocalVariable                                                = 1228
	ErrGlobalVariable                                               = 1229
	ErrNoDefault                                                    = 1230
	ErrWrongValueForVar                                             = 1231
	ErrWrongTypeForVar                                              = 1232
	ErrVarCantBeRead                                                = 1233
	ErrCantUseOptionHere                                            = 1234
	ErrNotSupportedYet                                              = 1235
	ErrMasterFatalErrorReadingBinlog                                = 1236
	ErrSlaveIgnoredTable                                            = 1237
	ErrIncorrectGlobalLocalVar                                      = 1238
	ErrWrongFkDef                                                   = 1239
	ErrKeyRefDoNotMatchTableRef                                     = 1240
	ErrOperandColumns                                               = 1241
	ErrSubqueryNo1Row                                               = 1242
	ErrUnknownStmtHandler                                           = 1243
	ErrCorruptHelpDB                                                = 1244
	ErrCyclicReference                                              = 1245
	ErrAutoConvert                                                  = 1246
	ErrIllegalReference                                             = 1247
	ErrDerivedMustHaveAlias                                         = 1248
	ErrSelectReduced                                                = 1249
	ErrTablenameNotAllowedHere                                      = 1250
	ErrNotSupportedAuthMode                                         = 1251
	ErrSpatialCantHaveNull                                          = 1252
	ErrCollationCharsetMismatch                                     = 1253
	ErrSlaveWasRunning                                              = 1254
	ErrSlaveWasNotRunning                                           = 1255
	ErrTooBigForUncompress                                          = 1256
	ErrZlibZMem                                                     = 1257
	ErrZlibZBuf                                                     = 1258
	ErrZlibZData                                                    = 1259
	ErrCutValueGroupConcat                                          = 1260
	ErrWarnTooFewRecords                                            = 1261
	ErrWarnTooManyRecords                                           = 1262
	ErrWarnNullToNotnull                                            = 1263
	ErrWarnDataOutOfRange                                           = 1264
	WarnDataTruncated                                               = 1265
	ErrWarnUsingOtherHandler                                        = 1266
	ErrCantAggregate2collations                                     = 1267
	ErrDropUser                                                     = 1268
	ErrRevokeGrants                                                 = 1269
	ErrCantAggregate3collations                                     = 1270
	ErrCantAggregateNcollations                                     = 1271
	ErrVariableIsNotStruct                                          = 1272
	ErrUnknownCollation                                             = 1273
	ErrSlaveIgnoredSslParams                                        = 1274
	ErrServerIsInSecureAuthMode                                     = 1275
	ErrWarnFieldResolved                                            = 1276
	ErrBadSlaveUntilCond                                            = 1277
	ErrMissingSkipSlave                                             = 1278
	ErrUntilCondIgnored                                             = 1279
	ErrWrongNameForIndex                                            = 1280
	ErrWrongNameForCatalog                                          = 1281
	ErrWarnQcResize                                                 = 1282
	ErrBadFtColumn                                                  = 1283
	ErrUnknownKeyCache                                              = 1284
	ErrWarnHostnameWontWork                                         = 1285
	ErrUnknownStorageEngine                                         = 1286
	ErrWarnDeprecatedSyntax                                         = 1287
	ErrNonUpdatableTable                                            = 1288
	ErrFeatureDisabled                                              = 1289
	ErrOptionPreventsStatement                                      = 1290
	ErrDuplicatedValueInType                                        = 1291
	ErrTruncatedWrongValue                                          = 1292
	ErrTooMuchAutoTimestampCols                                     = 1293
	ErrInvalidOnUpdate                                              = 1294
	ErrUnsupportedPs                                                = 1295
	ErrGetErrmsg                                                    = 1296
	ErrGetTemporaryErrmsg                                           = 1297
	ErrUnknownTimeZone                                              = 1298
	ErrWarnInvalidTimestamp                                         = 1299
	ErrInvalidCharacterString                                       = 1300
	ErrWarnAllowedPacketOverflowed                                  = 1301
	ErrConflictingDeclarations                                      = 1302
	ErrSpNoRecursiveCreate                                          = 1303
	ErrSpAlreadyExists                                              = 1304
	ErrSpDoesNotExist                                               = 1305
	ErrSpDropFailed                                                 = 1306
	ErrSpStoreFailed                                                = 1307
	ErrSpLilabelMismatch                                            = 1308
	ErrSpLabelRedefine                                              = 1309
	ErrSpLabelMismatch                                              = 1310
	ErrSpUninitVar                                                  = 1311
	ErrSpBadselect                                                  = 1312
	ErrSpBadreturn                                                  = 1313
	ErrSpBadstatement                                               = 1314
	ErrUpdateLogDeprecatedIgnored                                   = 1315
	ErrUpdateLogDeprecatedTranslated                                = 1316
	ErrQueryInterrupted                                             = 1317
	ErrSpWrongNoOfArgs                                              = 1318
	ErrSpCondMismatch                                               = 1319
	ErrSpNoreturn                                                   = 1320
	ErrSpNoreturnend                                                = 1321
	ErrSpBadCursorQuery                                             = 1322
	ErrSpBadCursorSelect                                            = 1323
	ErrSpCursorMismatch                                             = 1324
	ErrSpCursorAlreadyOpen                                          = 1325
	ErrSpCursorNotOpen                                              = 1326
	ErrSpUndeclaredVar                                              = 1327
	ErrSpWrongNoOfFetchArgs                                         = 1328
	ErrSpFetchNoData                                                = 1329
	ErrSpDupParam                                                   = 1330
	ErrSpDupVar                                                     = 1331
	ErrSpDupCond                                                    = 1332
	ErrSpDupCurs                                                    = 1333
	ErrSpCantAlter                                                  = 1334
	ErrSpSubselectNyi                                               = 1335
	ErrStmtNotAllowedInSfOrTrg                                      = 1336
	ErrSpVarcondAfterCurshndlr                                      = 1337
	ErrSpCursorAfterHandler                                         = 1338
	ErrSpCaseNotFound                                               = 1339
	ErrFparserTooBigFile                                            = 1340
	ErrFparserBadHeader                                             = 1341
	ErrFparserEOFInComment                                          = 1342
	ErrFparserErrorInParameter                                      = 1343
	ErrFparserEOFInUnknownParameter                                 = 1344
	ErrViewNoExplain                                                = 1345
	ErrFrmUnknownType                                               = 1346
	ErrWrongObject                                                  = 1347
	ErrNonupdateableColumn                                          = 1348
	ErrViewSelectDerived                                            = 1349
	ErrViewSelectClause                                             = 1350
	ErrViewSelectVariable                                           = 1351
	ErrViewSelectTmptable                                           = 1352
	ErrViewWrongList                                                = 1353
	ErrWarnViewMerge                                                = 1354
	ErrWarnViewWithoutKey                                           = 1355
	ErrViewInvalid                                                  = 1356
	ErrSpNoDropSp                                                   = 1357
	ErrSpGotoInHndlr                                                = 1358
	ErrTrgAlreadyExists                                             = 1359
	ErrTrgDoesNotExist                                              = 1360
	ErrTrgOnViewOrTempTable                                         = 1361
	ErrTrgCantChangeRow                                             = 1362
	ErrTrgNoSuchRowInTrg                                            = 1363
	ErrNoDefaultForField                                            = 1364
	ErrDivisionByZero                                               = 1365
	ErrTruncatedWrongValueForField                                  = 1366
	ErrIllegalValueForType                                          = 1367
	ErrViewNonupdCheck                                              = 1368
	ErrViewCheckFailed                                              = 1369
	ErrProcaccessDenied                                             = 1370
	ErrRelayLogFail                                                 = 1371
	ErrPasswdLength                                                 = 1372
	ErrUnknownTargetBinlog                                          = 1373
	ErrIoErrLogIndexRead                                            = 1374
	ErrBinlogPurgeProhibited                                        = 1375
	ErrFseekFail                                                    = 1376
	ErrBinlogPurgeFatalErr                                          = 1377
	ErrLogInUse                                                     = 1378
	ErrLogPurgeUnknownErr                                           = 1379
	ErrRelayLogInit                                                 = 1380
	ErrNoBinaryLogging                                              = 1381
	ErrReservedSyntax                                               = 1382
	ErrWsasFailed                                                   = 1383
	ErrDiffGroupsProc                                               = 1384
	ErrNoGroupForProc                                               = 1385
	ErrOrderWithProc                                                = 1386
	ErrLoggingProhibitChangingOf                                    = 1387
	ErrNoFileMapping                                                = 1388
	ErrWrongMagic                                                   = 1389
	ErrPsManyParam                                                  = 1390
	ErrKeyPart0                                                     = 1391
	ErrViewChecksum                                                 = 1392
	ErrViewMultiupdate                                              = 1393
	ErrViewNoInsertFieldList                                        = 1394
	ErrViewDeleteMergeView                                          = 1395
	ErrCannotUser                                                   = 1396
	ErrXaerNota                                                     = 1397
	ErrXaerInval                                                    = 1398
	ErrXaerRmfail                                                   = 1399
	ErrXaerOutside                                                  = 1400
	ErrXaerRmerr                                                    = 1401
	ErrXaRbrollback                                                 = 1402
	ErrNonexistingProcGrant                                         = 1403
	ErrProcAutoGrantFail                                            = 1404
	ErrProcAutoRevokeFail                                           = 1405
	ErrDataTooLong                                                  = 1406
	ErrSpBadSQLstate                                                = 1407
	ErrStartup                                                      = 1408
	ErrLoadFromFixedSizeRowsToVar                                   = 1409
	ErrCantCreateUserWithGrant                                      = 1410
	ErrWrongValueForType                                            = 1411
	ErrTableDefChanged                                              = 1412
	ErrSpDupHandler                                                 = 1413
	ErrSpNotVarArg                                                  = 1414
	ErrSpNoRetset                                                   = 1415
	ErrCantCreateGeometryObject                                     = 1416
	ErrFailedRoutineBreakBinlog                                     = 1417
	ErrBinlogUnsafeRoutine                                          = 1418
	ErrBinlogCreateRoutineNeedSuper                                 = 1419
	ErrExecStmtWithOpenCursor                                       = 1420
	ErrStmtHasNoOpenCursor                                          = 1421
	ErrCommitNotAllowedInSfOrTrg                                    = 1422
	ErrNoDefaultForViewField                                        = 1423
	ErrSpNoRecursion                                                = 1424
	ErrTooBigScale                                                  = 1425
	ErrTooBigPrecision                                              = 1426
	ErrMBiggerThanD                                                 = 1427
	ErrWrongLockOfSystemTable                                       = 1428
	ErrConnectToForeignDataSource                                   = 1429
	ErrQueryOnForeignDataSource                                     = 1430
	ErrForeignDataSourceDoesntExist                                 = 1431
	ErrForeignDataStringInvalidCantCreate                           = 1432
	ErrForeignDataStringInvalid                                     = 1433
	ErrCantCreateFederatedTable                                     = 1434
	ErrTrgInWrongSchema                                             = 1435
	ErrStackOverrunNeedMore                                         = 1436
	ErrTooLongBody                                                  = 1437
	ErrWarnCantDropDefaultKeycache                                  = 1438
	ErrTooBigDisplaywidth                                           = 1439
	ErrXaerDupid                                                    = 1440
	ErrDatetimeFunctionOverflow                                     = 1441
	ErrCantUpdateUsedTableInSfOrTrg                                 = 1442
	ErrViewPreventUpdate                                            = 1443
	ErrPsNoRecursion                                                = 1444
	ErrSpCantSetAutocommit                                          = 1445
	ErrMalformedDefiner                                             = 1446
	ErrViewFrmNoUser                                                = 1447
	ErrViewOtherUser                                                = 1448
	ErrNoSuchUser                                                   = 1449
	ErrForbidSchemaChange                                           = 1450
	ErrRowIsReferenced2                                             = 1451
	ErrNoReferencedRow2                                             = 1452
	ErrSpBadVarShadow                                               = 1453
	ErrTrgNoDefiner                                                 = 1454
	ErrOldFileFormat                                                = 1455
	ErrSpRecursionLimit                                             = 1456
	ErrSpProcTableCorrupt                                           = 1457
	ErrSpWrongName                                                  = 1458
	ErrTableNeedsUpgrade                                            = 1459
	ErrSpNoAggregate                                                = 1460
	ErrMaxPreparedStmtCountReached                                  = 1461
	ErrViewRecursive                                                = 1462
	ErrNonGroupingFieldUsed                                         = 1463
	ErrTableCantHandleSpkeys                                        = 1464
	ErrNoTriggersOnSystemSchema                                     = 1465
	ErrRemovedSpaces                                                = 1466
	ErrAutoincReadFailed                                            = 1467
	ErrUsername                                                     = 1468
	ErrHostname                                                     = 1469
	ErrWrongStringLength                                            = 1470
	ErrNonInsertableTable                                           = 1471
	ErrAdminWrongMrgTable                                           = 1472
	ErrTooHighLevelOfNestingForSelect                               = 1473
	ErrNameBecomesEmpty                                             = 1474
	ErrAmbiguousFieldTerm                                           = 1475
	ErrForeignServerExists                                          = 1476
	ErrForeignServerDoesntExist                                     = 1477
	ErrIllegalHaCreateOption                                        = 1478
	ErrPartitionRequiresValues                                      = 1479
	ErrPartitionWrongValues                                         = 1480
	ErrPartitionMaxvalue                                            = 1481
	ErrPartitionSubpartition                                        = 1482
	ErrPartitionSubpartMix                                          = 1483
	ErrPartitionWrongNoPart                                         = 1484
	ErrPartitionWrongNoSubpart                                      = 1485
	ErrWrongExprInPartitionFunc                                     = 1486
	ErrNoConstExprInRangeOrList                                     = 1487
	ErrFieldNotFoundPart                                            = 1488
	ErrListOfFieldsOnlyInHash                                       = 1489
	ErrInconsistentPartitionInfo                                    = 1490
	ErrPartitionFuncNotAllowed                                      = 1491
	ErrPartitionsMustBeDefined                                      = 1492
	ErrRangeNotIncreasing                                           = 1493
	ErrInconsistentTypeOfFunctions                                  = 1494
	ErrMultipleDefConstInListPart                                   = 1495
	ErrPartitionEntry                                               = 1496
	ErrMixHandler                                                   = 1497
	ErrPartitionNotDefined                                          = 1498
	ErrTooManyPartitions                                            = 1499
	ErrSubpartition                                                 = 1500
	ErrCantCreateHandlerFile                                        = 1501
	ErrBlobFieldInPartFunc                                          = 1502
	ErrUniqueKeyNeedAllFieldsInPf                                   = 1503
	ErrNoParts                                                      = 1504
	ErrPartitionMgmtOnNonpartitioned                                = 1505
	ErrForeignKeyOnPartitioned                                      = 1506
	ErrDropPartitionNonExistent                                     = 1507
	ErrDropLastPartition                                            = 1508
	ErrCoalesceOnlyOnHashPartition                                  = 1509
	ErrReorgHashOnlyOnSameNo                                        = 1510
	ErrReorgNoParam                                                 = 1511
	ErrOnlyOnRangeListPartition                                     = 1512
	ErrAddPartitionSubpart                                          = 1513
	ErrAddPartitionNoNewPartition                                   = 1514
	ErrCoalescePartitionNoPartition                                 = 1515
	ErrReorgPartitionNotExist                                       = 1516
	ErrSameNamePartition                                            = 1517
	ErrNoBinlog                                                     = 1518
	ErrConsecutiveReorgPartitions                                   = 1519
	ErrReorgOutsideRange                                            = 1520
	ErrPartitionFunctionFailure                                     = 1521
	ErrPartState                                                    = 1522
	ErrLimitedPartRange                                             = 1523
	ErrPluginIsNotLoaded                                            = 1524
	ErrWrongValue                                                   = 1525
	ErrNoPartitionForGivenValue                                     = 1526
	ErrFilegroupOptionOnlyOnce                                      = 1527
	ErrCreateFilegroupFailed                                        = 1528
	ErrDropFilegroupFailed                                          = 1529
	ErrTablespaceAutoExtend                                         = 1530
	ErrWrongSizeNumber                                              = 1531
	ErrSizeOverflow                                                 = 1532
	ErrAlterFilegroupFailed                                         = 1533
	ErrBinlogRowLoggingFailed                                       = 1534
	ErrBinlogRowWrongTableDef                                       = 1535
	ErrBinlogRowRbrToSbr                                            = 1536
	ErrEventAlreadyExists                                           = 1537
	ErrEventStoreFailed                                             = 1538
	ErrEventDoesNotExist                                            = 1539
	ErrEventCantAlter                                               = 1540
	ErrEventDropFailed                                              = 1541
	ErrEventIntervalNotPositiveOrTooBig                             = 1542
	ErrEventEndsBeforeStarts                                        = 1543
	ErrEventExecTimeInThePast                                       = 1544
	ErrEventOpenTableFailed                                         = 1545
	ErrEventNeitherMExprNorMAt                                      = 1546
	ErrObsoleteColCountDoesntMatchCorrupted                         = 1547
	ErrObsoleteCannotLoadFromTable                                  = 1548
	ErrEventCannotDelete                                            = 1549
	ErrEventCompile                                                 = 1550
	ErrEventSameName                                                = 1551
	ErrEventDataTooLong                                             = 1552
	ErrDropIndexFk                                                  = 1553
	ErrWarnDeprecatedSyntaxWithVer                                  = 1554
	ErrCantWriteLockLogTable                                        = 1555
	ErrCantLockLogTable                                             = 1556
	ErrForeignDuplicateKeyOldUnused                                 = 1557
	ErrColCountDoesntMatchPleaseUpdate                              = 1558
	ErrTempTablePreventsSwitchOutOfRbr                              = 1559
	ErrStoredFunctionPreventsSwitchBinlogFormat                     = 1560
	ErrNdbCantSwitchBinlogFormat                                    = 1561
	ErrPartitionNoTemporary                                         = 1562
	ErrPartitionConstDomain                                         = 1563
	ErrPartitionFunctionIsNotAllowed                                = 1564
	ErrDdlLog                                                       = 1565
	ErrNullInValuesLessThan                                         = 1566
	ErrWrongPartitionName                                           = 1567
	ErrCantChangeTxCharacteristics                                  = 1568
	ErrDupEntryAutoincrementCase                                    = 1569
	ErrEventModifyQueue                                             = 1570
	ErrEventSetVar                                                  = 1571
	ErrPartitionMerge                                               = 1572
	ErrCantActivateLog                                              = 1573
	ErrRbrNotAvailable                                              = 1574
	ErrBase64Decode                                                 = 1575
	ErrEventRecursionForbidden                                      = 1576
	ErrEventsDB                                                     = 1577
	ErrOnlyIntegersAllowed                                          = 1578
	ErrUnsuportedLogEngine                                          = 1579
	ErrBadLogStatement                                              = 1580
	ErrCantRenameLogTable                                           = 1581
	ErrWrongParamcountToNativeFct                                   = 1582
	ErrWrongParametersToNativeFct                                   = 1583
	ErrWrongParametersToStoredFct                                   = 1584
	ErrNativeFctNameCollision                                       = 1585
	ErrDupEntryWithKeyName                                          = 1586
	ErrBinlogPurgeEmFile                                            = 1587
	ErrEventCannotCreateInThePast                                   = 1588
	ErrEventCannotAlterInThePast                                    = 1589
	ErrSlaveIncident                                                = 1590
	ErrNoPartitionForGivenValueSilent                               = 1591
	ErrBinlogUnsafeStatement                                        = 1592
	ErrSlaveFatal                                                   = 1593
	ErrSlaveRelayLogReadFailure                                     = 1594
	ErrSlaveRelayLogWriteFailure                                    = 1595
	ErrSlaveCreateEventFailure                                      = 1596
	ErrSlaveMasterComFailure                                        = 1597
	ErrBinlogLoggingImpossible                                      = 1598
	ErrViewNoCreationCtx                                            = 1599
	ErrViewInvalidCreationCtx                                       = 1600
	ErrSrInvalidCreationCtx                                         = 1601
	ErrTrgCorruptedFile                                             = 1602
	ErrTrgNoCreationCtx                                             = 1603
	ErrTrgInvalidCreationCtx                                        = 1604
	ErrEventInvalidCreationCtx                                      = 1605
	ErrTrgCantOpenTable                                             = 1606
	ErrCantCreateSroutine                                           = 1607
	ErrNeverUsed                                                    = 1608
	ErrNoFormatDescriptionEventBeforeBinlogStatement                = 1609
	ErrSlaveCorruptEvent                                            = 1610
	ErrLoadDataInvalidColumn                                        = 1611
	ErrLogPurgeNoFile                                               = 1612
	ErrXaRbtimeout                                                  = 1613
	ErrXaRbdeadlock                                                 = 1614
	ErrNeedReprepare                                                = 1615
	ErrDelayedNotSupported                                          = 1616
	WarnNoMasterInfo                                                = 1617
	WarnOptionIgnored                                               = 1618
	WarnPluginDeleteBuiltin                                         = 1619
	WarnPluginBusy                                                  = 1620
	ErrVariableIsReadonly                                           = 1621
	ErrWarnEngineTransactionRollback                                = 1622
	ErrSlaveHeartbeatFailure                                        = 1623
	ErrSlaveHeartbeatValueOutOfRange                                = 1624
	ErrNdbReplicationSchema                                         = 1625
	ErrConflictFnParse                                              = 1626
	ErrExceptionsWrite                                              = 1627
	ErrTooLongTableComment                                          = 1628
	ErrTooLongFieldComment                                          = 1629
	ErrFuncInexistentNameCollision                                  = 1630
	ErrDatabaseName                                                 = 1631
	ErrTableName                                                    = 1632
	ErrPartitionName                                                = 1633
	ErrSubpartitionName                                             = 1634
	ErrTemporaryName                                                = 1635
	ErrRenamedName                                                  = 1636
	ErrTooManyConcurrentTrxs                                        = 1637
	WarnNonASCIISeparatorNotImplemented                             = 1638
	ErrDebugSyncTimeout                                             = 1639
	ErrDebugSyncHitLimit                                            = 1640
	ErrDupSignalSet                                                 = 1641
	ErrSignalWarn                                                   = 1642
	ErrSignalNotFound                                               = 1643
	ErrSignalException                                              = 1644
	ErrResignalWithoutActiveHandler                                 = 1645
	ErrSignalBadConditionType                                       = 1646
	WarnCondItemTruncated                                           = 1647
	ErrCondItemTooLong                                              = 1648
	ErrUnknownLocale                                                = 1649
	ErrSlaveIgnoreServerIds                                         = 1650
	ErrQueryCacheDisabled                                           = 1651
	ErrSameNamePartitionField                                       = 1652
	ErrPartitionColumnList                                          = 1653
	ErrWrongTypeColumnValue                                         = 1654
	ErrTooManyPartitionFuncFields                                   = 1655
	ErrMaxvalueInValuesIn                                           = 1656
	ErrTooManyValues                                                = 1657
	ErrRowSinglePartitionField                                      = 1658
	ErrFieldTypeNotAllowedAsPartitionField                          = 1659
	ErrPartitionFieldsTooLong                                       = 1660
	ErrBinlogRowEngineAndStmtEngine                                 = 1661
	ErrBinlogRowModeAndStmtEngine                                   = 1662
	ErrBinlogUnsafeAndStmtEngine                                    = 1663
	ErrBinlogRowInjectionAndStmtEngine                              = 1664
	ErrBinlogStmtModeAndRowEngine                                   = 1665
	ErrBinlogRowInjectionAndStmtMode                                = 1666
	ErrBinlogMultipleEnginesAndSelfLoggingEngine                    = 1667
	ErrBinlogUnsafeLimit                                            = 1668
	ErrBinlogUnsafeInsertDelayed                                    = 1669
	ErrBinlogUnsafeSystemTable                                      = 1670
	ErrBinlogUnsafeAutoincColumns                                   = 1671
	ErrBinlogUnsafeUdf                                              = 1672
	ErrBinlogUnsafeSystemVariable                                   = 1673
	ErrBinlogUnsafeSystemFunction                                   = 1674
	ErrBinlogUnsafeNontransAfterTrans                               = 1675
	ErrMessageAndStatement                                          = 1676
	ErrSlaveConversionFailed                                        = 1677
	ErrSlaveCantCreateConversion                                    = 1678
	ErrInsideTransactionPreventsSwitchBinlogFormat                  = 1679
	ErrPathLength                                                   = 1680
	ErrWarnDeprecatedSyntaxNoReplacement                            = 1681
	ErrWrongNativeTableStructure                                    = 1682
	ErrWrongPerfSchemaUsage                                         = 1683
	ErrWarnISSkippedTable                                           = 1684
	ErrInsideTransactionPreventsSwitchBinlogDirect                  = 1685
	ErrStoredFunctionPreventsSwitchBinlogDirect                     = 1686
	ErrSpatialMustHaveGeomCol                                       = 1687
	ErrTooLongIndexComment                                          = 1688
	ErrLockAborted                                                  = 1689
	ErrDataOutOfRange                                               = 1690
	ErrWrongSpvarTypeInLimit                                        = 1691
	ErrBinlogUnsafeMultipleEnginesAndSelfLoggingEngine              = 1692
	ErrBinlogUnsafeMixedStatement                                   = 1693
	ErrInsideTransactionPreventsSwitchSQLLogBin                     = 1694
	ErrStoredFunctionPreventsSwitchSQLLogBin                        = 1695
	ErrFailedReadFromParFile                                        = 1696
	ErrValuesIsNotIntType                                           = 1697
	ErrAccessDeniedNoPassword                                       = 1698
	ErrSetPasswordAuthPlugin                                        = 1699
	ErrGrantPluginUserExists                                        = 1700
	ErrTruncateIllegalFk                                            = 1701
	ErrPluginIsPermanent                                            = 1702
	ErrSlaveHeartbeatValueOutOfRangeMin                             = 1703
	ErrSlaveHeartbeatValueOutOfRangeMax                             = 1704
	ErrStmtCacheFull                                                = 1705
	ErrMultiUpdateKeyConflict                                       = 1706
	ErrTableNeedsRebuild                                            = 1707
	WarnOptionBelowLimit                                            = 1708
	ErrIndexColumnTooLong                                           = 1709
	ErrErrorInTriggerBody                                           = 1710
	ErrErrorInUnknownTriggerBody                                    = 1711
	ErrIndexCorrupt                                                 = 1712
	ErrUndoRecordTooBig                                             = 1713
	ErrBinlogUnsafeInsertIgnoreSelect                               = 1714
	ErrBinlogUnsafeInsertSelectUpdate                               = 1715
	ErrBinlogUnsafeReplaceSelect                                    = 1716
	ErrBinlogUnsafeCreateIgnoreSelect                               = 1717
	ErrBinlogUnsafeCreateReplaceSelect                              = 1718
	ErrBinlogUnsafeUpdateIgnore                                     = 1719
	ErrPluginNoUninstall                                            = 1720
	ErrPluginNoInstall                                              = 1721
	ErrBinlogUnsafeWriteAutoincSelect                               = 1722
	ErrBinlogUnsafeCreateSelectAutoinc                              = 1723
	ErrBinlogUnsafeInsertTwoKeys                                    = 1724
	ErrTableInFkCheck                                               = 1725
	ErrUnsupportedEngine                                            = 1726
	ErrBinlogUnsafeAutoincNotFirst                                  = 1727
	ErrCannotLoadFromTableV2                                        = 1728
	ErrMasterDelayValueOutOfRange                                   = 1729
	ErrOnlyFdAndRbrEventsAllowedInBinlogStatement                   = 1730
	ErrPartitionExchangeDifferentOption                             = 1731
	ErrPartitionExchangePartTable                                   = 1732
	ErrPartitionExchangeTempTable                                   = 1733
	ErrPartitionInsteadOfSubpartition                               = 1734
	ErrUnknownPartition                                             = 1735
	ErrTablesDifferentMetadata                                      = 1736
	ErrRowDoesNotMatchPartition                                     = 1737
	ErrBinlogCacheSizeGreaterThanMax                                = 1738
	ErrWarnIndexNotApplicable                                       = 1739
	ErrPartitionExchangeForeignKey                                  = 1740
	ErrNoSuchKeyValue                                               = 1741
	ErrRplInfoDataTooLong                                           = 1742
	ErrNetworkReadEventChecksumFailure                              = 1743
	ErrBinlogReadEventChecksumFailure                               = 1744
	ErrBinlogStmtCacheSizeGreaterThanMax                            = 1745
	ErrCantUpdateTableInCreateTableSelect                           = 1746
	ErrPartitionClauseOnNonpartitioned                              = 1747
	ErrRowDoesNotMatchGivenPartitionSet                             = 1748
	ErrNoSuchPartitionunused                                        = 1749
	ErrChangeRplInfoRepositoryFailure                               = 1750
	ErrWarningNotCompleteRollbackWithCreatedTempTable               = 1751
	ErrWarningNotCompleteRollbackWithDroppedTempTable               = 1752
	ErrMtsFeatureIsNotSupported                                     = 1753
	ErrMtsUpdatedDBsGreaterMax                                      = 1754
	ErrMtsCantParallel                                              = 1755
	ErrMtsInconsistentData                                          = 1756
	ErrFulltextNotSupportedWithPartitioning                         = 1757
	ErrDaInvalidConditionNumber                                     = 1758
	ErrInsecurePlainText                                            = 1759
	ErrInsecureChangeMaster                                         = 1760
	ErrForeignDuplicateKeyWithChildInfo                             = 1761
	ErrForeignDuplicateKeyWithoutChildInfo                          = 1762
	ErrSQLthreadWithSecureSlave                                     = 1763
	ErrTableHasNoFt                                                 = 1764
	ErrVariableNotSettableInSfOrTrigger                             = 1765
	ErrVariableNotSettableInTransaction                             = 1766
	ErrGtidNextIsNotInGtidNextList                                  = 1767
	ErrCantChangeGtidNextInTransactionWhenGtidNextListIsNull        = 1768
	ErrSetStatementCannotInvokeFunction                             = 1769
	ErrGtidNextCantBeAutomaticIfGtidNextListIsNonNull               = 1770
	ErrSkippingLoggedTransaction                                    = 1771
	ErrMalformedGtidSetSpecification                                = 1772
	ErrMalformedGtidSetEncoding                                     = 1773
	ErrMalformedGtidSpecification                                   = 1774
	ErrGnoExhausted                                                 = 1775
	ErrBadSlaveAutoPosition                                         = 1776
	ErrAutoPositionRequiresGtidModeOn                               = 1777
	ErrCantDoImplicitCommitInTrxWhenGtidNextIsSet                   = 1778
	ErrGtidMode2Or3RequiresEnforceGtidConsistencyOn                 = 1779
	ErrGtidModeRequiresBinlog                                       = 1780
	ErrCantSetGtidNextToGtidWhenGtidModeIsOff                       = 1781
	ErrCantSetGtidNextToAnonymousWhenGtidModeIsOn                   = 1782
	ErrCantSetGtidNextListToNonNullWhenGtidModeIsOff                = 1783
	ErrFoundGtidEventWhenGtidModeIsOff                              = 1784
	ErrGtidUnsafeNonTransactionalTable                              = 1785
	ErrGtidUnsafeCreateSelect                                       = 1786
	ErrGtidUnsafeCreateDropTemporaryTableInTransaction              = 1787
	ErrGtidModeCanOnlyChangeOneStepAtATime                          = 1788
	ErrMasterHasPurgedRequiredGtids                                 = 1789
	ErrCantSetGtidNextWhenOwningGtid                                = 1790
	ErrUnknownExplainFormat                                         = 1791
	ErrCantExecuteInReadOnlyTransaction                             = 1792
	ErrTooLongTablePartitionComment                                 = 1793
	ErrSlaveConfiguration                                           = 1794
	ErrInnodbFtLimit                                                = 1795
	ErrInnodbNoFtTempTable                                          = 1796
	ErrInnodbFtWrongDocidColumn                                     = 1797
	ErrInnodbFtWrongDocidIndex                                      = 1798
	ErrInnodbOnlineLogTooBig                                        = 1799
	ErrUnknownAlterAlgorithm                                        = 1800
	ErrUnknownAlterLock                                             = 1801
	ErrMtsChangeMasterCantRunWithGaps                               = 1802
	ErrMtsRecoveryFailure                                           = 1803
	ErrMtsResetWorkers                                              = 1804
	ErrColCountDoesntMatchCorruptedV2                               = 1805
	ErrSlaveSilentRetryTransaction                                  = 1806
	ErrDiscardFkChecksRunning                                       = 1807
	ErrTableSchemaMismatch                                          = 1808
	ErrTableInSystemTablespace                                      = 1809
	ErrIoRead                                                       = 1810
	ErrIoWrite                                                      = 1811
	ErrTablespaceMissing                                            = 1812
	ErrTablespaceExists                                             = 1813
	ErrTablespaceDiscarded                                          = 1814
	ErrInternal                                                     = 1815
	ErrInnodbImport                                                 = 1816
	ErrInnodbIndexCorrupt                                           = 1817
	ErrInvalidYearColumnLength                                      = 1818
	ErrNotValidPassword                                             = 1819
	ErrMustChangePassword                                           = 1820
	ErrFkNoIndexChild                                               = 1821
	ErrFkNoIndexParent                                              = 1822
	ErrFkFailAddSystem                                              = 1823
	ErrFkCannotOpenParent                                           = 1824
	ErrFkIncorrectOption                                            = 1825
	ErrFkDupName                                                    = 1826
	ErrPasswordFormat                                               = 1827
	ErrFkColumnCannotDrop                                           = 1828
	ErrFkColumnCannotDropChild                                      = 1829
	ErrFkColumnNotNull                                              = 1830
	ErrDupIndex                                                     = 1831
	ErrFkColumnCannotChange                                         = 1832
	ErrFkColumnCannotChangeChild                                    = 1833
	ErrFkCannotDeleteParent                                         = 1834
	ErrMalformedPacket                                              = 1835
	ErrReadOnlyMode                                                 = 1836
	ErrGtidNextTypeUndefinedGroup                                   = 1837
	ErrVariableNotSettableInSp                                      = 1838
	ErrCantSetGtidPurgedWhenGtidModeIsOff                           = 1839
	ErrCantSetGtidPurgedWhenGtidExecutedIsNotEmpty                  = 1840
	ErrCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty                    = 1841
	ErrGtidPurgedWasChanged                                         = 1842
	ErrGtidExecutedWasChanged                                       = 1843
	ErrBinlogStmtModeAndNoReplTables                                = 1844
	ErrAlterOperationNotSupported                                   = 1845
	ErrAlterOperationNotSupportedReason                             = 1846
	ErrAlterOperationNotSupportedReasonCopy                         = 1847
	ErrAlterOperationNotSupportedReasonPartition                    = 1848
	ErrAlterOperationNotSupportedReasonFkRename                     = 1849
	ErrAlterOperationNotSupportedReasonColumnType                   = 1850
	ErrAlterOperationNotSupportedReasonFkCheck                      = 1851
	ErrAlterOperationNotSupportedReasonIgnore                       = 1852
	ErrAlterOperationNotSupportedReasonNopk                         = 1853
	ErrAlterOperationNotSupportedReasonAutoinc                      = 1854
	ErrAlterOperationNotSupportedReasonHiddenFts                    = 1855
	ErrAlterOperationNotSupportedReasonChangeFts                    = 1856
	ErrAlterOperationNotSupportedReasonFts                          = 1857
	ErrSQLSlaveSkipCounterNotSettableInGtidMode                     = 1858
	ErrDupUnknownInIndex                                            = 1859
	ErrIdentCausesTooLongPath                                       = 1860
	ErrAlterOperationNotSupportedReasonNotNull                      = 1861
	ErrMustChangePasswordLogin                                      = 1862
	ErrRowInWrongPartition                                          = 1863
	ErrErrorLast                                                    = 1863
	ErrGeneratedColumnFunctionIsNotAllowed                          = 3102
	ErrBadGeneratedColumn                                           = 3105
	ErrUnsupportedOnGeneratedColumn                                 = 3106
	ErrGeneratedColumnNonPrior                                      = 3107
	ErrDependentByGeneratedColumn                                   = 3108
	ErrGeneratedColumnRefAutoInc                                    = 3109
	ErrInvalidJSONText                                              = 3140
	ErrInvalidJSONPath                                              = 3143
	ErrInvalidJSONData                                              = 3146
	ErrInvalidJSONPathWildcard                                      = 3149
	ErrInvalidJSONContainsPathType                                  = 3150
	ErrJSONUsedAsKey                                                = 3152
	ErrWindowNoSuchWindow                                           = 3579
	ErrWindowCircularityInWindowGraph                               = 3580
	ErrWindowNoChildPartitioning                                    = 3581
	ErrWindowNoInherentFrame                                        = 3582
	ErrWindowNoRedefineOrderBy                                      = 3583
	ErrWindowFrameStartIllegal                                      = 3584
	ErrWindowFrameEndIllegal                                        = 3585
	ErrWindowFrameIllegal                                           = 3586
	ErrWindowRangeFrameOrderType                                    = 3587
	ErrWindowRangeFrameTemporalType                                 = 3588
	ErrWindowRangeFrameNumericType                                  = 3589
	ErrWindowRangeBoundNotConstant                                  = 3590
	ErrWindowDuplicateName                                          = 3591
	ErrWindowIllegalOrderBy                                         = 3592
	ErrWindowInvalidWindowFuncUse                                   = 3593
	ErrWindowInvalidWindowFuncAliasUse                              = 3594
	ErrWindowNestedWindowFuncUseInWindowSpec                        = 3595
	ErrWindowRowsIntervalUse                                        = 3596
	ErrWindowNoGroupOrderUnused                                     = 3597
	ErrWindowExplainJSON                                            = 3598
	ErrWindowFunctionIgnoresFrame                                   = 3599
)

MySQL error code. This value is numeric. It is not portable to other database systems.

View Source
const (
	// SortAsc asc
	SortAsc = "asc"
	// SortDesc desc
	SortDesc = "desc"
)
View Source
const (
	TypeDecimal   byte = 0
	TypeTiny      byte = 1
	TypeShort     byte = 2
	TypeLong      byte = 3
	TypeFloat     byte = 4
	TypeDouble    byte = 5
	TypeNull      byte = 6
	TypeTimestamp byte = 7
	TypeLonglong  byte = 8
	TypeInt24     byte = 9
	TypeDate      byte = 10
	/* TypeDuration original name was TypeTime, renamed to TypeDuration to resolve the conflict with Go type Time.*/
	TypeDuration byte = 11
	TypeDatetime byte = 12
	TypeYear     byte = 13
	TypeNewDate  byte = 14
	TypeVarchar  byte = 15
	TypeBit      byte = 16

	TypeJSON       byte = 0xf5
	TypeNewDecimal byte = 0xf6
	TypeEnum       byte = 0xf7
	TypeSet        byte = 0xf8
	TypeTinyBlob   byte = 0xf9
	TypeMediumBlob byte = 0xfa
	TypeLongBlob   byte = 0xfb
	TypeBlob       byte = 0xfc
	TypeVarString  byte = 0xfd
	TypeString     byte = 0xfe
	TypeGeometry   byte = 0xff
)

MySQL type information.

View Source
const (
	NotNullFlag        uint = 1 << 0  /* Field can't be NULL */
	PriKeyFlag         uint = 1 << 1  /* Field is part of a primary key */
	UniqueKeyFlag      uint = 1 << 2  /* Field is part of a unique key */
	MultipleKeyFlag    uint = 1 << 3  /* Field is part of a key */
	BlobFlag           uint = 1 << 4  /* Field is a blob */
	UnsignedFlag       uint = 1 << 5  /* Field is unsigned */
	ZerofillFlag       uint = 1 << 6  /* Field is zerofill */
	BinaryFlag         uint = 1 << 7  /* Field is binary   */
	EnumFlag           uint = 1 << 8  /* Field is an enum */
	AutoIncrementFlag  uint = 1 << 9  /* Field is an auto increment field */
	TimestampFlag      uint = 1 << 10 /* Field is a timestamp */
	SetFlag            uint = 1 << 11 /* Field is a set */
	NoDefaultValueFlag uint = 1 << 12 /* Field doesn't have a default value */
	OnUpdateNowFlag    uint = 1 << 13 /* Field is set to NOW on UPDATE */
	PartKeyFlag        uint = 1 << 14 /* Intern: Part of some keys */
	NumFlag            uint = 1 << 15 /* Field is a num (for clients) */

	GroupFlag             uint = 1 << 15 /* Internal: Group field */
	UniqueFlag            uint = 1 << 16 /* Internal: Used by sql_yacc */
	BinCmpFlag            uint = 1 << 17 /* Internal: Used by sql_yacc */
	ParseToJSONFlag       uint = 1 << 18 /* Internal: Used when we want to parse string to JSON in CAST */
	IsBooleanFlag         uint = 1 << 19 /* Internal: Used for telling boolean literal from integer */
	PreventNullInsertFlag uint = 1 << 20 /* Prevent this Field from inserting NULL values */
)

Flag information.

View Source
const (
	MaxUint24 = 1<<24 - 1
	MaxInt24  = 1<<23 - 1
	MinInt24  = -1 << 23
)

TypeInt24 bounds.

View Source
const (
	SQLModeStr     = "sql_mode"
	SQLSafeUpdates = "sql_safe_updates"
	TimeZone       = "time_zone"
)

allowed session variables

View Source
const AllPrivMask = AllPriv - 1

AllPrivMask is the mask for PrivilegeType with all bits set to 1. If it's passed to RequestVerification, it means any privilege would be OK.

View Source
const (
	// CursorTypeReadOnly readonly cursor
	CursorTypeReadOnly = 0x01
)
View Source
const (
	// DefaultMySQLState is default state of the mySQL
	DefaultMySQLState = "HY000"
)
View Source
const ErrTextLength = 80

ErrTextLength error text length limit.

View Source
const (
	MaxAllowedPacket = "max_allowed_packet"
)

not allowed session variables

View Source
const (

	// MaxPacketSize is the maximum payload length of a packet(16MB)
	// the server supports.
	MaxPacketSize = (1 << 24) - 1
)
View Source
const TypeUnspecified = TypeDecimal

TypeUnspecified is an uninitialized type. TypeDecimal is not used in MySQL.

Variables

View Source
var (
	// ErrBadConn bad connection error
	ErrBadConn = errors.New("connection was bad")
	// ErrMalformPacket packet error
	ErrMalformPacket = errors.New("Malform packet error")
	// ErrTxDone transaction done error
	ErrTxDone = errors.New("sql: Transaction has already been committed or rolled back")
)
View Source
var CharsetIds = map[string]CollationID{
	"big5":     1,
	"dec8":     3,
	"cp850":    4,
	"hp8":      6,
	"koi8r":    7,
	"latin1":   8,
	"latin2":   9,
	"swe7":     10,
	"ascii":    11,
	"ujis":     12,
	"sjis":     13,
	"hebrew":   16,
	"tis620":   18,
	"euckr":    19,
	"koi8u":    22,
	"gb2312":   24,
	"greek":    25,
	"cp1250":   26,
	"gbk":      28,
	"latin5":   30,
	"armscii8": 32,
	"utf8":     33,
	"ucs2":     35,
	"cp866":    36,
	"keybcs2":  37,
	"macce":    38,
	"macroman": 39,
	"cp852":    40,
	"latin7":   41,
	"utf8mb4":  45,
	"cp1251":   51,
	"utf16":    54,
	"utf16le":  56,
	"cp1256":   57,
	"cp1257":   59,
	"utf32":    60,
	"binary":   63,
	"geostd8":  92,
	"cp932":    95,
	"eucjpms":  97,
}

CharsetIds maps charset name to its default collation ID.

View Source
var Charsets = map[string]string{
	"big5":     "big5_chinese_ci",
	"dec8":     "dec8_swedish_ci",
	"cp850":    "cp850_general_ci",
	"hp8":      "hp8_english_ci",
	"koi8r":    "koi8r_general_ci",
	"latin1":   "latin1_swedish_ci",
	"latin2":   "latin2_general_ci",
	"swe7":     "swe7_swedish_ci",
	"ascii":    "ascii_general_ci",
	"ujis":     "ujis_japanese_ci",
	"sjis":     "sjis_japanese_ci",
	"hebrew":   "hebrew_general_ci",
	"tis620":   "tis620_thai_ci",
	"euckr":    "euckr_korean_ci",
	"koi8u":    "koi8u_general_ci",
	"gb2312":   "gb2312_chinese_ci",
	"greek":    "greek_general_ci",
	"cp1250":   "cp1250_general_ci",
	"gbk":      "gbk_chinese_ci",
	"latin5":   "latin5_turkish_ci",
	"armscii8": "armscii8_general_ci",
	"utf8":     "utf8_general_ci",
	"ucs2":     "ucs2_general_ci",
	"cp866":    "cp866_general_ci",
	"keybcs2":  "keybcs2_general_ci",
	"macce":    "macce_general_ci",
	"macroman": "macroman_general_ci",
	"cp852":    "cp852_general_ci",
	"latin7":   "latin7_general_ci",
	"utf8mb4":  "utf8mb4_general_ci",
	"cp1251":   "cp1251_general_ci",
	"utf16":    "utf16_general_ci",
	"utf16le":  "utf16le_general_ci",
	"cp1256":   "cp1256_general_ci",
	"cp1257":   "cp1257_general_ci",
	"utf32":    "utf32_general_ci",
	"binary":   "binary",
	"geostd8":  "geostd8_general_ci",
	"cp932":    "cp932_japanese_ci",
	"eucjpms":  "eucjpms_japanese_ci",
}

Charsets maps charset name to its default collation name.

View Source
var CollationNameToCharset = map[string]string{}/* 219 elements not displayed */

CollationNameToCharset collation name to charset

View Source
var CollationNames = map[string]CollationID{}/* 219 elements not displayed */

CollationNames maps MySQL default collation name to its ID

View Source
var Collations = map[CollationID]string{}/* 219 elements not displayed */

Collations maps MySQL default collation ID to its name.

View Source
var Debug = false

Debug prints very verbose tracing information to STDOUT.

View Source
var MySQLErrName = map[uint16]string{}/* 896 elements not displayed */

MySQLErrName maps error code to MySQL error messages.

View Source
var MySQLState = map[uint16]string{}/* 234 elements not displayed */

MySQLState maps error code to MySQL SQLSTATE value. The values are taken from ANSI SQL and ODBC and are more standardized.

View Source
var Priority2Str = map[PriorityEnum]string{
	NoPriority:      "NO_PRIORITY",
	LowPriority:     "LOW_PRIORITY",
	HighPriority:    "HIGH_PRIORITY",
	DelayedPriority: "DELAYED",
}

Priority2Str is used to convert the statement priority to string.

View Source
var ReplaceNumbersInWords = false

ReplaceNumbersInWords enables replacing numbers in words. For example: `SELECT c FROM org235.t` -> `SELECT c FROM org?.t`. For more examples look at test query_test.go/TestFingerprintWithNumberInDbName.

View Source
var SQLModeSet = map[string]bool{

	"ALLOW_INVALID_DATES":        true,
	"ANSI_QUOTES":                true,
	"ERROR_FOR_DIVISION_BY_ZERO": true,
	"HIGH_NOT_PRECEDENCE":        true,
	"IGNORE_SPACE":               true,
	"NO_AUTO_CREATE_USER":        true,
	"NO_AUTO_VALUE_ON_ZERO":      true,
	"NO_BACKSLASH_ESCAPES":       true,
	"NO_DIR_IN_CREATE":           true,
	"NO_ENGINE_SUBSTITUTION":     true,
	"NO_FIELD_OPTIONS":           true,
	"NO_KEY_OPTIONS":             true,
	"NO_TABLE_OPTIONS":           true,
	"NO_UNSIGNED_SUBTRACTION":    true,
	"NO_ZERO_DATE":               true,
	"NO_ZERO_IN_DATE":            true,
	"ONLY_FULL_GROUP_BY":         true,
	"PAD_CHAR_TO_FULL_LENGTH":    true,
	"PIPES_AS_CONCAT":            true,
	"REAL_AS_FLOAT":              true,
	"STRICT_ALL_TABLES":          true,
	"STRICT_TRANS_TABLES":        true,

	"ANSI":        true,
	"DB2":         true,
	"MAXDB":       true,
	"MSSQL":       true,
	"MYSQL323":    true,
	"MYSQL40":     true,
	"ORACLE":      true,
	"POSTGRESQL":  true,
	"TRADITIONAL": true,
}

SQLModeSet https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

View Source
var Str2SQLMode = map[string]SQLMode{
	"REAL_AS_FLOAT":              ModeRealAsFloat,
	"PIPES_AS_CONCAT":            ModePipesAsConcat,
	"ANSI_QUOTES":                ModeANSIQuotes,
	"IGNORE_SPACE":               ModeIgnoreSpace,
	"NOT_USED":                   ModeNotUsed,
	"ONLY_FULL_GROUP_BY":         ModeOnlyFullGroupBy,
	"NO_UNSIGNED_SUBTRACTION":    ModeNoUnsignedSubtraction,
	"NO_DIR_IN_CREATE":           ModeNoDirInCreate,
	"POSTGRESQL":                 ModePostgreSQL,
	"ORACLE":                     ModeOracle,
	"MSSQL":                      ModeMsSQL,
	"DB2":                        ModeDb2,
	"MAXDB":                      ModeMaxdb,
	"NO_KEY_OPTIONS":             ModeNoKeyOptions,
	"NO_TABLE_OPTIONS":           ModeNoTableOptions,
	"NO_FIELD_OPTIONS":           ModeNoFieldOptions,
	"MYSQL323":                   ModeMySQL323,
	"MYSQL40":                    ModeMySQL40,
	"ANSI":                       ModeANSI,
	"NO_AUTO_VALUE_ON_ZERO":      ModeNoAutoValueOnZero,
	"NO_BACKSLASH_ESCAPES":       ModeNoBackslashEscapes,
	"STRICT_TRANS_TABLES":        ModeStrictTransTables,
	"STRICT_ALL_TABLES":          ModeStrictAllTables,
	"NO_ZERO_IN_DATE":            ModeNoZeroInDate,
	"NO_ZERO_DATE":               ModeNoZeroDate,
	"INVALID_DATES":              ModeInvalidDates,
	"ERROR_FOR_DIVISION_BY_ZERO": ModeErrorForDivisionByZero,
	"TRADITIONAL":                ModeTraditional,
	"NO_AUTO_CREATE_USER":        ModeNoAutoCreateUser,
	"HIGH_NOT_PRECEDENCE":        ModeHighNotPrecedence,
	"NO_ENGINE_SUBSTITUTION":     ModeNoEngineSubstitution,
	"PAD_CHAR_TO_FULL_LENGTH":    ModePadCharToFullLength,
	"ALLOW_INVALID_DATES":        ModeAllowInvalidDates,
}

Str2SQLMode is the string represent of sql_mode to sql_mode map.

Functions

func AppendBinaryValue

func AppendBinaryValue(data []byte, fieldType uint8, value interface{}) ([]byte, error)

AppendBinaryValue encode binary-type value of prepare binary protocol according to type of value

func AppendLenEncInt

func AppendLenEncInt(data []byte, i uint64) []byte

AppendLenEncInt append LenEncInt []byte to data

func AppendLenEncStringBytes

func AppendLenEncStringBytes(data, b []byte) []byte

AppendLenEncStringBytes append bytes of len enc string to data

func AppendUint16

func AppendUint16(data []byte, n uint16) []byte

AppendUint16 append uint16 to []byte

func AppendUint32

func AppendUint32(data []byte, n uint32) []byte

AppendUint32 append uint32 to []byte

func AppendUint64

func AppendUint64(data []byte, n uint64) []byte

AppendUint64 append uint64 to []byte

func CalcPassword

func CalcPassword(scramble, password []byte) []byte

CalcPassword calculate password hash

func Escape

func Escape(sql string) string

Escape remove exceptional character

func FieldType

func FieldType(value interface{}) (typ uint8, err error)

FieldType return type of field

func FormatBinaryDate

func FormatBinaryDate(n int, data []byte) ([]byte, error)

FormatBinaryDate format binary date type

func FormatBinaryDateTime

func FormatBinaryDateTime(n int, data []byte) ([]byte, error)

FormatBinaryDateTime format binary datetime type

func FormatBinaryTime

func FormatBinaryTime(n int, data []byte) ([]byte, error)

FormatBinaryTime format binary time type

func GetCharsetInfo

func GetCharsetInfo(cs string) (string, string, error)

GetCharsetInfo returns charset and collation for cs as name.

func GetDefaultCharsetAndCollate

func GetDefaultCharsetAndCollate() (string, string)

GetDefaultCharsetAndCollate returns the default charset and collation.

func GetDefaultCollation

func GetDefaultCollation(charset string) (string, error)

GetDefaultCollation returns the default collation for charset.

func GetDefaultFieldLengthAndDecimal

func GetDefaultFieldLengthAndDecimal(tp byte) (flen int, decimal int)

GetDefaultFieldLengthAndDecimal returns the default display length (flen) and decimal length for column. Call this when no Flen assigned in ddl. or column value is calculated from an expression. For example: "select count(*) from t;", the column type is int64 and Flen in ResultField will be 21. See https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html

func GetDefaultFieldLengthAndDecimalForCast

func GetDefaultFieldLengthAndDecimalForCast(tp byte) (flen int, decimal int)

GetDefaultFieldLengthAndDecimalForCast returns the default display length (flen) and decimal length for casted column when flen or decimal is not specified.

func GetFingerprint

func GetFingerprint(q string) string

GetFingerprint returns the canonical form of q. The primary transformations are:

  • Replace values with ?
  • Collapse whitespace
  • Remove comments
  • Lowercase everything

Additional trasnformations are performed which change the syntax of the original query without affecting its performance characteristics. For example, "ORDER BY col ASC" is the same as "ORDER BY col", so "ASC" in the fingerprint is removed.

func GetFingerprintOperation

func GetFingerprintOperation(fingerprint string) string

GetFingerprintOperation return fingerprint's operation

func GetMd5

func GetMd5(fingerPrint string) string

GetMd5 returns the MD5 checksum of fingerprint.

func HasAutoIncrementFlag

func HasAutoIncrementFlag(flag uint) bool

HasAutoIncrementFlag checks if AutoIncrementFlag is set.

func HasBinaryFlag

func HasBinaryFlag(flag uint) bool

HasBinaryFlag checks if BinaryFlag is set.

func HasIsBooleanFlag

func HasIsBooleanFlag(flag uint) bool

HasIsBooleanFlag checks if IsBooleanFlag is set.

func HasMultipleKeyFlag

func HasMultipleKeyFlag(flag uint) bool

HasMultipleKeyFlag checks if MultipleKeyFlag is set.

func HasNoDefaultValueFlag

func HasNoDefaultValueFlag(flag uint) bool

HasNoDefaultValueFlag checks if NoDefaultValueFlag is set.

func HasNotNullFlag

func HasNotNullFlag(flag uint) bool

HasNotNullFlag checks if NotNullFlag is set.

func HasOnUpdateNowFlag

func HasOnUpdateNowFlag(flag uint) bool

HasOnUpdateNowFlag checks if OnUpdateNowFlag is set.

func HasParseToJSONFlag

func HasParseToJSONFlag(flag uint) bool

HasParseToJSONFlag checks if ParseToJSONFlag is set.

func HasPreventNullInsertFlag

func HasPreventNullInsertFlag(flag uint) bool

HasPreventNullInsertFlag checks if PreventNullInsertFlag is set.

func HasPriKeyFlag

func HasPriKeyFlag(flag uint) bool

HasPriKeyFlag checks if PriKeyFlag is set.

func HasTimestampFlag

func HasTimestampFlag(flag uint) bool

HasTimestampFlag checks if HasTimestampFlag is set.

func HasUniKeyFlag

func HasUniKeyFlag(flag uint) bool

HasUniKeyFlag checks if UniqueKeyFlag is set.

func HasUnsignedFlag

func HasUnsignedFlag(flag uint) bool

HasUnsignedFlag checks if UnsignedFlag is set.

func HasZerofillFlag

func HasZerofillFlag(flag uint) bool

HasZerofillFlag checks if ZerofillFlag is set.

func IsErrorPacket

func IsErrorPacket(data []byte) bool

IsErrorPacket determines whether or not the packet is an error packet. Mostly here for consistency with isEOFHeader

func IsIntegerType

func IsIntegerType(tp byte) bool

IsIntegerType indicate whether tp is an integer type.

func IsOKPacket

func IsOKPacket(data []byte) bool

IsOKPacket determines whether or not the packet is an ok packet.

func IsValidCharset

func IsValidCharset(charset string) bool

IsValidCharset check if is valid charset

func LenEncIntSize

func LenEncIntSize(i uint64) int

LenEncIntSize returns the number of bytes required to encode a variable-length integer.

func LenEncStringSize

func LenEncStringSize(value string) int

LenEncStringSize calculate length of lenenc_str https://dev.mysql.com/doc/internals/en/describing-packets.html#type-lenenc_str

func LenNullString

func LenNullString(value string) int

LenNullString return lenght Null terminated string

func ParseErrorPacket

func ParseErrorPacket(data []byte) error

ParseErrorPacket parses the error packet and returns a SQLError.

func RandomBuf

func RandomBuf(size int) ([]byte, error)

RandomBuf return random salt, seed must be in the range of ascii

func ReadByte

func ReadByte(data []byte, pos int) (byte, int, bool)

ReadByte read one byte from []byte

func ReadBytes

func ReadBytes(data []byte, pos int, size int) ([]byte, int, bool)

ReadBytes read []byte from pos with sized size

func ReadBytesCopy

func ReadBytesCopy(data []byte, pos int, size int) ([]byte, int, bool)

ReadBytesCopy returns a copy of the bytes in the packet. Useful to remember contents of ephemeral packets.

func ReadLenEncInt

func ReadLenEncInt(data []byte, pos int) (uint64, int, bool, bool)

ReadLenEncInt read info of len encoded int, return length, next pos(skip len self to data), is null, handle result https://dev.mysql.com/doc/internals/en/integer.html#packet-Protocol::FixedLengthInteger

func ReadLenEncStringAsBytes

func ReadLenEncStringAsBytes(data []byte, pos int) ([]byte, int, bool, bool)

ReadLenEncStringAsBytes read len encoded string, return []byte format, next pos, is null, handle result

func ReadNullString

func ReadNullString(data []byte, pos int) (string, int, bool)

ReadNullString read Null terminated string from []byte, return string,pos,if end.

func ReadUint16

func ReadUint16(data []byte, pos int) (uint16, int, bool)

ReadUint16 read uint32 from []byte

func ReadUint32

func ReadUint32(data []byte, pos int) (uint32, int, bool)

ReadUint32 read uint32 from []byte

func ReadUint64

func ReadUint64(data []byte, pos int) (uint64, int, bool)

ReadUint64 read uint64 from []byte

func ValidCharsetAndCollation

func ValidCharsetAndCollation(cs string, co string) bool

ValidCharsetAndCollation checks the charset and the collation validity and returns a boolean.

func VerifyCharset

func VerifyCharset(charset, collation string) error

VerifyCharset verify charset

func WriteByte

func WriteByte(data []byte, pos int, value byte) int

WriteByte write byte to []byte

func WriteLenEncInt

func WriteLenEncInt(data []byte, pos int, i uint64) int

WriteLenEncInt write uint64 to []byte

func WriteLenEncString

func WriteLenEncString(data []byte, pos int, value string) int

WriteLenEncString write string to []byte, return pos

func WriteNullString

func WriteNullString(data []byte, pos int, value string) int

WriteNullString write NULL terminated strign to []byte

func WriteUint16

func WriteUint16(data []byte, pos int, value uint16) int

WriteUint16 write uint16 to []byte

func WriteUint32

func WriteUint32(data []byte, pos int, value uint32) int

WriteUint32 write uint32 to []byte

func WriteUint64

func WriteUint64(data []byte, pos int, value uint64) int

WriteUint64 write uint64 to []byte

func WriteZeroes

func WriteZeroes(data []byte, pos int, len int) int

WriteZeroes write 0 to []byte

Types

type Charset

type Charset struct {
	Name             string
	DefaultCollation string
	Collations       map[string]*Collation
	Desc             string
	Maxlen           int
}

Charset is a charset. Now we only support MySQL.

type Collation

type Collation struct {
	ID          int
	CharsetName string
	Name        string
	IsDefault   bool
}

Collation is a collation. Now we only support MySQL.

func GetCollations

func GetCollations() []*Collation

GetCollations returns a list for all collations.

type CollationID

type CollationID uint8

CollationID means collation type

type Conn

type Conn struct {

	// ConnectionID is set:
	// - at Connect() time for clients, with the value returned by
	// the server.
	// - at accept time for the server.
	ConnectionID uint32
	// contains filtered or unexported fields
}

Conn is a connection between a client and a server, using the MySQL binary protocol. It is built on top of an existing net.Conn, that has already been established.

Use Connect on the client side to create a connection. Use NewListener to create a server side and listen for connections.

func NewConn

func NewConn(conn net.Conn) *Conn

NewConn is an internal method to create a Conn. Used by client and server side for common creation code.

func (*Conn) Close

func (c *Conn) Close()

Close closes the connection. It can be called from a different go routine to interrupt the current connection.

func (*Conn) Flush

func (c *Conn) Flush() error

Flush flushes the written data to the socket. This must be called to terminate startBuffering.

func (*Conn) GetConnectionID

func (c *Conn) GetConnectionID() uint32

GetConnectionID returns the MySQL connection ID for this connection.

func (*Conn) GetSequence

func (c *Conn) GetSequence() uint8

GetSequence return sequence of conn

func (*Conn) IsClosed

func (c *Conn) IsClosed() bool

IsClosed returns true if this connection was ever closed by the Close() method. Note if the other side closes the connection, but Close() wasn't called, this will return false.

func (*Conn) ReadEphemeralPacket

func (c *Conn) ReadEphemeralPacket() ([]byte, error)

ReadEphemeralPacket attempts to read a packet into buffer from sync.Pool. Do not use this method if the contents of the packet needs to be kept after the next ReadEphemeralPacket.

Note if the connection is closed already, an error will be returned, and it may not be io.EOF. If the connection closes while we are stuck waiting for data, an error will also be returned, and it most likely will be io.EOF.

func (*Conn) ReadEphemeralPacketDirect

func (c *Conn) ReadEphemeralPacketDirect() ([]byte, error)

ReadEphemeralPacketDirect attempts to read a packet from the socket directly. It needs to be used for the first handshake packet the server receives, so we do't buffer the SSL negotiation packet. As a shortcut, only packets smaller than MaxPacketSize can be read here. This function usually shouldn't be used - use ReadEphemeralPacket.

func (*Conn) ReadPacket

func (c *Conn) ReadPacket() ([]byte, error)

ReadPacket reads a packet from the underlying connection. it is the public API version, that returns a SQLError. The memory for the packet is always allocated, and it is owned by the caller after this function returns.

func (*Conn) RecycleReadPacket

func (c *Conn) RecycleReadPacket()

RecycleReadPacket recycles the read packet. It needs to be called after ReadEphemeralPacket was called.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr returns the underlying socket RemoteAddr().

func (*Conn) SetConnectionID

func (c *Conn) SetConnectionID(connectionID uint32)

SetConnectionID set connection id of conn.

func (*Conn) SetSequence

func (c *Conn) SetSequence(sequence uint8)

SetSequence set sequence of conn

func (*Conn) StartEphemeralPacket

func (c *Conn) StartEphemeralPacket(length int) []byte

StartEphemeralPacket get []byte from pool

func (*Conn) StartWriterBuffering

func (c *Conn) StartWriterBuffering()

StartWriterBuffering starts using buffered writes. This should be terminated by a call to flush.

func (*Conn) String

func (c *Conn) String() string

Ident returns a useful identification string for error logging

func (*Conn) WriteEOFPacket

func (c *Conn) WriteEOFPacket(flags uint16, warnings uint16) error

WriteEOFPacket writes an EOF packet, through the buffer, and doesn't flush (as it is used as part of a query result).

func (*Conn) WriteEphemeralPacket

func (c *Conn) WriteEphemeralPacket() error

WriteEphemeralPacket writes the packet that was allocated by StartEphemeralPacket.

func (*Conn) WriteErrorPacket

func (c *Conn) WriteErrorPacket(errorCode uint16, sqlState string, format string, args ...interface{}) error

WriteErrorPacket writes an error packet. Server -> Client. This method returns a generic error, not a SQLError.

func (*Conn) WriteErrorPacketFromError

func (c *Conn) WriteErrorPacketFromError(err error) error

WriteErrorPacketFromError writes an error packet, from a regular error. See writeErrorPacket for other info.

func (*Conn) WriteOKPacket

func (c *Conn) WriteOKPacket(affectedRows, lastInsertID uint64, flags uint16, warnings uint16) error

WriteOKPacket writes an OK packet. Server -> Client. This method returns a generic error, not a SQLError.

func (*Conn) WriteOKPacketWithEOFHeader

func (c *Conn) WriteOKPacketWithEOFHeader(affectedRows, lastInsertID uint64, flags uint16, warnings uint16) error

WriteOKPacketWithEOFHeader writes an OK packet with an EOF header. This is used at the end of a result set if CapabilityClientDeprecateEOF is set. Server -> Client. This method returns a generic error, not a SQLError.

func (*Conn) WritePacket

func (c *Conn) WritePacket(data []byte) error

WritePacket writes a packet, possibly cutting it into multiple chunks. Note this is not very efficient, as the client probably has to build the []byte and that makes a memory copy. Try to use StartEphemeralPacket/writeEphemeralPacket instead.

This method returns a generic error, not a SQLError.

type Desc

type Desc struct {
	Name             string
	Desc             string
	DefaultCollation string
	Maxlen           int
}

Desc is a charset description.

func GetAllCharsets

func GetAllCharsets() []*Desc

GetAllCharsets gets all charset descriptions in the local charsets.

func GetCharsetDesc

func GetCharsetDesc(cs string) (*Desc, error)

GetCharsetDesc gets charset descriptions in the local charsets.

type Field

type Field struct {
	Data         FieldData
	Schema       []byte
	Table        []byte
	OrgTable     []byte
	Name         []byte
	OrgName      []byte
	Charset      uint16
	ColumnLength uint32
	Type         uint8
	Flag         uint16
	Decimal      uint8

	DefaultValueLength uint64
	DefaultValue       []byte
}

Field to represent column field

func (*Field) Dump

func (f *Field) Dump() []byte

Dump dume field into binary []byte

type FieldData

type FieldData []byte

FieldData means filed data, is []byte

func (FieldData) Parse

func (p FieldData) Parse() (f *Field, err error)

Parse parse []byte to Field

type PriorityEnum

type PriorityEnum int

PriorityEnum is defined for Priority const values.

const (
	NoPriority PriorityEnum = iota
	LowPriority
	HighPriority
	DelayedPriority
)

Priority const values. See https://dev.mysql.com/doc/refman/5.7/en/insert.html

func Str2Priority

func Str2Priority(val string) PriorityEnum

Str2Priority is used to convert a string to a priority.

func (*PriorityEnum) Restore

func (n *PriorityEnum) Restore(ctx *format.RestoreCtx) error

Restore implements Node interface.

type PrivilegeType

type PrivilegeType uint32

PrivilegeType privilege

const (

	// CreatePriv is the privilege to create schema/table.
	CreatePriv PrivilegeType
	// SelectPriv is the privilege to read from table.
	SelectPriv
	// InsertPriv is the privilege to insert data into table.
	InsertPriv
	// UpdatePriv is the privilege to update data in table.
	UpdatePriv
	// DeletePriv is the privilege to delete data from table.
	DeletePriv
	// ShowDBPriv is the privilege to run show databases statement.
	ShowDBPriv
	// SuperPriv enables many operations and server behaviors.
	SuperPriv
	// CreateUserPriv is the privilege to create user.
	CreateUserPriv
	// TriggerPriv is not checked yet.
	TriggerPriv
	// DropPriv is the privilege to drop schema/table.
	DropPriv
	// ProcessPriv pertains to display of information about the threads executing within the server.
	ProcessPriv
	// GrantPriv is the privilege to grant privilege to user.
	GrantPriv
	// ReferencesPriv is not checked yet.
	ReferencesPriv
	// AlterPriv is the privilege to run alter statement.
	AlterPriv
	// ExecutePriv is the privilege to run execute statement.
	ExecutePriv
	// IndexPriv is the privilege to create/drop index.
	IndexPriv
	// CreateViewPriv is the privilege to create view.
	CreateViewPriv
	// ShowViewPriv is the privilege to show create view.
	ShowViewPriv
	// CreateRolePriv the privilege to create a role.
	CreateRolePriv
	// DropRolePriv is the privilege to drop a role.
	DropRolePriv
	// AllPriv is the privilege for all actions.
	AllPriv
)

type Result

type Result struct {
	Status uint16

	InsertID     uint64
	AffectedRows uint64

	*Resultset
}

Result means mysql status、results after sql execution

type Resultset

type Resultset struct {
	Fields     []*Field        // columns information
	FieldNames map[string]int  // column information, key: column name value: index in Fields
	Values     [][]interface{} // values after sql handled

	RowDatas []RowData // data will returned
}

Resultset means mysql results of sql execution, included split table sql

func BuildBinaryResultset

func BuildBinaryResultset(fields []*Field, values [][]interface{}) (*Resultset, error)

BuildBinaryResultset build binary resultset https://dev.mysql.com/doc/internals/en/binary-protocol-resultset.html

func BuildResultset

func BuildResultset(fields []*Field, names []string, values [][]interface{}) (*Resultset, error)

BuildResultset build resultset

func (*Resultset) ColumnNumber

func (r *Resultset) ColumnNumber() int

ColumnNumber return column number of results

func (*Resultset) GetFloat

func (r *Resultset) GetFloat(row, column int) (float64, error)

GetFloat return value in special row and column in float64 type

func (*Resultset) GetFloatByName

func (r *Resultset) GetFloatByName(row int, name string) (float64, error)

GetFloatByName return value in special row and column in float64 type, but the entry param is name

func (*Resultset) GetInt

func (r *Resultset) GetInt(row, column int) (int64, error)

GetInt return value in special row and column in int64 type

func (*Resultset) GetIntByName

func (r *Resultset) GetIntByName(row int, name string) (int64, error)

GetIntByName return value in special row and column in int64 type, but the entry param is name

func (*Resultset) GetString

func (r *Resultset) GetString(row, column int) (string, error)

GetString return value in special row and column in string type

func (*Resultset) GetStringByName

func (r *Resultset) GetStringByName(row int, name string) (string, error)

GetStringByName return value in special row and column in string type, but the entry param is name

func (*Resultset) GetUint

func (r *Resultset) GetUint(row, column int) (uint64, error)

GetUint return value in special row and column in uint64 type

func (*Resultset) GetUintByName

func (r *Resultset) GetUintByName(row int, name string) (uint64, error)

GetUintByName return value in special row and column in uint64 type, but the entry param is name

func (*Resultset) GetValue

func (r *Resultset) GetValue(row, column int) (interface{}, error)

GetValue return value in special row and column

func (*Resultset) GetValueByName

func (r *Resultset) GetValueByName(row int, name string) (interface{}, error)

GetValueByName return value in special row and column

func (*Resultset) IsNull

func (r *Resultset) IsNull(row, column int) (bool, error)

IsNull check if value in special row and column is Null

func (*Resultset) IsNullByName

func (r *Resultset) IsNullByName(row int, name string) (bool, error)

IsNullByName check if value in special row and column is Null, but the entry param is column name

func (*Resultset) NameIndex

func (r *Resultset) NameIndex(name string) (int, error)

NameIndex return column index in Fields

func (*Resultset) RowNumber

func (r *Resultset) RowNumber() int

RowNumber return row number of results

func (*Resultset) Sort

func (r *Resultset) Sort(sk []SortKey) error

Sort sort resultset

func (*Resultset) SortWithoutColumnName

func (r *Resultset) SortWithoutColumnName(sk []SortKey) error

SortWithoutColumnName 只使用SortKey中的column来获取列信息, 不使用Name

type ResultsetSorter

type ResultsetSorter struct {
	*Resultset
	// contains filtered or unexported fields
}

ResultsetSorter contains resultset will sort

func (*ResultsetSorter) Len

func (r *ResultsetSorter) Len() int

func (*ResultsetSorter) Less

func (r *ResultsetSorter) Less(i, j int) bool

func (*ResultsetSorter) Swap

func (r *ResultsetSorter) Swap(i, j int)

type RowData

type RowData []byte

RowData row in []byte format

func (RowData) Parse

func (p RowData) Parse(f []*Field, binary bool) ([]interface{}, error)

Parse parse data to field

func (RowData) ParseBinary

func (p RowData) ParseBinary(f []*Field) ([]interface{}, error)

ParseBinary parse binary format data

func (RowData) ParseText

func (p RowData) ParseText(f []*Field) ([]interface{}, error)

ParseText parse text format data

type SQLError

type SQLError struct {
	Code    uint16
	Message string
	State   string
}

SQLError contains error code、SQLSTATE and message string https://dev.mysql.com/doc/refman/5.7/en/server-error-reference.html

func NewDefaultError

func NewDefaultError(errCode uint16, args ...interface{}) *SQLError

NewDefaultError default mysql error, must adapt errname message format

func NewErrf

func NewErrf(errCode uint16, format string, args ...interface{}) *SQLError

NewErrf creates a SQL error, with an error code and a format specifier.

func NewError

func NewError(errCode uint16, message string) *SQLError

NewError create new error with specified code and message

func (*SQLError) Error

func (se *SQLError) Error() string

func (*SQLError) SQLCode

func (se *SQLError) SQLCode() uint16

SQLCode returns the internal MySQL error code.

func (*SQLError) SQLState

func (se *SQLError) SQLState() string

SQLState returns the SQLSTATE value.

type SQLMode

type SQLMode int

SQLMode is the type for MySQL sql_mode. See https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html

const (
	ModeNone        SQLMode = 0
	ModeRealAsFloat SQLMode = 1 << iota
	ModePipesAsConcat
	ModeANSIQuotes
	ModeIgnoreSpace
	ModeNotUsed
	ModeOnlyFullGroupBy
	ModeNoUnsignedSubtraction
	ModeNoDirInCreate
	ModePostgreSQL
	ModeOracle
	ModeMsSQL
	ModeDb2
	ModeMaxdb
	ModeNoKeyOptions
	ModeNoTableOptions
	ModeNoFieldOptions
	ModeMySQL323
	ModeMySQL40
	ModeANSI
	ModeNoAutoValueOnZero
	ModeNoBackslashEscapes
	ModeStrictTransTables
	ModeStrictAllTables
	ModeNoZeroInDate
	ModeNoZeroDate
	ModeInvalidDates
	ModeErrorForDivisionByZero
	ModeTraditional
	ModeNoAutoCreateUser
	ModeHighNotPrecedence
	ModeNoEngineSubstitution
	ModePadCharToFullLength
	ModeAllowInvalidDates
)

consts for sql modes.

func GetSQLMode

func GetSQLMode(s string) (SQLMode, error)

GetSQLMode gets the sql mode for string literal. SQL_mode is a list of different modes separated by commas. The input string must be formatted by 'FormatSQLModeStr'

func (SQLMode) HasANSIQuotesMode

func (m SQLMode) HasANSIQuotesMode() bool

HasANSIQuotesMode detects if 'ANSI_QUOTES' mode is set in SQLMode

func (SQLMode) HasAllowInvalidDatesMode

func (m SQLMode) HasAllowInvalidDatesMode() bool

HasAllowInvalidDatesMode detects if 'ALLOW_INVALID_DATES' mode is set in SQLMode

func (SQLMode) HasErrorForDivisionByZeroMode

func (m SQLMode) HasErrorForDivisionByZeroMode() bool

HasErrorForDivisionByZeroMode detects if 'ERROR_FOR_DIVISION_BY_ZERO' mode is set in SQLMode

func (SQLMode) HasHighNotPrecedenceMode

func (m SQLMode) HasHighNotPrecedenceMode() bool

HasHighNotPrecedenceMode detects if 'HIGH_NOT_PRECEDENCE' mode is set in SQLMode

func (SQLMode) HasIgnoreSpaceMode

func (m SQLMode) HasIgnoreSpaceMode() bool

HasIgnoreSpaceMode detects if 'IGNORE_SPACE' mode is set in SQLMode

func (SQLMode) HasNoAutoCreateUserMode

func (m SQLMode) HasNoAutoCreateUserMode() bool

HasNoAutoCreateUserMode detects if 'NO_AUTO_CREATE_USER' mode is set in SQLMode

func (SQLMode) HasNoBackslashEscapesMode

func (m SQLMode) HasNoBackslashEscapesMode() bool

HasNoBackslashEscapesMode detects if 'NO_BACKSLASH_ESCAPES' mode is set in SQLMode

func (SQLMode) HasNoUnsignedSubtractionMode

func (m SQLMode) HasNoUnsignedSubtractionMode() bool

HasNoUnsignedSubtractionMode detects if 'NO_UNSIGNED_SUBTRACTION' mode is set in SQLMode

func (SQLMode) HasNoZeroDateMode

func (m SQLMode) HasNoZeroDateMode() bool

HasNoZeroDateMode detects if 'NO_ZERO_DATE' mode is set in SQLMode

func (SQLMode) HasNoZeroInDateMode

func (m SQLMode) HasNoZeroInDateMode() bool

HasNoZeroInDateMode detects if 'NO_ZERO_IN_DATE' mode is set in SQLMode

func (SQLMode) HasOnlyFullGroupBy

func (m SQLMode) HasOnlyFullGroupBy() bool

HasOnlyFullGroupBy detects if 'ONLY_FULL_GROUP_BY' mode is set in SQLMode

func (SQLMode) HasPadCharToFullLengthMode

func (m SQLMode) HasPadCharToFullLengthMode() bool

HasPadCharToFullLengthMode detects if 'PAD_CHAR_TO_FULL_LENGTH' mode is set in SQLMode

func (SQLMode) HasPipesAsConcatMode

func (m SQLMode) HasPipesAsConcatMode() bool

HasPipesAsConcatMode detects if 'PIPES_AS_CONCAT' mode is set in SQLMode

func (SQLMode) HasRealAsFloatMode

func (m SQLMode) HasRealAsFloatMode() bool

HasRealAsFloatMode detects if 'REAL_AS_FLOAT' mode is set in SQLMode

func (SQLMode) HasStrictMode

func (m SQLMode) HasStrictMode() bool

HasStrictMode detects if 'STRICT_TRANS_TABLES' or 'STRICT_ALL_TABLES' mode is set in SQLMode

type SessionVariables

type SessionVariables struct {
	// contains filtered or unexported fields
}

SessionVariables variables in session

func NewSessionVariables

func NewSessionVariables() *SessionVariables

NewSessionVariables constructor of SessionVariables

func (*SessionVariables) Delete

func (s *SessionVariables) Delete(key string)

Delete delete variables with specific key

func (*SessionVariables) Equals

func (s *SessionVariables) Equals(dst *SessionVariables) bool

Equals check if equal of SessionVariables

func (*SessionVariables) Get

func (s *SessionVariables) Get(key string) (interface{}, bool)

Get return variable with specific key

func (*SessionVariables) GetAll

func (s *SessionVariables) GetAll() map[string]*Variable

GetAll return all variables in session

func (*SessionVariables) GetUnusedAndClear

func (s *SessionVariables) GetUnusedAndClear() map[string]*Variable

GetUnusedAndClear unused variables

func (*SessionVariables) Set

func (s *SessionVariables) Set(key string, value interface{}) error

Set store variable in session

func (*SessionVariables) SetEqualsWith

func (s *SessionVariables) SetEqualsWith(dst *SessionVariables) (bool, error)

SetEqualsWith set the SessionVariables equals with the dst, and variables not contained in dst are moved to unused.

type SortKey

type SortKey struct {
	//name of the field
	Name string

	Direction string

	//column index of the field
	Column int
}

SortKey key will sort

type TimeValue

type TimeValue struct {
	IsNegative  bool
	Day         int
	Hour        int
	Minute      int
	Second      int
	Microsecond int
}

TimeValue mysql time value

func (*TimeValue) IsNull

func (m *TimeValue) IsNull() bool

IsNull check TimeValue if null

type Variable

type Variable struct {
	// contains filtered or unexported fields
}

Variable variable definition in session

func NewVariable

func NewVariable(name string, value interface{}, verify verifyFunc) (*Variable, error)

NewVariable constructor of Variable

func (*Variable) Get

func (v *Variable) Get() interface{}

Get return value in Variable

func (*Variable) Name

func (v *Variable) Name() string

Name name of variable

func (*Variable) Set

func (v *Variable) Set(value interface{}) error

Set store data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL