mysql

package
v0.0.0-...-3056823 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MinBitWidth = 1
	MaxBitWidth = 64
	// UnspecifiedBitWidth is the unspecified with if you want to calculate bit width dynamically.
	UnspecifiedBitWidth = -1
)

Min and Max bit width.

View Source
const (
	DefaultCharset       = "utf8"
	DefaultCollationID   = 33
	BinaryCollationID    = 63
	DefaultCollationName = "utf8_general_ci"
)

MySQL collation informations.

View Source
const (
	MinProtocolVersion byte   = 10
	MaxPayloadLen      int    = 1<<24 - 1
	ServerVersion      string = "5.7-TiDB-1.0"
)

Version informations.

View Source
const (
	OKHeader          byte = 0x00
	ErrHeader         byte = 0xff
	EOFHeader         byte = 0xfe
	LocalInFileHeader byte = 0xfb
)

Header informations.

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 informations.

View Source
const (
	MaxTableNameLength    int = 64
	MaxDatabaseNameLength int = 64
	MaxColumnNameLength   int = 64
)

Identifier length limitations.

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
)

Command informations.

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 informations.

View Source
const (
	// SystemDB is the name of system database.
	SystemDB = "mysql"
	// UserTable is the table in system db contains user info.
	UserTable = "User"
	// DBTable is the table in system db contains db scope privilege info.
	DBTable = "DB"
	// TablePrivTable is the table in system db contains table scope privilege info.
	TablePrivTable = "Tables_priv"
	// ColumnPrivTable is the table in system db contains column scope privilege info.
	ColumnPrivTable = "Columns_priv"
	// GlobalVariablesTable is the table contains global system variables.
	GlobalVariablesTable = "GLOBAL_VARIABLES"
	// GlobalStatusTable is the table contains global status variables.
	GlobalStatusTable = "GLOBAL_STATUS"
	// TiDBTable is the table contains tidb info.
	TiDBTable = "tidb"
)

MySQL database and tables.

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
	ErrWrongFieldWithGroup                                          = 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
	ErrKeyDoesNotExits                                              = 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
)

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

View Source
const (
	// UnspecifiedFsp is the unspecified fractional seconds part.
	UnspecifiedFsp int = -1
	// MaxFsp is the maximum digit of fractional seconds part.
	MaxFsp int = 6
	// MinFsp is the minimum digit of fractional seconds part.
	MinFsp int = 0
	// DefaultFsp is the default digit of fractional seconds part.
	// MySQL use 0 as the default Fsp.
	DefaultFsp int = 0
)
View Source
const (
	MaxFraction = 30
	DivFracIncr = 4
)

constant values.

View Source
const (
	DateFormat = "2006-01-02"
	TimeFormat = "2006-01-02 15:04:05"
	// TimeFSPFormat is time format with fractional seconds precision.
	TimeFSPFormat = "2006-01-02 15:04:05.000000"
)

Time format without fractional seconds precision.

View Source
const (
	// MinYear is the minimum for mysql year type.
	MinYear int16 = 1901
	// MaxYear is the maximum for mysql year type.
	MaxYear int16 = 2155

	// MinTime is the minimum for mysql time type.
	MinTime = -time.Duration(838*3600+59*60+59) * time.Second
	// MaxTime is the maximum for mysql time type.
	MaxTime = time.Duration(838*3600+59*60+59) * time.Second
)
View Source
const (
	TypeDecimal byte = iota
	TypeTiny
	TypeShort
	TypeLong
	TypeFloat
	TypeDouble
	TypeNull
	TypeTimestamp
	TypeLonglong
	TypeInt24
	TypeDate
	TypeDuration /* Original name was TypeTime, renamed to Duration to resolve the conflict with Go type Time.*/
	TypeDatetime
	TypeYear
	TypeNewDate
	TypeVarchar
	TypeBit
)

MySQL type informations.

