mysqldef

package
v0.0.0-...-b63205b Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

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.5.31-cm-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 (
	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 (
	MaxFractionDigits    = 30
	DivIncreasePrecision = 4
)

DivisionPrecision is the number of decimal places in the result when it doesn't divide exactly.

Example:

d1 := decimal.NewFromFloat(2).Div(decimal.NewFromFloat(3)
d1.String() // output: "0.6667"
d2 := decimal.NewFromFloat(2).Div(decimal.NewFromFloat(30000)
d2.String() // output: "0.0001"
d3 := decimal.NewFromFloat(20000).Div(decimal.NewFromFloat(3)
d3.String() // output: "6666.6666666666666667"
decimal.DivisionPrecision = 3
d4 := decimal.NewFromFloat(2).Div(decimal.NewFromFloat(3)
d4.String() // output: "0.6667"
View Source
const (
	ErErrorFirst                                            uint16 = 1000
	ErHashchk                                                      = 1000
	ErNisamchk                                                     = 1001
	ErNo                                                           = 1002
	ErYes                                                          = 1003
	ErCantCreateFile                                               = 1004
	ErCantCreateTable                                              = 1005
	ErCantCreateDb                                                 = 1006
	ErDbCreateExists                                               = 1007
	ErDbDropExists                                                 = 1008
	ErDbDropDelete                                                 = 1009
	ErDbDropRmdir                                                  = 1010
	ErCantDeleteFile                                               = 1011
	ErCantFindSystemRec                                            = 1012
	ErCantGetStat                                                  = 1013
	ErCantGetWd                                                    = 1014
	ErCantLock                                                     = 1015
	ErCantOpenFile                                                 = 1016
	ErFileNotFound                                                 = 1017
	ErCantReadDir                                                  = 1018
	ErCantSetWd                                                    = 1019
	ErCheckread                                                    = 1020
	ErDiskFull                                                     = 1021
	ErDupKey                                                       = 1022
	ErErrorOnClose                                                 = 1023
	ErErrorOnRead                                                  = 1024
	ErErrorOnRename                                                = 1025
	ErErrorOnWrite                                                 = 1026
	ErFileUsed                                                     = 1027
	ErFilsortAbort                                                 = 1028
	ErFormNotFound                                                 = 1029
	ErGetErrno                                                     = 1030
	ErIllegalHa                                                    = 1031
	ErKeyNotFound                                                  = 1032
	ErNotFormFile                                                  = 1033
	ErNotKeyfile                                                   = 1034
	ErOldKeyfile                                                   = 1035
	ErOpenAsReadonly                                               = 1036
	ErOutofmemory                                                  = 1037
	ErOutOfSortmemory                                              = 1038
	ErUnexpectedEOF                                                = 1039
	ErConCountError                                                = 1040
	ErOutOfResources                                               = 1041
	ErBadHostError                                                 = 1042
	ErHandshakeError                                               = 1043
	ErDbaccessDeniedError                                          = 1044
	ErAccessDeniedError                                            = 1045
	ErNoDbError                                                    = 1046
	ErUnknownComError                                              = 1047
	ErBadNullError                                                 = 1048
	ErBadDbError                                                   = 1049
	ErTableExistsError                                             = 1050
	ErBadTableError                                                = 1051
	ErNonUniqError                                                 = 1052
	ErServerShutdown                                               = 1053
	ErBadFieldError                                                = 1054
	ErWrongFieldWithGroup                                          = 1055
	ErWrongGroupField                                              = 1056
	ErWrongSumSelect                                               = 1057
	ErWrongValueCount                                              = 1058
	ErTooLongIdent                                                 = 1059
	ErDupFieldname                                                 = 1060
	ErDupKeyname                                                   = 1061
	ErDupEntry                                                     = 1062
	ErWrongFieldSpec                                               = 1063
	ErParseError                                                   = 1064
	ErEmptyQuery                                                   = 1065
	ErNonuniqTable                                                 = 1066
	ErInvalidDefault                                               = 1067
	ErMultiplePriKey                                               = 1068
	ErTooManyKeys                                                  = 1069
	ErTooManyKeyParts                                              = 1070
	ErTooLongKey                                                   = 1071
	ErKeyColumnDoesNotExits                                        = 1072
	ErBlobUsedAsKey                                                = 1073
	ErTooBigFieldlength                                            = 1074
	ErWrongAutoKey                                                 = 1075
	ErReady                                                        = 1076
	ErNormalShutdown                                               = 1077
	ErGotSignal                                                    = 1078
	ErShutdownComplete                                             = 1079
	ErForcingClose                                                 = 1080
	ErIpsockError                                                  = 1081
	ErNoSuchIndex                                                  = 1082
	ErWrongFieldTerminators                                        = 1083
	ErBlobsAndNoTerminated                                         = 1084
	ErTextfileNotReadable                                          = 1085
	ErFileExistsError                                              = 1086
	ErLoadInfo                                                     = 1087
	ErAlterInfo                                                    = 1088
	ErWrongSubKey                                                  = 1089
	ErCantRemoveAllFields                                          = 1090
	ErCantDropFieldOrKey                                           = 1091
	ErInsertInfo                                                   = 1092
	ErUpdateTableUsed                                              = 1093
	ErNoSuchThread                                                 = 1094
	ErKillDeniedError                                              = 1095
	ErNoTablesUsed                                                 = 1096
	ErTooBigSet                                                    = 1097
	ErNoUniqueLogfile                                              = 1098
	ErTableNotLockedForWrite                                       = 1099
	ErTableNotLocked                                               = 1100
	ErBlobCantHaveDefault                                          = 1101
	ErWrongDbName                                                  = 1102
	ErWrongTableName                                               = 1103
	ErTooBigSelect                                                 = 1104
	ErUnknownError                                                 = 1105
	ErUnknownProcedure                                             = 1106
	ErWrongParamcountToProcedure                                   = 1107
	ErWrongParametersToProcedure                                   = 1108
	ErUnknownTable                                                 = 1109
	ErFieldSpecifiedTwice                                          = 1110
	ErInvalidGroupFuncUse                                          = 1111
	ErUnsupportedExtension                                         = 1112
	ErTableMustHaveColumns                                         = 1113
	ErRecordFileFull                                               = 1114
	ErUnknownCharacterSet                                          = 1115
	ErTooManyTables                                                = 1116
	ErTooManyFields                                                = 1117
	ErTooBigRowsize                                                = 1118
	ErStackOverrun                                                 = 1119
	ErWrongOuterJoin                                               = 1120
	ErNullColumnInIndex                                            = 1121
	ErCantFindUdf                                                  = 1122
	ErCantInitializeUdf                                            = 1123
	ErUdfNoPaths                                                   = 1124
	ErUdfExists                                                    = 1125
	ErCantOpenLibrary                                              = 1126
	ErCantFindDlEntry                                              = 1127
	ErFunctionNotDefined                                           = 1128
	ErHostIsBlocked                                                = 1129
	ErHostNotPrivileged                                            = 1130
	ErPasswordAnonymousUser                                        = 1131
	ErPasswordNotAllowed                                           = 1132
	ErPasswordNoMatch                                              = 1133
	ErUpdateInfo                                                   = 1134
	ErCantCreateThread                                             = 1135
	ErWrongValueCountOnRow                                         = 1136
	ErCantReopenTable                                              = 1137
	ErInvalidUseOfNull                                             = 1138
	ErRegexpError                                                  = 1139
	ErMixOfGroupFuncAndFields                                      = 1140
	ErNonexistingGrant                                             = 1141
	ErTableaccessDeniedError                                       = 1142
	ErColumnaccessDeniedError                                      = 1143
	ErIllegalGrantForTable                                         = 1144
	ErGrantWrongHostOrUser                                         = 1145
	ErNoSuchTable                                                  = 1146
	ErNonexistingTableGrant                                        = 1147
	ErNotAllowedCommand                                            = 1148
	ErSyntaxError                                                  = 1149
	ErDelayedCantChangeLock                                        = 1150
	ErTooManyDelayedThreads                                        = 1151
	ErAbortingConnection                                           = 1152
	ErNetPacketTooLarge                                            = 1153
	ErNetReadErrorFromPipe                                         = 1154
	ErNetFcntlError                                                = 1155
	ErNetPacketsOutOfOrder                                         = 1156
	ErNetUncompressError                                           = 1157
	ErNetReadError                                                 = 1158
	ErNetReadInterrupted                                           = 1159
	ErNetErrorOnWrite                                              = 1160
	ErNetWriteInterrupted                                          = 1161
	ErTooLongString                                                = 1162
	ErTableCantHandleBlob                                          = 1163
	ErTableCantHandleAutoIncrement                                 = 1164
	ErDelayedInsertTableLocked                                     = 1165
	ErWrongColumnName                                              = 1166
	ErWrongKeyColumn                                               = 1167
	ErWrongMrgTable                                                = 1168
	ErDupUnique                                                    = 1169
	ErBlobKeyWithoutLength                                         = 1170
	ErPrimaryCantHaveNull                                          = 1171
	ErTooManyRows                                                  = 1172
	ErRequiresPrimaryKey                                           = 1173
	ErNoRaidCompiled                                               = 1174
	ErUpdateWithoutKeyInSafeMode                                   = 1175
	ErKeyDoesNotExits                                              = 1176
	ErCheckNoSuchTable                                             = 1177
	ErCheckNotImplemented                                          = 1178
	ErCantDoThisDuringAnTransaction                                = 1179
	ErErrorDuringCommit                                            = 1180
	ErErrorDuringRollback                                          = 1181
	ErErrorDuringFlushLogs                                         = 1182
	ErErrorDuringCheckpoint                                        = 1183
	ErNewAbortingConnection                                        = 1184
	ErDumpNotImplemented                                           = 1185
	ErFlushMasterBinlogClosed                                      = 1186
	ErIndexRebuild                                                 = 1187
	ErMaster                                                       = 1188
	ErMasterNetRead                                                = 1189
	ErMasterNetWrite                                               = 1190
	ErFtMatchingKeyNotFound                                        = 1191
	ErLockOrActiveTransaction                                      = 1192
	ErUnknownSystemVariable                                        = 1193
	ErCrashedOnUsage                                               = 1194
	ErCrashedOnRepair                                              = 1195
	ErWarningNotCompleteRollback                                   = 1196
	ErTransCacheFull                                               = 1197
	ErSlaveMustStop                                                = 1198
	ErSlaveNotRunning                                              = 1199
	ErBadSlave                                                     = 1200
	ErMasterInfo                                                   = 1201
	ErSlaveThread                                                  = 1202
	ErTooManyUserConnections                                       = 1203
	ErSetConstantsOnly                                             = 1204
	ErLockWaitTimeout                                              = 1205
	ErLockTableFull                                                = 1206
	ErReadOnlyTransaction                                          = 1207
	ErDropDbWithReadLock                                           = 1208
	ErCreateDbWithReadLock                                         = 1209
	ErWrongArguments                                               = 1210
	ErNoPermissionToCreateUser                                     = 1211
	ErUnionTablesInDifferentDir                                    = 1212
	ErLockDeadlock                                                 = 1213
	ErTableCantHandleFt                                            = 1214
	ErCannotAddForeign                                             = 1215
	ErNoReferencedRow                                              = 1216
	ErRowIsReferenced                                              = 1217
	ErConnectToMaster                                              = 1218
	ErQueryOnMaster                                                = 1219
	ErErrorWhenExecutingCommand                                    = 1220
	ErWrongUsage                                                   = 1221
	ErWrongNumberOfColumnsInSelect                                 = 1222
	ErCantUpdateWithReadlock                                       = 1223
	ErMixingNotAllowed                                             = 1224
	ErDupArgument                                                  = 1225
	ErUserLimitReached                                             = 1226
	ErSpecificAccessDeniedError                                    = 1227
	ErLocalVariable                                                = 1228
	ErGlobalVariable                                               = 1229
	ErNoDefault                                                    = 1230
	ErWrongValueForVar                                             = 1231
	ErWrongTypeForVar                                              = 1232
	ErVarCantBeRead                                                = 1233
	ErCantUseOptionHere                                            = 1234
	ErNotSupportedYet                                              = 1235
	ErMasterFatalErrorReadingBinlog                                = 1236
	ErSlaveIgnoredTable                                            = 1237
	ErIncorrectGlobalLocalVar                                      = 1238
	ErWrongFkDef                                                   = 1239
	ErKeyRefDoNotMatchTableRef                                     = 1240
	ErOperandColumns                                               = 1241
	ErSubqueryNo1Row                                               = 1242
	ErUnknownStmtHandler                                           = 1243
	ErCorruptHelpDb                                                = 1244
	ErCyclicReference                                              = 1245
	ErAutoConvert                                                  = 1246
	ErIllegalReference                                             = 1247
	ErDerivedMustHaveAlias                                         = 1248
	ErSelectReduced                                                = 1249
	ErTablenameNotAllowedHere                                      = 1250
	ErNotSupportedAuthMode                                         = 1251
	ErSpatialCantHaveNull                                          = 1252
	ErCollationCharsetMismatch                                     = 1253
	ErSlaveWasRunning                                              = 1254
	ErSlaveWasNotRunning                                           = 1255
	ErTooBigForUncompress                                          = 1256
	ErZlibZMemError                                                = 1257
	ErZlibZBufError                                                = 1258
	ErZlibZDataError                                               = 1259
	ErCutValueGroupConcat                                          = 1260
	ErWarnTooFewRecords                                            = 1261
	ErWarnTooManyRecords                                           = 1262
	ErWarnNullToNotnull                                            = 1263
	ErWarnDataOutOfRange                                           = 1264
	WarnDataTruncated                                              = 1265
	ErWarnUsingOtherHandler                                        = 1266
	ErCantAggregate2collations                                     = 1267
	ErDropUser                                                     = 1268
	ErRevokeGrants                                                 = 1269
	ErCantAggregate3collations                                     = 1270
	ErCantAggregateNcollations                                     = 1271
	ErVariableIsNotStruct                                          = 1272
	ErUnknownCollation                                             = 1273
	ErSlaveIgnoredSslParams                                        = 1274
	ErServerIsInSecureAuthMode                                     = 1275
	ErWarnFieldResolved                                            = 1276
	ErBadSlaveUntilCond                                            = 1277
	ErMissingSkipSlave                                             = 1278
	ErUntilCondIgnored                                             = 1279
	ErWrongNameForIndex                                            = 1280
	ErWrongNameForCatalog                                          = 1281
	ErWarnQcResize                                                 = 1282
	ErBadFtColumn                                                  = 1283
	ErUnknownKeyCache                                              = 1284
	ErWarnHostnameWontWork                                         = 1285
	ErUnknownStorageEngine                                         = 1286
	ErWarnDeprecatedSyntax                                         = 1287
	ErNonUpdatableTable                                            = 1288
	ErFeatureDisabled                                              = 1289
	ErOptionPreventsStatement                                      = 1290
	ErDuplicatedValueInType                                        = 1291
	ErTruncatedWrongValue                                          = 1292
	ErTooMuchAutoTimestampCols                                     = 1293
	ErInvalidOnUpdate                                              = 1294
	ErUnsupportedPs                                                = 1295
	ErGetErrmsg                                                    = 1296
	ErGetTemporaryErrmsg                                           = 1297
	ErUnknownTimeZone                                              = 1298
	ErWarnInvalidTimestamp                                         = 1299
	ErInvalidCharacterString                                       = 1300
	ErWarnAllowedPacketOverflowed                                  = 1301
	ErConflictingDeclarations                                      = 1302
	ErSpNoRecursiveCreate                                          = 1303
	ErSpAlreadyExists                                              = 1304
	ErSpDoesNotExist                                               = 1305
	ErSpDropFailed                                                 = 1306
	ErSpStoreFailed                                                = 1307
	ErSpLilabelMismatch                                            = 1308
	ErSpLabelRedefine                                              = 1309
	ErSpLabelMismatch                                              = 1310
	ErSpUninitVar                                                  = 1311
	ErSpBadselect                                                  = 1312
	ErSpBadreturn                                                  = 1313
	ErSpBadstatement                                               = 1314
	ErUpdateLogDeprecatedIgnored                                   = 1315
	ErUpdateLogDeprecatedTranslated                                = 1316
	ErQueryInterrupted                                             = 1317
	ErSpWrongNoOfArgs                                              = 1318
	ErSpCondMismatch                                               = 1319
	ErSpNoreturn                                                   = 1320
	ErSpNoreturnend                                                = 1321
	ErSpBadCursorQuery                                             = 1322
	ErSpBadCursorSelect                                            = 1323
	ErSpCursorMismatch                                             = 1324
	ErSpCursorAlreadyOpen                                          = 1325
	ErSpCursorNotOpen                                              = 1326
	ErSpUndeclaredVar                                              = 1327
	ErSpWrongNoOfFetchArgs                                         = 1328
	ErSpFetchNoData                                                = 1329
	ErSpDupParam                                                   = 1330
	ErSpDupVar                                                     = 1331
	ErSpDupCond                                                    = 1332
	ErSpDupCurs                                                    = 1333
	ErSpCantAlter                                                  = 1334
	ErSpSubselectNyi                                               = 1335
	ErStmtNotAllowedInSfOrTrg                                      = 1336
	ErSpVarcondAfterCurshndlr                                      = 1337
	ErSpCursorAfterHandler                                         = 1338
	ErSpCaseNotFound                                               = 1339
	ErFparserTooBigFile                                            = 1340
	ErFparserBadHeader                                             = 1341
	ErFparserEOFInComment                                          = 1342
	ErFparserErrorInParameter                                      = 1343
	ErFparserEOFInUnknownParameter                                 = 1344
	ErViewNoExplain                                                = 1345
	ErFrmUnknownType                                               = 1346
	ErWrongObject                                                  = 1347
	ErNonupdateableColumn                                          = 1348
	ErViewSelectDerived                                            = 1349
	ErViewSelectClause                                             = 1350
	ErViewSelectVariable                                           = 1351
	ErViewSelectTmptable                                           = 1352
	ErViewWrongList                                                = 1353
	ErWarnViewMerge                                                = 1354
	ErWarnViewWithoutKey                                           = 1355
	ErViewInvalid                                                  = 1356
	ErSpNoDropSp                                                   = 1357
	ErSpGotoInHndlr                                                = 1358
	ErTrgAlreadyExists                                             = 1359
	ErTrgDoesNotExist                                              = 1360
	ErTrgOnViewOrTempTable                                         = 1361
	ErTrgCantChangeRow                                             = 1362
	ErTrgNoSuchRowInTrg                                            = 1363
	ErNoDefaultForField                                            = 1364
	ErDivisionByZero                                               = 1365
	ErTruncatedWrongValueForField                                  = 1366
	ErIllegalValueForType                                          = 1367
	ErViewNonupdCheck                                              = 1368
	ErViewCheckFailed                                              = 1369
	ErProcaccessDeniedError                                        = 1370
	ErRelayLogFail                                                 = 1371
	ErPasswdLength                                                 = 1372
	ErUnknownTargetBinlog                                          = 1373
	ErIoErrLogIndexRead                                            = 1374
	ErBinlogPurgeProhibited                                        = 1375
	ErFseekFail                                                    = 1376
	ErBinlogPurgeFatalErr                                          = 1377
	ErLogInUse                                                     = 1378
	ErLogPurgeUnknownErr                                           = 1379
	ErRelayLogInit                                                 = 1380
	ErNoBinaryLogging                                              = 1381
	ErReservedSyntax                                               = 1382
	ErWsasFailed                                                   = 1383
	ErDiffGroupsProc                                               = 1384
	ErNoGroupForProc                                               = 1385
	ErOrderWithProc                                                = 1386
	ErLoggingProhibitChangingOf                                    = 1387
	ErNoFileMapping                                                = 1388
	ErWrongMagic                                                   = 1389
	ErPsManyParam                                                  = 1390
	ErKeyPart0                                                     = 1391
	ErViewChecksum                                                 = 1392
	ErViewMultiupdate                                              = 1393
	ErViewNoInsertFieldList                                        = 1394
	ErViewDeleteMergeView                                          = 1395
	ErCannotUser                                                   = 1396
	ErXaerNota                                                     = 1397
	ErXaerInval                                                    = 1398
	ErXaerRmfail                                                   = 1399
	ErXaerOutside                                                  = 1400
	ErXaerRmerr                                                    = 1401
	ErXaRbrollback                                                 = 1402
	ErNonexistingProcGrant                                         = 1403
	ErProcAutoGrantFail                                            = 1404
	ErProcAutoRevokeFail                                           = 1405
	ErDataTooLong                                                  = 1406
	ErSpBadSQLstate                                                = 1407
	ErStartup                                                      = 1408
	ErLoadFromFixedSizeRowsToVar                                   = 1409
	ErCantCreateUserWithGrant                                      = 1410
	ErWrongValueForType                                            = 1411
	ErTableDefChanged                                              = 1412
	ErSpDupHandler                                                 = 1413
	ErSpNotVarArg                                                  = 1414
	ErSpNoRetset                                                   = 1415
	ErCantCreateGeometryObject                                     = 1416
	ErFailedRoutineBreakBinlog                                     = 1417
	ErBinlogUnsafeRoutine                                          = 1418
	ErBinlogCreateRoutineNeedSuper                                 = 1419
	ErExecStmtWithOpenCursor                                       = 1420
	ErStmtHasNoOpenCursor                                          = 1421
	ErCommitNotAllowedInSfOrTrg                                    = 1422
	ErNoDefaultForViewField                                        = 1423
	ErSpNoRecursion                                                = 1424
	ErTooBigScale                                                  = 1425
	ErTooBigPrecision                                              = 1426
	ErMBiggerThanD                                                 = 1427
	ErWrongLockOfSystemTable                                       = 1428
	ErConnectToForeignDataSource                                   = 1429
	ErQueryOnForeignDataSource                                     = 1430
	ErForeignDataSourceDoesntExist                                 = 1431
	ErForeignDataStringInvalidCantCreate                           = 1432
	ErForeignDataStringInvalid                                     = 1433
	ErCantCreateFederatedTable                                     = 1434
	ErTrgInWrongSchema                                             = 1435
	ErStackOverrunNeedMore                                         = 1436
	ErTooLongBody                                                  = 1437
	ErWarnCantDropDefaultKeycache                                  = 1438
	ErTooBigDisplaywidth                                           = 1439
	ErXaerDupid                                                    = 1440
	ErDatetimeFunctionOverflow                                     = 1441
	ErCantUpdateUsedTableInSfOrTrg                                 = 1442
	ErViewPreventUpdate                                            = 1443
	ErPsNoRecursion                                                = 1444
	ErSpCantSetAutocommit                                          = 1445
	ErMalformedDefiner                                             = 1446
	ErViewFrmNoUser                                                = 1447
	ErViewOtherUser                                                = 1448
	ErNoSuchUser                                                   = 1449
	ErForbidSchemaChange                                           = 1450
	ErRowIsReferenced2                                             = 1451
	ErNoReferencedRow2                                             = 1452
	ErSpBadVarShadow                                               = 1453
	ErTrgNoDefiner                                                 = 1454
	ErOldFileFormat                                                = 1455
	ErSpRecursionLimit                                             = 1456
	ErSpProcTableCorrupt                                           = 1457
	ErSpWrongName                                                  = 1458
	ErTableNeedsUpgrade                                            = 1459
	ErSpNoAggregate                                                = 1460
	ErMaxPreparedStmtCountReached                                  = 1461
	ErViewRecursive                                                = 1462
	ErNonGroupingFieldUsed                                         = 1463
	ErTableCantHandleSpkeys                                        = 1464
	ErNoTriggersOnSystemSchema                                     = 1465
	ErRemovedSpaces                                                = 1466
	ErAutoincReadFailed                                            = 1467
	ErUsername                                                     = 1468
	ErHostname                                                     = 1469
	ErWrongStringLength                                            = 1470
	ErNonInsertableTable                                           = 1471
	ErAdminWrongMrgTable                                           = 1472
	ErTooHighLevelOfNestingForSelect                               = 1473
	ErNameBecomesEmpty                                             = 1474
	ErAmbiguousFieldTerm                                           = 1475
	ErForeignServerExists                                          = 1476
	ErForeignServerDoesntExist                                     = 1477
	ErIllegalHaCreateOption                                        = 1478
	ErPartitionRequiresValuesError                                 = 1479
	ErPartitionWrongValuesError                                    = 1480
	ErPartitionMaxvalueError                                       = 1481
	ErPartitionSubpartitionError                                   = 1482
	ErPartitionSubpartMixError                                     = 1483
	ErPartitionWrongNoPartError                                    = 1484
	ErPartitionWrongNoSubpartError                                 = 1485
	ErWrongExprInPartitionFuncError                                = 1486
	ErNoConstExprInRangeOrListError                                = 1487
	ErFieldNotFoundPartError                                       = 1488
	ErListOfFieldsOnlyInHashError                                  = 1489
	ErInconsistentPartitionInfoError                               = 1490
	ErPartitionFuncNotAllowedError                                 = 1491
	ErPartitionsMustBeDefinedError                                 = 1492
	ErRangeNotIncreasingError                                      = 1493
	ErInconsistentTypeOfFunctionsError                             = 1494
	ErMultipleDefConstInListPartError                              = 1495
	ErPartitionEntryError                                          = 1496
	ErMixHandlerError                                              = 1497
	ErPartitionNotDefinedError                                     = 1498
	ErTooManyPartitionsError                                       = 1499
	ErSubpartitionError                                            = 1500
	ErCantCreateHandlerFile                                        = 1501
	ErBlobFieldInPartFuncError                                     = 1502
	ErUniqueKeyNeedAllFieldsInPf                                   = 1503
	ErNoPartsError                                                 = 1504
	ErPartitionMgmtOnNonpartitioned                                = 1505
	ErForeignKeyOnPartitioned                                      = 1506
	ErDropPartitionNonExistent                                     = 1507
	ErDropLastPartition                                            = 1508
	ErCoalesceOnlyOnHashPartition                                  = 1509
	ErReorgHashOnlyOnSameNo                                        = 1510
	ErReorgNoParamError                                            = 1511
	ErOnlyOnRangeListPartition                                     = 1512
	ErAddPartitionSubpartError                                     = 1513
	ErAddPartitionNoNewPartition                                   = 1514
	ErCoalescePartitionNoPartition                                 = 1515
	ErReorgPartitionNotExist                                       = 1516
	ErSameNamePartition                                            = 1517
	ErNoBinlogError                                                = 1518
	ErConsecutiveReorgPartitions                                   = 1519
	ErReorgOutsideRange                                            = 1520
	ErPartitionFunctionFailure                                     = 1521
	ErPartStateError                                               = 1522
	ErLimitedPartRange                                             = 1523
	ErPluginIsNotLoaded                                            = 1524
	ErWrongValue                                                   = 1525
	ErNoPartitionForGivenValue                                     = 1526
	ErFilegroupOptionOnlyOnce                                      = 1527
	ErCreateFilegroupFailed                                        = 1528
	ErDropFilegroupFailed                                          = 1529
	ErTablespaceAutoExtendError                                    = 1530
	ErWrongSizeNumber                                              = 1531
	ErSizeOverflowError                                            = 1532
	ErAlterFilegroupFailed                                         = 1533
	ErBinlogRowLoggingFailed                                       = 1534
	ErBinlogRowWrongTableDef                                       = 1535
	ErBinlogRowRbrToSbr                                            = 1536
	ErEventAlreadyExists                                           = 1537
	ErEventStoreFailed                                             = 1538
	ErEventDoesNotExist                                            = 1539
	ErEventCantAlter                                               = 1540
	ErEventDropFailed                                              = 1541
	ErEventIntervalNotPositiveOrTooBig                             = 1542
	ErEventEndsBeforeStarts                                        = 1543
	ErEventExecTimeInThePast                                       = 1544
	ErEventOpenTableFailed                                         = 1545
	ErEventNeitherMExprNorMAt                                      = 1546
	ErObsoleteColCountDoesntMatchCorrupted                         = 1547
	ErObsoleteCannotLoadFromTable                                  = 1548
	ErEventCannotDelete                                            = 1549
	ErEventCompileError                                            = 1550
	ErEventSameName                                                = 1551
	ErEventDataTooLong                                             = 1552
	ErDropIndexFk                                                  = 1553
	ErWarnDeprecatedSyntaxWithVer                                  = 1554
	ErCantWriteLockLogTable                                        = 1555
	ErCantLockLogTable                                             = 1556
	ErForeignDuplicateKeyOldUnused                                 = 1557
	ErColCountDoesntMatchPleaseUpdate                              = 1558
	ErTempTablePreventsSwitchOutOfRbr                              = 1559
	ErStoredFunctionPreventsSwitchBinlogFormat                     = 1560
	ErNdbCantSwitchBinlogFormat                                    = 1561
	ErPartitionNoTemporary                                         = 1562
	ErPartitionConstDomainError                                    = 1563
	ErPartitionFunctionIsNotAllowed                                = 1564
	ErDdlLogError                                                  = 1565
	ErNullInValuesLessThan                                         = 1566
	ErWrongPartitionName                                           = 1567
	ErCantChangeTxCharacteristics                                  = 1568
	ErDupEntryAutoincrementCase                                    = 1569
	ErEventModifyQueueError                                        = 1570
	ErEventSetVarError                                             = 1571
	ErPartitionMergeError                                          = 1572
	ErCantActivateLog                                              = 1573
	ErRbrNotAvailable                                              = 1574
	ErBase64DecodeError                                            = 1575
	ErEventRecursionForbidden                                      = 1576
	ErEventsDbError                                                = 1577
	ErOnlyIntegersAllowed                                          = 1578
	ErUnsuportedLogEngine                                          = 1579
	ErBadLogStatement                                              = 1580
	ErCantRenameLogTable                                           = 1581
	ErWrongParamcountToNativeFct                                   = 1582
	ErWrongParametersToNativeFct                                   = 1583
	ErWrongParametersToStoredFct                                   = 1584
	ErNativeFctNameCollision                                       = 1585
	ErDupEntryWithKeyName                                          = 1586
	ErBinlogPurgeEmfile                                            = 1587
	ErEventCannotCreateInThePast                                   = 1588
	ErEventCannotAlterInThePast                                    = 1589
	ErSlaveIncident                                                = 1590
	ErNoPartitionForGivenValueSilent                               = 1591
	ErBinlogUnsafeStatement                                        = 1592
	ErSlaveFatalError                                              = 1593
	ErSlaveRelayLogReadFailure                                     = 1594
	ErSlaveRelayLogWriteFailure                                    = 1595
	ErSlaveCreateEventFailure                                      = 1596
	ErSlaveMasterComFailure                                        = 1597
	ErBinlogLoggingImpossible                                      = 1598
	ErViewNoCreationCtx                                            = 1599
	ErViewInvalidCreationCtx                                       = 1600
	ErSrInvalidCreationCtx                                         = 1601
	ErTrgCorruptedFile                                             = 1602
	ErTrgNoCreationCtx                                             = 1603
	ErTrgInvalidCreationCtx                                        = 1604
	ErEventInvalidCreationCtx                                      = 1605
	ErTrgCantOpenTable                                             = 1606
	ErCantCreateSroutine                                           = 1607
	ErNeverUsed                                                    = 1608
	ErNoFormatDescriptionEventBeforeBinlogStatement                = 1609
	ErSlaveCorruptEvent                                            = 1610
	ErLoadDataInvalidColumn                                        = 1611
	ErLogPurgeNoFile                                               = 1612
	ErXaRbtimeout                                                  = 1613
	ErXaRbdeadlock                                                 = 1614
	ErNeedReprepare                                                = 1615
	ErDelayedNotSupported                                          = 1616
	WarnNoMasterInfo                                               = 1617
	WarnOptionIgnored                                              = 1618
	WarnPluginDeleteBuiltin                                        = 1619
	WarnPluginBusy                                                 = 1620
	ErVariableIsReadonly                                           = 1621
	ErWarnEngineTransactionRollback                                = 1622
	ErSlaveHeartbeatFailure                                        = 1623
	ErSlaveHeartbeatValueOutOfRange                                = 1624
	ErNdbReplicationSchemaError                                    = 1625
	ErConflictFnParseError                                         = 1626
	ErExceptionsWriteError                                         = 1627
	ErTooLongTableComment                                          = 1628
	ErTooLongFieldComment                                          = 1629
	ErFuncInexistentNameCollision                                  = 1630
	ErDatabaseName                                                 = 1631
	ErTableName                                                    = 1632
	ErPartitionName                                                = 1633
	ErSubpartitionName                                             = 1634
	ErTemporaryName                                                = 1635
	ErRenamedName                                                  = 1636
	ErTooManyConcurrentTrxs                                        = 1637
	WarnNonASCIISeparatorNotImplemented                            = 1638
	ErDebugSyncTimeout                                             = 1639
	ErDebugSyncHitLimit                                            = 1640
	ErDupSignalSet                                                 = 1641
	ErSignalWarn                                                   = 1642
	ErSignalNotFound                                               = 1643
	ErSignalException                                              = 1644
	ErResignalWithoutActiveHandler                                 = 1645
	ErSignalBadConditionType                                       = 1646
	WarnCondItemTruncated                                          = 1647
	ErCondItemTooLong                                              = 1648
	ErUnknownLocale                                                = 1649
	ErSlaveIgnoreServerIds                                         = 1650
	ErQueryCacheDisabled                                           = 1651
	ErSameNamePartitionField                                       = 1652
	ErPartitionColumnListError                                     = 1653
	ErWrongTypeColumnValueError                                    = 1654
	ErTooManyPartitionFuncFieldsError                              = 1655
	ErMaxvalueInValuesIn                                           = 1656
	ErTooManyValuesError                                           = 1657
	ErRowSinglePartitionFieldError                                 = 1658
	ErFieldTypeNotAllowedAsPartitionField                          = 1659
	ErPartitionFieldsTooLong                                       = 1660
	ErBinlogRowEngineAndStmtEngine                                 = 1661
	ErBinlogRowModeAndStmtEngine                                   = 1662
	ErBinlogUnsafeAndStmtEngine                                    = 1663
	ErBinlogRowInjectionAndStmtEngine                              = 1664
	ErBinlogStmtModeAndRowEngine                                   = 1665
	ErBinlogRowInjectionAndStmtMode                                = 1666
	ErBinlogMultipleEnginesAndSelfLoggingEngine                    = 1667
	ErBinlogUnsafeLimit                                            = 1668
	ErBinlogUnsafeInsertDelayed                                    = 1669
	ErBinlogUnsafeSystemTable                                      = 1670
	ErBinlogUnsafeAutoincColumns                                   = 1671
	ErBinlogUnsafeUdf                                              = 1672
	ErBinlogUnsafeSystemVariable                                   = 1673
	ErBinlogUnsafeSystemFunction                                   = 1674
	ErBinlogUnsafeNontransAfterTrans                               = 1675
	ErMessageAndStatement                                          = 1676
	ErSlaveConversionFailed                                        = 1677
	ErSlaveCantCreateConversion                                    = 1678
	ErInsideTransactionPreventsSwitchBinlogFormat                  = 1679
	ErPathLength                                                   = 1680
	ErWarnDeprecatedSyntaxNoReplacement                            = 1681
	ErWrongNativeTableStructure                                    = 1682
	ErWrongPerfschemaUsage                                         = 1683
	ErWarnISSkippedTable                                           = 1684
	ErInsideTransactionPreventsSwitchBinlogDirect                  = 1685
	ErStoredFunctionPreventsSwitchBinlogDirect                     = 1686
	ErSpatialMustHaveGeomCol                                       = 1687
	ErTooLongIndexComment                                          = 1688
	ErLockAborted                                                  = 1689
	ErDataOutOfRange                                               = 1690
	ErWrongSpvarTypeInLimit                                        = 1691
	ErBinlogUnsafeMultipleEnginesAndSelfLoggingEngine              = 1692
	ErBinlogUnsafeMixedStatement                                   = 1693
	ErInsideTransactionPreventsSwitchSQLLogBin                     = 1694
	ErStoredFunctionPreventsSwitchSQLLogBin                        = 1695
	ErFailedReadFromParFile                                        = 1696
	ErValuesIsNotIntTypeError                                      = 1697
	ErAccessDeniedNoPasswordError                                  = 1698
	ErSetPasswordAuthPlugin                                        = 1699
	ErGrantPluginUserExists                                        = 1700
	ErTruncateIllegalFk                                            = 1701
	ErPluginIsPermanent                                            = 1702
	ErSlaveHeartbeatValueOutOfRangeMin                             = 1703
	ErSlaveHeartbeatValueOutOfRangeMax                             = 1704
	ErStmtCacheFull                                                = 1705
	ErMultiUpdateKeyConflict                                       = 1706
	ErTableNeedsRebuild                                            = 1707
	WarnOptionBelowLimit                                           = 1708
	ErIndexColumnTooLong                                           = 1709
	ErErrorInTriggerBody                                           = 1710
	ErErrorInUnknownTriggerBody                                    = 1711
	ErIndexCorrupt                                                 = 1712
	ErUndoRecordTooBig                                             = 1713
	ErBinlogUnsafeInsertIgnoreSelect                               = 1714
	ErBinlogUnsafeInsertSelectUpdate                               = 1715
	ErBinlogUnsafeReplaceSelect                                    = 1716
	ErBinlogUnsafeCreateIgnoreSelect                               = 1717
	ErBinlogUnsafeCreateReplaceSelect                              = 1718
	ErBinlogUnsafeUpdateIgnore                                     = 1719
	ErPluginNoUninstall                                            = 1720
	ErPluginNoInstall                                              = 1721
	ErBinlogUnsafeWriteAutoincSelect                               = 1722
	ErBinlogUnsafeCreateSelectAutoinc                              = 1723
	ErBinlogUnsafeInsertTwoKeys                                    = 1724
	ErTableInFkCheck                                               = 1725
	ErUnsupportedEngine                                            = 1726
	ErBinlogUnsafeAutoincNotFirst                                  = 1727
	ErCannotLoadFromTableV2                                        = 1728
	ErMasterDelayValueOutOfRange                                   = 1729
	ErOnlyFdAndRbrEventsAllowedInBinlogStatement                   = 1730
	ErPartitionExchangeDifferentOption                             = 1731
	ErPartitionExchangePartTable                                   = 1732
	ErPartitionExchangeTempTable                                   = 1733
	ErPartitionInsteadOfSubpartition                               = 1734
	ErUnknownPartition                                             = 1735
	ErTablesDifferentMetadata                                      = 1736
	ErRowDoesNotMatchPartition                                     = 1737
	ErBinlogCacheSizeGreaterThanMax                                = 1738
	ErWarnIndexNotApplicable                                       = 1739
	ErPartitionExchangeForeignKey                                  = 1740
	ErNoSuchKeyValue                                               = 1741
	ErRplInfoDataTooLong                                           = 1742
	ErNetworkReadEventChecksumFailure                              = 1743
	ErBinlogReadEventChecksumFailure                               = 1744
	ErBinlogStmtCacheSizeGreaterThanMax                            = 1745
	ErCantUpdateTableInCreateTableSelect                           = 1746
	ErPartitionClauseOnNonpartitioned                              = 1747
	ErRowDoesNotMatchGivenPartitionSet                             = 1748
	ErNoSuchPartitionunused                                        = 1749
	ErChangeRplInfoRepositoryFailure                               = 1750
	ErWarningNotCompleteRollbackWithCreatedTempTable               = 1751
	ErWarningNotCompleteRollbackWithDroppedTempTable               = 1752
	ErMtsFeatureIsNotSupported                                     = 1753
	ErMtsUpdatedDbsGreaterMax                                      = 1754
	ErMtsCantParallel                                              = 1755
	ErMtsInconsistentData                                          = 1756
	ErFulltextNotSupportedWithPartitioning                         = 1757
	ErDaInvalidConditionNumber                                     = 1758
	ErInsecurePlainText                                            = 1759
	ErInsecureChangeMaster                                         = 1760
	ErForeignDuplicateKeyWithChildInfo                             = 1761
	ErForeignDuplicateKeyWithoutChildInfo                          = 1762
	ErSQLthreadWithSecureSlave                                     = 1763
	ErTableHasNoFt                                                 = 1764
	ErVariableNotSettableInSfOrTrigger                             = 1765
	ErVariableNotSettableInTransaction                             = 1766
	ErGtidNextIsNotInGtidNextList                                  = 1767
	ErCantChangeGtidNextInTransactionWhenGtidNextListIsNull        = 1768
	ErSetStatementCannotInvokeFunction                             = 1769
	ErGtidNextCantBeAutomaticIfGtidNextListIsNonNull               = 1770
	ErSkippingLoggedTransaction                                    = 1771
	ErMalformedGtidSetSpecification                                = 1772
	ErMalformedGtidSetEncoding                                     = 1773
	ErMalformedGtidSpecification                                   = 1774
	ErGnoExhausted                                                 = 1775
	ErBadSlaveAutoPosition                                         = 1776
	ErAutoPositionRequiresGtidModeOn                               = 1777
	ErCantDoImplicitCommitInTrxWhenGtidNextIsSet                   = 1778
	ErGtidMode2Or3RequiresEnforceGtidConsistencyOn                 = 1779
	ErGtidModeRequiresBinlog                                       = 1780
	ErCantSetGtidNextToGtidWhenGtidModeIsOff                       = 1781
	ErCantSetGtidNextToAnonymousWhenGtidModeIsOn                   = 1782
	ErCantSetGtidNextListToNonNullWhenGtidModeIsOff                = 1783
	ErFoundGtidEventWhenGtidModeIsOff                              = 1784
	ErGtidUnsafeNonTransactionalTable                              = 1785
	ErGtidUnsafeCreateSelect                                       = 1786
	ErGtidUnsafeCreateDropTemporaryTableInTransaction              = 1787
	ErGtidModeCanOnlyChangeOneStepAtATime                          = 1788
	ErMasterHasPurgedRequiredGtids                                 = 1789
	ErCantSetGtidNextWhenOwningGtid                                = 1790
	ErUnknownExplainFormat                                         = 1791
	ErCantExecuteInReadOnlyTransaction                             = 1792
	ErTooLongTablePartitionComment                                 = 1793
	ErSlaveConfiguration                                           = 1794
	ErInnodbFtLimit                                                = 1795
	ErInnodbNoFtTempTable                                          = 1796
	ErInnodbFtWrongDocidColumn                                     = 1797
	ErInnodbFtWrongDocidIndex                                      = 1798
	ErInnodbOnlineLogTooBig                                        = 1799
	ErUnknownAlterAlgorithm                                        = 1800
	ErUnknownAlterLock                                             = 1801
	ErMtsChangeMasterCantRunWithGaps                               = 1802
	ErMtsRecoveryFailure                                           = 1803
	ErMtsResetWorkers                                              = 1804
	ErColCountDoesntMatchCorruptedV2                               = 1805
	ErSlaveSilentRetryTransaction                                  = 1806
	ErDiscardFkChecksRunning                                       = 1807
	ErTableSchemaMismatch                                          = 1808
	ErTableInSystemTablespace                                      = 1809
	ErIoReadError                                                  = 1810
	ErIoWriteError                                                 = 1811
	ErTablespaceMissing                                            = 1812
	ErTablespaceExists                                             = 1813
	ErTablespaceDiscarded                                          = 1814
	ErInternalError                                                = 1815
	ErInnodbImportError                                            = 1816
	ErInnodbIndexCorrupt                                           = 1817
	ErInvalidYearColumnLength                                      = 1818
	ErNotValidPassword                                             = 1819
	ErMustChangePassword                                           = 1820
	ErFkNoIndexChild                                               = 1821
	ErFkNoIndexParent                                              = 1822
	ErFkFailAddSystem                                              = 1823
	ErFkCannotOpenParent                                           = 1824
	ErFkIncorrectOption                                            = 1825
	ErFkDupName                                                    = 1826
	ErPasswordFormat                                               = 1827
	ErFkColumnCannotDrop                                           = 1828
	ErFkColumnCannotDropChild                                      = 1829
	ErFkColumnNotNull                                              = 1830
	ErDupIndex                                                     = 1831
	ErFkColumnCannotChange                                         = 1832
	ErFkColumnCannotChangeChild                                    = 1833
	ErFkCannotDeleteParent                                         = 1834
	ErMalformedPacket                                              = 1835
	ErReadOnlyMode                                                 = 1836
	ErGtidNextTypeUndefinedGroup                                   = 1837
	ErVariableNotSettableInSp                                      = 1838
	ErCantSetGtidPurgedWhenGtidModeIsOff                           = 1839
	ErCantSetGtidPurgedWhenGtidExecutedIsNotEmpty                  = 1840
	ErCantSetGtidPurgedWhenOwnedGtidsIsNotEmpty                    = 1841
	ErGtidPurgedWasChanged                                         = 1842
	ErGtidExecutedWasChanged                                       = 1843
	ErBinlogStmtModeAndNoReplTables                                = 1844
	ErAlterOperationNotSupported                                   = 1845
	ErAlterOperationNotSupportedReason                             = 1846
	ErAlterOperationNotSupportedReasonCopy                         = 1847
	ErAlterOperationNotSupportedReasonPartition                    = 1848
	ErAlterOperationNotSupportedReasonFkRename                     = 1849
	ErAlterOperationNotSupportedReasonColumnType                   = 1850
	ErAlterOperationNotSupportedReasonFkCheck                      = 1851
	ErAlterOperationNotSupportedReasonIgnore                       = 1852
	ErAlterOperationNotSupportedReasonNopk                         = 1853
	ErAlterOperationNotSupportedReasonAutoinc                      = 1854
	ErAlterOperationNotSupportedReasonHiddenFts                    = 1855
	ErAlterOperationNotSupportedReasonChangeFts                    = 1856
	ErAlterOperationNotSupportedReasonFts                          = 1857
	ErSQLSlaveSkipCounterNotSettableInGtidMode                     = 1858
	ErDupUnknownInIndex                                            = 1859
	ErIdentCausesTooLongPath                                       = 1860
	ErAlterOperationNotSupportedReasonNotNull                      = 1861
	ErMustChangePasswordLogin                                      = 1862
	ErRowInWrongPartition                                          = 1863
	ErErrorLast                                                    = 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 (
	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 (
	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")
)

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.UTC)

	// 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.UTC)
	// MaxDatetime is the maximum for mysql datetime type.
	MaxDatetime = time.Date(9999, 12, 31, 23, 59, 59, 999999, time.UTC)

	// 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)
)
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 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 ZeroDecimal = NewDecimalFromInt(0, 1)

ZeroDecimal is zero constant, to make computations faster.

Functions

func AdjustYear

func AdjustYear(y int) (int, error)

AdjustYear is used for adjusting year and checking its validation.

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.

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 ParseYear

func ParseYear(str string) (int16, error)

ParseYear parses a formatted string and returns a year number.

Types

type Decimal

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

Decimal represents a fixed-point decimal. It is immutable. number = value * 10 ^ exp

func ConvertToDecimal

func ConvertToDecimal(value interface{}) (Decimal, error)

ConvertToDecimal converts interface to decimal.

func NewDecimalFromFloat

func NewDecimalFromFloat(value float64) Decimal

NewDecimalFromFloat converts a float64 to Decimal.

Example:

NewDecimalFromFloat(123.45678901234567).String() // output: "123.4567890123456"
NewDecimalFromFloat(.00000000000000001).String() // output: "0.00000000000000001"

NOTE: this will panic on NaN, +/-inf.

func NewDecimalFromFloatWithExponent

func NewDecimalFromFloatWithExponent(value float64, exp int32) Decimal

NewDecimalFromFloatWithExponent converts a float64 to Decimal, with an arbitrary number of fractional digits.

Example:

NewDecimalFromFloatWithExponent(123.456, -2).String() // output: "123.46"

func NewDecimalFromInt

func NewDecimalFromInt(value int64, exp int32) Decimal

NewDecimalFromInt returns a new fixed-point decimal, value * 10 ^ exp.

func NewDecimalFromUint

func NewDecimalFromUint(value uint64, exp int32) Decimal

NewDecimalFromUint returns a new fixed-point decimal, value * 10 ^ exp.

func ParseDecimal

func ParseDecimal(value string) (Decimal, error)

ParseDecimal returns a new Decimal from a string representation.

Example:

d, err := ParseDecimal("-123.45")
d2, err := ParseDecimal(".0001")

func (Decimal) Abs

func (d Decimal) Abs() Decimal

Abs returns the absolute value of the decimal.

func (Decimal) Add

func (d Decimal) Add(d2 Decimal) Decimal

Add returns d + d2.

func (Decimal) Ceil

func (d Decimal) Ceil() Decimal

Ceil returns the nearest integer value greater than or equal to d.

func (Decimal) Cmp

func (d Decimal) Cmp(d2 Decimal) int

Cmp compares the numbers represented by d and d2, and returns:

-1 if d <  d2
 0 if d == d2
+1 if d >  d2

func (Decimal) Div

func (d Decimal) Div(d2 Decimal) Decimal

Div returns d / d2. If it doesn't divide exactly, the result will have DivisionPrecision digits after the decimal point.

func (Decimal) Equals

func (d Decimal) Equals(d2 Decimal) bool

Equals returns whether the numbers represented by d and d2 are equal.

func (Decimal) Exponent

func (d Decimal) Exponent() int32

Exponent returns the exponent, or scale component of the decimal.

func (Decimal) Float64

func (d Decimal) Float64() (f float64, exact bool)

Float64 returns the nearest float64 value for d and a bool indicating whether f represents d exactly. For more details, see the documentation for big.Rat.Float64.

func (Decimal) Floor

func (d Decimal) Floor() Decimal

Floor returns the nearest integer value less than or equal to d.

func (Decimal) FracDigits

func (d Decimal) FracDigits() int32

FracDigits returns the number of fractional digits of the decimal.

func (Decimal) IntPart

func (d Decimal) IntPart() int64

IntPart returns the integer component of the decimal.

func (Decimal) MarshalJSON

func (d Decimal) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (Decimal) MarshalText

func (d Decimal) MarshalText() (text []byte, err error)

MarshalText implements the encoding.TextMarshaler interface for XML serialization.

func (Decimal) Mul

func (d Decimal) Mul(d2 Decimal) Decimal

Mul returns d * d2.

func (Decimal) Rat

func (d Decimal) Rat() *big.Rat

Rat returns a rational number representation of the decimal.

func (Decimal) Round

func (d Decimal) Round(places int32) Decimal

Round rounds the decimal to places decimal places. If places < 0, it will round the integer part to the nearest 10^(-places).

Example:

NewFromFloat(5.45).Round(1).String() // output: "5.5"
NewFromFloat(545).Round(-1).String() // output: "550"

func (*Decimal) Scan

func (d *Decimal) Scan(value interface{}) error

Scan implements the sql.Scanner interface for database deserialization.

func (Decimal) String

func (d Decimal) String() string

String returns the string representation of the decimal with the fixed point.

Example:

d := New(-12345, -3)
println(d.String())

Output:

-12.345

func (Decimal) StringFixed

func (d Decimal) StringFixed(places int32) string

StringFixed returns a rounded fixed-point string with places digits after the decimal point.

Example:

NewFromFloat(0).StringFixed(2) // output: "0.00"
NewFromFloat(0).StringFixed(0) // output: "0"
NewFromFloat(5.45).StringFixed(0) // output: "5"
NewFromFloat(5.45).StringFixed(1) // output: "5.5"
NewFromFloat(5.45).StringFixed(2) // output: "5.45"
NewFromFloat(5.45).StringFixed(3) // output: "5.450"
NewFromFloat(545).StringFixed(-1) // output: "550"

func (Decimal) StringScaled

func (d Decimal) StringScaled(exp int32) string

StringScaled first scales the decimal then calls .String() on it. NOTE: buggy, unintuitive, and DEPRECATED! Use StringFixed instead.

func (Decimal) Sub

func (d Decimal) Sub(d2 Decimal) Decimal

Sub returns d - d2.

func (Decimal) Truncate

func (d Decimal) Truncate(precision int32) Decimal

Truncate truncates off digits from the number, without rounding.

NOTE: precision is the last digit that will not be truncated (must be >= 0).

Example:

decimal.NewFromString("123.456").Truncate(2).String() // "123.45"

func (*Decimal) UnmarshalJSON

func (d *Decimal) UnmarshalJSON(decimalBytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*Decimal) UnmarshalText

func (d *Decimal) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for XML deserialization.

func (Decimal) Value

func (d Decimal) Value() (driver.Value, error)

Value implements the driver.Valuer interface for database serialization.

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() Decimal

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

type SQLError

type SQLError struct {
	Code    uint16
	Message string
	State   string
}

SQLError records an error information, from executing SQL.

func NewDefaultError

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

NewDefaultError generates a SQL error, with an error code and extra arguments for a message format specifier.

func NewError

func NewError(errCode uint16, message string) *SQLError

NewError creates a SQL error, with an error code and error details.

func (*SQLError) Error

func (e *SQLError) Error() string

Error prints errors, with a formatted string.

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 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 seperated 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 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) IsZero

func (t Time) IsZero() bool

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

func (Time) Marshal

func (t Time) Marshal() ([]byte, error)

Marshal returns the binary encoding of time.

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() Decimal

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

func (*Time) Unmarshal

func (t *Time) Unmarshal(b []byte) error

Unmarshal decodes the binary data into Time with current local time.

func (*Time) UnmarshalInLocation

func (t *Time) UnmarshalInLocation(b []byte, loc *time.Location) error

UnmarshalInLocation decodes the binary data into Time with a specific time Location.

Jump to

Keyboard shortcuts

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