View Source
const (
	TypeNewDecimal byte = iota + 0xf6
	TypeEnum
	TypeSet
	TypeTinyBlob
	TypeMediumBlob
	TypeLongBlob
	TypeBlob
	TypeVarString
	TypeString
	TypeGeometry
)

MySQL type informations.

View Source
const (
	NotNullFlag     = 1   /* Field can't be NULL */
	PriKeyFlag      = 2   /* Field is part of a primary key */
	UniqueKeyFlag   = 4   /* Field is part of a unique key */
	MultipleKeyFlag = 8   /* Field is part of a key */
	BlobFlag        = 16  /* Field is a blob */
	UnsignedFlag    = 32  /* Field is unsigned */
	ZerofillFlag    = 64  /* Field is zerofill */
	BinaryFlag      = 128 /* Field is binary   */

	EnumFlag           = 256    /* Field is an enum */
	AutoIncrementFlag  = 512    /* Field is an auto increment field */
	TimestampFlag      = 1024   /* Field is a timestamp */
	SetFlag            = 2048   /* Field is a set */
	NoDefaultValueFlag = 4096   /* Field doesn't have a default value */
	OnUpdateNowFlag    = 8192   /* Field is set to NOW on UPDATE */
	NumFlag            = 32768  /* Field is a num (for clients) */
	PartKeyFlag        = 16384  /* Intern: Part of some keys */
	GroupFlag          = 32768  /* Intern: Group field */
	UniqueFlag         = 65536  /* Intern: Used by sql_yacc */
	BinCmpFlag         = 131072 /* Intern: Used by sql_yacc */
)

Flag informations.

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

TypeInt24 bounds.

View Source
const AllPrivilegeLiteral = "ALL PRIVILEGES"

AllPrivilegeLiteral is the string literal for All Privilege.

View Source
const (
	AuthName = "mysql_native_password"
)

Auth name informations.

View Source
const (
	// DefaultMySQLState is default state of the mySQL
	DefaultMySQLState = "HY000"
)
View Source
const (
	TypeNoCache byte = 0xff
)

Cache type informations.

Variables

View Source
var (
	ErrBadConn       = errors.New("connection was bad")
	ErrMalformPacket = errors.New("Malform packet error")

	ErrTruncated = errors.New("truncated")
	ErrOverflow  = errors.New("overflow")
	ErrDivByZero = errors.New("div by zero")
	ErrBadNumber = errors.New("bad number")
)

Portable analogs of some common call errors.

View Source
var (
	ErrInvalidTimeFormat = errors.New("invalid time format")
	ErrInvalidYearFormat = errors.New("invalid year format")
	ErrInvalidYear       = errors.New("invalid year")
)

Portable analogs of some common call errors.

View Source
var (
	// ZeroDuration is the zero value for Duration type.
	ZeroDuration = Duration{Duration: time.Duration(0), Fsp: DefaultFsp}

	// ZeroTime is the zero value for time.Time type.
	ZeroTime = time.Date(0, 0, 0, 0, 0, 0, 0, time.Local)

	// ZeroDatetime is the zero value for datetime Time.
	ZeroDatetime = Time{
		Time: ZeroTime,
		Type: TypeDatetime,
		Fsp:  DefaultFsp,
	}

	// ZeroTimestamp is the zero value for timestamp Time.
	ZeroTimestamp = Time{
		Time: ZeroTime,
		Type: TypeTimestamp,
		Fsp:  DefaultFsp,
	}

	// ZeroDate is the zero value for date Time.
	ZeroDate = Time{
		Time: ZeroTime,
		Type: TypeDate,
		Fsp:  DefaultFsp,
	}
)

Zero values for different types.

View Source
var (
	// MinDatetime is the minimum for mysql datetime type.
	MinDatetime = time.Date(1000, 1, 1, 0, 0, 0, 0, time.Local)
	// MaxDatetime is the maximum for mysql datetime type.
	MaxDatetime = time.Date(9999, 12, 31, 23, 59, 59, 999999, time.Local)

	// MinTimestamp is the minimum for mysql timestamp type.
	MinTimestamp = time.Date(1970, 1, 1, 0, 0, 1, 0, time.UTC)
	// MaxTimestamp is the maximum for mysql timestamp type.
	MaxTimestamp = time.Date(2038, 1, 19, 3, 14, 7, 999999, time.UTC)

	// WeekdayNames lists names of weekdays, which are used in builtin time function `dayname`.
	WeekdayNames = []string{
		"Monday",
		"Tuesday",
		"Wednesday",
		"Thursday",
		"Friday",
		"Saturday",
		"Sunday",
	}

	// MonthNames lists names of months, which are used in builtin time function `monthname`.
	MonthNames = []string{
		"January", "February",
		"March", "April",
		"May", "June",
		"July", "August",
		"September", "October",
		"November", "December",
	}
)

AllColumnPrivs is all the privileges in column scope.

AllDBPrivs is all the privileges in database scope.

AllGlobalPrivs is all the privileges in global scope.

AllTablePrivs is all the privileges in table scope.

View Source
var CharsetIDs = map[string]uint8{
	"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 Col2PrivType = map[string]PrivilegeType{
	"Create_priv":      CreatePriv,
	"Select_priv":      SelectPriv,
	"Insert_priv":      InsertPriv,
	"Update_priv":      UpdatePriv,
	"Delete_priv":      DeletePriv,
	"Show_db_priv":     ShowDBPriv,
	"Create_user_priv": CreateUserPriv,
	"Drop_priv":        DropPriv,
	"Grant_priv":       GrantPriv,
	"Alter_priv":       AlterPriv,
	"Execute_priv":     ExecutePriv,
	"Index_priv":       IndexPriv,
}

Col2PrivType is the privilege tables column name to privilege type.

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

CollationNames maps MySQL default collation name to its ID

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

Collations maps MySQL default collation ID to its name.

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

MySQLErrName maps error code to MySQL error messages.

View Source
var MySQLState = map[uint16]string{}/* 225 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 Priv2SetStr = map[PrivilegeType]string{
	CreatePriv:  "Create",
	SelectPriv:  "Select",
	InsertPriv:  "Insert",
	UpdatePriv:  "Update",
	DeletePriv:  "Delete",
	DropPriv:    "Drop",
	GrantPriv:   "Grant",
	AlterPriv:   "Alter",
	ExecutePriv: "Execute",
	IndexPriv:   "Index",
}

Priv2SetStr is the map for privilege to string.

View Source
var Priv2Str = map[PrivilegeType]string{
	CreatePriv:     "Create",
	SelectPriv:     "Select",
	InsertPriv:     "Insert",
	UpdatePriv:     "Update",
	DeletePriv:     "Delete",
	ShowDBPriv:     "Show Databases",
	CreateUserPriv: "Create User",
	DropPriv:       "Drop",
	GrantPriv:      "Grant Option",
	AlterPriv:      "Alter",
	ExecutePriv:    "Execute",
	IndexPriv:      "Index",
}

Priv2Str is the map for privilege to string.

View Source
var Priv2UserCol = map[PrivilegeType]string{
	CreatePriv:     "Create_priv",
	SelectPriv:     "Select_priv",
	InsertPriv:     "Insert_priv",
	UpdatePriv:     "Update_priv",
	DeletePriv:     "Delete_priv",
	ShowDBPriv:     "Show_db_priv",
	CreateUserPriv: "Create_user_priv",
	DropPriv:       "Drop_priv",
	GrantPriv:      "Grant_priv",
	AlterPriv:      "Alter_priv",
	ExecutePriv:    "Execute_priv",
	IndexPriv:      "Index_priv",
}

Priv2UserCol is the privilege to mysql.user table column name.

View Source
var SetStr2Priv = map[string]PrivilegeType{
	"Create":  CreatePriv,
	"Select":  SelectPriv,
	"Insert":  InsertPriv,
	"Update":  UpdatePriv,
	"Delete":  DeletePriv,
	"Drop":    DropPriv,
	"Grant":   GrantPriv,
	"Alter":   AlterPriv,
	"Execute": ExecutePriv,
	"Index":   IndexPriv,
}

SetStr2Priv is the map for privilege set string to privilege type.

View Source
var TypeUnspecified = TypeDecimal

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

Functions

func AdjustYear

func AdjustYear(y int64) (int64, error)

AdjustYear is used for adjusting year and checking its validation.

func DecimalAdd

func DecimalAdd(from1, from2, to *MyDecimal) error

DecimalAdd adds two decimals, sets the result to 'to'.

func DecimalDiv

func DecimalDiv(from1, from2, to *MyDecimal, fracIncr int) error

DecimalDiv does division of two decimals.

from1 - dividend from2 - divisor to - quotient fracIncr - increment of fraction

func DecimalMod

func DecimalMod(from1, from2, to *MyDecimal) error

DecimalMod does modulus of two decimals.

    from1   - dividend
    from2   - divisor
    to      - modulus

RETURN VALUE
  E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW/E_DEC_DIV_ZERO;

NOTES
  see do_div_mod()

DESCRIPTION
  the modulus R in    R = M mod N

 is defined as

   0 <= |R| < |M|
   sign R == sign M
   R = M - k*N, where k is integer

 thus, there's no requirement for M or N to be integers

func DecimalMul

func DecimalMul(from1, from2, to *MyDecimal) error

DecimalMul multiplies two decimals.

    from1, from2 - factors
    to      - product

RETURN VALUE
  E_DEC_OK/E_DEC_TRUNCATED/E_DEC_OVERFLOW;

NOTES
  in this implementation, with wordSize=4 we have digitsPerWord=9,
  and 63-digit number will take only 7 words (basically a 7-digit
  "base 999999999" number).  Thus there's no need in fast multiplication
  algorithms, 7-digit numbers can be multiplied with a naive O(n*n)
  method.

  XXX if this library is to be used with huge numbers of thousands of
  digits, fast multiplication must be implemented.

func DecimalPeak

func DecimalPeak(b []byte) (int, error)

DecimalPeak returns the length of the encoded decimal.

func DecimalSub

func DecimalSub(from1, from2, to *MyDecimal) error

DecimalSub subs one decimal from another, sets the result to 'to'.

func ExtractTimeNum

func ExtractTimeNum(unit string, t Time) (int64, error)

ExtractTimeNum extracts time value number from time unit and format.

func ExtractTimeValue

func ExtractTimeValue(unit string, format string) (int64, int64, int64, time.Duration, error)

ExtractTimeValue extracts time value from time unit and format.

func GetDefaultDecimal

func GetDefaultDecimal(tp byte) int

GetDefaultDecimal returns the default decimal length for column.

func GetDefaultFieldLength

func GetDefaultFieldLength(tp byte) int

GetDefaultFieldLength is used for Interger Types, Flen is the display length. 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 See https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html

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 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 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 IsClockUnit

func IsClockUnit(unit string) bool

IsClockUnit returns true when unit is interval unit with hour, minute or second.

func IsDateFormat

func IsDateFormat(format string) bool

IsDateFormat returns true when the specified time format could contain only date.

func IsUninitializedType

func IsUninitializedType(tp byte) bool

IsUninitializedType check if a type code is uninitialized. TypeDecimal is the old type code for decimal and not be used in the new mysql version.

func ParseHexStr

func ParseHexStr(s string) (string, error)

ParseHexStr parses hexadecimal literal as string. See https://dev.mysql.com/doc/refman/5.7/en/hexadecimal-literals.html

func ParseYear

func ParseYear(str string) (int16, error)

ParseYear parses a formatted string and returns a year number.

Types

type Bit

type Bit struct {
	// Value holds the value for bit type.
	Value uint64

	// Width is the display with for bit value.
	// e.g, with is 8, 0 is for 0b00000000.
	Width int
}

Bit is for mysql bit type.

func ParseBit

func ParseBit(s string, width int) (Bit, error)

ParseBit parses bit string. The string format can be b'val', B'val' or 0bval, val must be 0 or 1. Width is the display width for bit representation. -1 means calculating width dynamically, using following algorithm: (len("011101") + 7) & ^7, e.g, if bit string is 0b01, the above will return 8 for its bit width.

func (Bit) String

func (b Bit) String() string

String implements fmt.Stringer interface.

func (Bit) ToNumber

func (b Bit) ToNumber() float64

ToNumber changes bit type to float64 for numeric operation. MySQL treats bit as double type.

func (Bit) ToString

func (b Bit) ToString() string

ToString returns the binary string for bit type.

type Duration

type Duration struct {
	time.Duration
	// Fsp is short for Fractional Seconds Precision.
	// See http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html
	Fsp int
}

Duration is the type for MySQL time type.

func ParseDuration

func ParseDuration(str string, fsp int) (Duration, error)

ParseDuration parses the time form a formatted string with a fractional seconds part, returns the duration type Time value. See http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html

func (Duration) Compare

func (d Duration) Compare(o Duration) int

Compare returns an integer comparing the Duration instant t to o. If d is after o, return 1, equal o, return 0, before o, return -1.

func (Duration) CompareString

func (d Duration) CompareString(str string) (int, error)

CompareString is like Compare, but parses str to Duration then compares.

func (Duration) ConvertToTime

func (d Duration) ConvertToTime(tp uint8) (Time, error)

ConvertToTime converts duration to Time. Tp is TypeDatetime, TypeTimestamp and TypeDate.

func (Duration) Hour

func (d Duration) Hour() int

Hour returns current hour. e.g, hour("11:11:11") -> 11

func (Duration) MicroSecond

func (d Duration) MicroSecond() int

MicroSecond returns current microsecond. e.g, hour("11:11:11.11") -> 110000

func (Duration) Minute

func (d Duration) Minute() int

Minute returns current minute. e.g, hour("11:11:11") -> 11

func (Duration) RoundFrac

func (d Duration) RoundFrac(fsp int) (Duration, error)

RoundFrac rounds fractional seconds precision with new fsp and returns a new one. We will use the “round half up” rule, e.g, >= 0.5 -> 1, < 0.5 -> 0, so 10:10:10.999999 round 0 -> 10:10:11 and 10:10:10.000000 round 0 -> 10:10:10

func (Duration) Second

func (d Duration) Second() int

Second returns current second. e.g, hour("11:11:11") -> 11

func (Duration) String

func (d Duration) String() string

String returns the time formatted using default TimeFormat and fsp.

func (Duration) ToNumber

func (d Duration) ToNumber() *MyDecimal

ToNumber changes duration to number format. e.g, 10:10:10 -> 101010

type Enum

type Enum struct {
	Name  string
	Value uint64
}

Enum is for MySQL enum type.

func ParseEnumName

func ParseEnumName(elems []string, name string) (Enum, error)

ParseEnumName creates a Enum with item name.

func ParseEnumValue

func ParseEnumValue(elems []string, number uint64) (Enum, error)

ParseEnumValue creates a Enum with special number.

func (Enum) String

func (e Enum) String() string

String implements fmt.Stringer interface.

func (Enum) ToNumber

func (e Enum) ToNumber() float64

ToNumber changes enum index to float64 for numeric operation.

type Hex

type Hex struct {
	// Value holds numeric value for hexadecimal literal.
	Value int64
}

Hex is for mysql hexadecimal literal type.

func ParseHex

func ParseHex(s string) (Hex, error)

ParseHex parses hexadecimal literal string. The string format can be X'val', x'val' or 0xval. val must in (0...9, a...f, A...F).

func (Hex) String

func (h Hex) String() string

String implements fmt.Stringer interface.

func (Hex) ToNumber

func (h Hex) ToNumber() float64

ToNumber changes hexadecimal type to float64 for numeric operation. MySQL treats hexadecimal literal as double type.

func (Hex) ToString

func (h Hex) ToString() string

ToString returns the string representation for hexadecimal literal.

type MyDecimal

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

MyDecimal represents a decimal value.

func NewDecFromFloatForTest

func NewDecFromFloatForTest(f float64) *MyDecimal

NewDecFromFloatForTest creates a MyDecimal from float, as it returns no error, it should only be used in test.

func NewDecFromInt

func NewDecFromInt(i int64) *MyDecimal

NewDecFromInt creates a MyDecimal from int.

func NewDecFromStringForTest

func NewDecFromStringForTest(s string) *MyDecimal

NewDecFromStringForTest creates a MyDecimal from string, as it returns no error, it should only be used in test.

func (*MyDecimal) Compare

func (d *MyDecimal) Compare(to *MyDecimal) int

Compare compares one decimal to another, returns -1/0/1.

func (*MyDecimal) FromBin

func (d *MyDecimal) FromBin(bin []byte, precision, frac int) (binSize int, err error)

FromBin Restores decimal from its binary fixed-length representation.

func (*MyDecimal) FromFloat64

func (d *MyDecimal) FromFloat64(f float64) error

FromFloat64 creates a decimal from float64 value.

func (*MyDecimal) FromInt

func (d *MyDecimal) FromInt(val int64) *MyDecimal

FromInt sets the decimal value from int64.

func (*MyDecimal) FromString

func (d *MyDecimal) FromString(str []byte) error

FromString parses decimal from string.

func (*MyDecimal) FromUint

func (d *MyDecimal) FromUint(val uint64) *MyDecimal

FromUint sets the decimal value from uint64.

func (*MyDecimal) PrecisionAndFrac

func (d *MyDecimal) PrecisionAndFrac() (precision, frac int)

PrecisionAndFrac returns the internal precision and frac number.

func (*MyDecimal) Round

func (d *MyDecimal) Round(to *MyDecimal, frac int) (err error)

Round rounds the decimal to "frac" digits.

to     - result buffer. d == to is allowed
frac   - to what position after fraction point to round. can be negative!
mode   - round to nearest even or truncate

NOTES

scale can be negative !
one TRUNCATED error (line XXX below) isn't treated very logical :(

RETURN VALUE

eDecOK/eDecTruncated

func (*MyDecimal) Shift

func (d *MyDecimal) Shift(shift int) error

Shift shifts decimal digits in given number (with rounding if it need), shift > 0 means shift to left shift, shift < 0 means right shift. In fact it is multiplying on 10^shift.

RETURN

eDecOK          OK
eDecOverflow    operation lead to overflow, number is untoched
eDecTruncated   number was rounded to fit into buffer

func (*MyDecimal) String

func (d *MyDecimal) String() string

String returns the decimal string representation rounded to resultFrac.

func (*MyDecimal) ToBin

func (d *MyDecimal) ToBin(precision, frac int) ([]byte, error)

ToBin converts decimal to its binary fixed-length representation two representations of the same length can be compared with memcmp with the correct -1/0/+1 result

  PARAMS
		precision/frac - if precision is 0, internal value of the decimal will be used,
		then the encoded value is not memory comparable.

  NOTE
    the buffer is assumed to be of the size decimalBinSize(precision, frac)

  RETURN VALUE
  	bin     - binary value
    errCode - eDecOK/eDecTruncate/eDecOverflow

  DESCRIPTION
    for storage decimal numbers are converted to the "binary" format.

    This format has the following properties:
      1. length of the binary representation depends on the {precision, frac}
      as provided by the caller and NOT on the digitsInt/digitsFrac of the decimal to
      convert.
      2. binary representations of the same {precision, frac} can be compared
      with memcmp - with the same result as DecimalCompare() of the original
      decimals (not taking into account possible precision loss during
      conversion).

    This binary format is as follows:
      1. First the number is converted to have a requested precision and frac.
      2. Every full digitsPerWord digits of digitsInt part are stored in 4 bytes
         as is
      3. The first digitsInt % digitesPerWord digits are stored in the reduced
         number of bytes (enough bytes to store this number of digits -
         see dig2bytes)
      4. same for frac - full word are stored as is,
         the last frac % digitsPerWord digits - in the reduced number of bytes.
      5. If the number is negative - every byte is inversed.
      5. The very first bit of the resulting byte array is inverted (because
         memcmp compares unsigned bytes, see property 2 above)

    Example:

      1234567890.1234

    internally is represented as 3 words

      1 234567890 123400000

    (assuming we want a binary representation with precision=14, frac=4)
    in hex it's

      00-00-00-01  0D-FB-38-D2  07-5A-EF-40

    now, middle word is full - it stores 9 decimal digits. It goes
    into binary representation as is:

      ...........  0D-FB-38-D2 ............

    First word has only one decimal digit. We can store one digit in
    one byte, no need to waste four:

                01 0D-FB-38-D2 ............

    now, last word. It's 123400000. We can store 1234 in two bytes:

                01 0D-FB-38-D2 04-D2

    So, we've packed 12 bytes number in 7 bytes.
    And now we invert the highest bit to get the final result:

                81 0D FB 38 D2 04 D2

    And for -1234567890.1234 it would be

                7E F2 04 C7 2D FB 2D

func (*MyDecimal) ToFloat64

func (d *MyDecimal) ToFloat64() (float64, error)

ToFloat64 converts decimal to float64 value.

func (*MyDecimal) ToInt

func (d *MyDecimal) ToInt() (int64, error)

ToInt returns int part of the decimal, returns the result and errcode.

func (*MyDecimal) ToString

func (d *MyDecimal) ToString() (str []byte)

ToString converts decimal to its printable string representation without rounding.

RETURN VALUE

    str       - result string
    errCode   - eDecOK/eDecTruncate/eDecOverflow

func (*MyDecimal) ToUint

func (d *MyDecimal) ToUint() (uint64, error)

ToUint returns int part of the decimal, returns the result and errcode.

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
	// CreateUserPriv is the privilege to create user.
	CreateUserPriv
	// DropPriv is the privilege to drop schema/table.
	DropPriv
	// GrantPriv is the privilege to grant privilege to user.
	GrantPriv
	// 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
	// AllPriv is the privilege for all actions.
	AllPriv
)

type SQLError

type SQLError struct {
	Code    uint16
	Message string
	State   string
}

SQLError records an error information, from executing SQL.

func NewErr

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

NewErr generates a SQL error, with an error code and default format specifier defined in MySQLErrName.

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 (*SQLError) Error

func (e *SQLError) Error() string

Error prints errors, with a formatted string.

type Set

type Set struct {
	Name  string
	Value uint64
}

Set is for MySQL Set type.

func ParseSetName

func ParseSetName(elems []string, name string) (Set, error)

ParseSetName creates a Set with name.

func ParseSetValue

func ParseSetValue(elems []string, number uint64) (Set, error)

ParseSetValue creates a Set with special number.

func (Set) String

func (e Set) String() string

String implements fmt.Stringer interface.

func (Set) ToNumber

func (e Set) ToNumber() float64

ToNumber changes Set to float64 for numeric operation.

type Time

type Time struct {
	time.Time
	Type uint8
	// Fsp is short for Fractional Seconds Precision.
	// See http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.html
	Fsp int
}

Time is the struct for handling datetime, timestamp and date. TODO: check if need a NewTime function to set Fsp default value?

func CurrentTime

func CurrentTime(tp uint8) Time

CurrentTime returns current time with type tp.

func ParseDate

func ParseDate(str string) (Time, error)

ParseDate is a helper function wrapping ParseTime with date type.

func ParseDateFromNum

func ParseDateFromNum(num int64) (Time, error)

ParseDateFromNum is a helper function wrapping ParseTimeFromNum with date type.

func ParseDatetime

func ParseDatetime(str string) (Time, error)

ParseDatetime is a helper function wrapping ParseTime with datetime type and default fsp.

func ParseDatetimeFromNum

func ParseDatetimeFromNum(num int64) (Time, error)

ParseDatetimeFromNum is a helper function wrapping ParseTimeFromNum with datetime type and default fsp.

func ParseTime

func ParseTime(str string, tp byte, fsp int) (Time, error)

ParseTime parses a formatted string with type tp and specific fsp. Type is TypeDatetime, TypeTimestamp and TypeDate. Fsp is in range [0, 6]. MySQL supports many valid datatime format, but still has some limitation. If delimiter exists, the date part and time part is separated by a space or T, other punctuation character can be used as the delimiter between date parts or time parts. If no delimiter, the format must be YYYYMMDDHHMMSS or YYMMDDHHMMSS If we have fractional seconds part, we must use decimal points as the delimiter. The valid datetime range is from '1000-01-01 00:00:00.000000' to '9999-12-31 23:59:59.999999'. The valid timestamp range is from '1970-01-01 00:00:01.000000' to '2038-01-19 03:14:07.999999'. The valid date range is from '1000-01-01' to '9999-12-31'

func ParseTimeFromInt64

func ParseTimeFromInt64(num int64) (Time, error)

ParseTimeFromInt64 parses mysql time value from int64.

func ParseTimeFromNum

func ParseTimeFromNum(num int64, tp byte, fsp int) (Time, error)

ParseTimeFromNum parses a formatted int64, returns the value which type is tp.

func ParseTimestamp

func ParseTimestamp(str string) (Time, error)

ParseTimestamp is a helper function wrapping ParseTime with timestamp type and default fsp.

func ParseTimestampFromNum

func ParseTimestampFromNum(num int64) (Time, error)

ParseTimestampFromNum is a helper function wrapping ParseTimeFromNum with timestamp type and default fsp.

func (Time) Compare

func (t Time) Compare(o Time) int

Compare returns an integer comparing the time instant t to o. If t is after o, return 1, equal o, return 0, before o, return -1.

func (Time) CompareString

func (t Time) CompareString(str string) (int, error)

CompareString is like Compare, but parses string to Time then compares.

func (Time) Convert

func (t Time) Convert(tp uint8) (Time, error)

Convert converts t with type tp.

func (Time) ConvertToDuration

func (t Time) ConvertToDuration() (Duration, error)

ConvertToDuration converts mysql datetime, timestamp and date to mysql time type. e.g, 2012-12-12T10:10:10 -> 10:10:10 2012-12-12 -> 0

func (*Time) FromPackedUint

func (t *Time) FromPackedUint(packed uint64) error

FromPackedUint decodes Time from a packed uint64 value.

func (Time) IsZero

func (t Time) IsZero() bool

IsZero returns a boolean indicating whether the time is equal to ZeroTime.

func (Time) RoundFrac

func (t Time) RoundFrac(fsp int) (Time, error)

RoundFrac rounds fractional seconds precision with new fsp and returns a new one. We will use the “round half up” rule, e.g, >= 0.5 -> 1, < 0.5 -> 0, so 2011:11:11 10:10:10.888888 round 0 -> 2011:11:11 10:10:11 and 2011:11:11 10:10:10.111111 round 0 -> 2011:11:11 10:10:10

func (Time) String

func (t Time) String() string

func (Time) ToNumber

func (t Time) ToNumber() *MyDecimal

ToNumber returns a formatted number. e.g, 2012-12-12 -> 20121212 2012-12-12T10:10:10 -> 20121212101010 2012-12-12T10:10:10.123456 -> 20121212101010.123456

func (Time) ToPackedUint

func (t Time) ToPackedUint() uint64

ToPackedUint encodes Time to a packed uint64 value.

 1 bit  0
17 bits year*13+month   (year 0-9999, month 0-12)
 5 bits day             (0-31)
 5 bits hour            (0-23)
 6 bits minute          (0-59)
 6 bits second          (0-59)
24 bits microseconds    (0-999999)

Total: 64 bits = 8 bytes

0YYYYYYY.YYYYYYYY.YYdddddh.hhhhmmmm.mmssssss.ffffffff.ffffffff.ffffffff

Jump to

Keyboard shortcuts

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