*: rename mysql err to common format
This commit is contained in:
1732
mysqldef/errcode.go
1732
mysqldef/errcode.go
File diff suppressed because it is too large
Load Diff
1728
mysqldef/errname.go
1728
mysqldef/errname.go
File diff suppressed because it is too large
Load Diff
@ -23,13 +23,13 @@ type testSQLErrorSuite struct {
|
||||
}
|
||||
|
||||
func (s *testSQLErrorSuite) TestSQLError(c *C) {
|
||||
e := NewError(ErNoDbError, "no db error")
|
||||
e := NewError(ErrNoDbError, "no db error")
|
||||
c.Assert(len(e.Error()), Greater, 0)
|
||||
|
||||
e = NewError(0, "customized error")
|
||||
c.Assert(len(e.Error()), Greater, 0)
|
||||
|
||||
e = NewDefaultError(ErNoDbError)
|
||||
e = NewDefaultError(ErrNoDbError)
|
||||
c.Assert(len(e.Error()), Greater, 0)
|
||||
|
||||
e = NewDefaultError(0, "customized error")
|
||||
|
||||
@ -21,229 +21,229 @@ const (
|
||||
// MySQLState maps error code to MySQL SQLSTATE value.
|
||||
// The values are taken from ANSI SQL and ODBC and are more standardized.
|
||||
var MySQLState = map[uint16]string{
|
||||
ErDupKey: "23000",
|
||||
ErOutofmemory: "HY001",
|
||||
ErOutOfSortmemory: "HY001",
|
||||
ErConCountError: "08004",
|
||||
ErBadHostError: "08S01",
|
||||
ErHandshakeError: "08S01",
|
||||
ErDbaccessDeniedError: "42000",
|
||||
ErAccessDeniedError: "28000",
|
||||
ErNoDbError: "3D000",
|
||||
ErUnknownComError: "08S01",
|
||||
ErBadNullError: "23000",
|
||||
ErBadDbError: "42000",
|
||||
ErTableExistsError: "42S01",
|
||||
ErBadTableError: "42S02",
|
||||
ErNonUniqError: "23000",
|
||||
ErServerShutdown: "08S01",
|
||||
ErBadFieldError: "42S22",
|
||||
ErWrongFieldWithGroup: "42000",
|
||||
ErWrongSumSelect: "42000",
|
||||
ErWrongGroupField: "42000",
|
||||
ErWrongValueCount: "21S01",
|
||||
ErTooLongIdent: "42000",
|
||||
ErDupFieldname: "42S21",
|
||||
ErDupKeyname: "42000",
|
||||
ErDupEntry: "23000",
|
||||
ErWrongFieldSpec: "42000",
|
||||
ErParseError: "42000",
|
||||
ErEmptyQuery: "42000",
|
||||
ErNonuniqTable: "42000",
|
||||
ErInvalidDefault: "42000",
|
||||
ErMultiplePriKey: "42000",
|
||||
ErTooManyKeys: "42000",
|
||||
ErTooManyKeyParts: "42000",
|
||||
ErTooLongKey: "42000",
|
||||
ErKeyColumnDoesNotExits: "42000",
|
||||
ErBlobUsedAsKey: "42000",
|
||||
ErTooBigFieldlength: "42000",
|
||||
ErWrongAutoKey: "42000",
|
||||
ErForcingClose: "08S01",
|
||||
ErIpsockError: "08S01",
|
||||
ErNoSuchIndex: "42S12",
|
||||
ErWrongFieldTerminators: "42000",
|
||||
ErBlobsAndNoTerminated: "42000",
|
||||
ErCantRemoveAllFields: "42000",
|
||||
ErCantDropFieldOrKey: "42000",
|
||||
ErBlobCantHaveDefault: "42000",
|
||||
ErWrongDbName: "42000",
|
||||
ErWrongTableName: "42000",
|
||||
ErTooBigSelect: "42000",
|
||||
ErUnknownProcedure: "42000",
|
||||
ErWrongParamcountToProcedure: "42000",
|
||||
ErUnknownTable: "42S02",
|
||||
ErFieldSpecifiedTwice: "42000",
|
||||
ErUnsupportedExtension: "42000",
|
||||
ErTableMustHaveColumns: "42000",
|
||||
ErUnknownCharacterSet: "42000",
|
||||
ErTooBigRowsize: "42000",
|
||||
ErWrongOuterJoin: "42000",
|
||||
ErNullColumnInIndex: "42000",
|
||||
ErPasswordAnonymousUser: "42000",
|
||||
ErPasswordNotAllowed: "42000",
|
||||
ErPasswordNoMatch: "42000",
|
||||
ErWrongValueCountOnRow: "21S01",
|
||||
ErInvalidUseOfNull: "22004",
|
||||
ErRegexpError: "42000",
|
||||
ErMixOfGroupFuncAndFields: "42000",
|
||||
ErNonexistingGrant: "42000",
|
||||
ErTableaccessDeniedError: "42000",
|
||||
ErColumnaccessDeniedError: "42000",
|
||||
ErIllegalGrantForTable: "42000",
|
||||
ErGrantWrongHostOrUser: "42000",
|
||||
ErNoSuchTable: "42S02",
|
||||
ErNonexistingTableGrant: "42000",
|
||||
ErNotAllowedCommand: "42000",
|
||||
ErSyntaxError: "42000",
|
||||
ErAbortingConnection: "08S01",
|
||||
ErNetPacketTooLarge: "08S01",
|
||||
ErNetReadErrorFromPipe: "08S01",
|
||||
ErNetFcntlError: "08S01",
|
||||
ErNetPacketsOutOfOrder: "08S01",
|
||||
ErNetUncompressError: "08S01",
|
||||
ErNetReadError: "08S01",
|
||||
ErNetReadInterrupted: "08S01",
|
||||
ErNetErrorOnWrite: "08S01",
|
||||
ErNetWriteInterrupted: "08S01",
|
||||
ErTooLongString: "42000",
|
||||
ErTableCantHandleBlob: "42000",
|
||||
ErTableCantHandleAutoIncrement: "42000",
|
||||
ErWrongColumnName: "42000",
|
||||
ErWrongKeyColumn: "42000",
|
||||
ErDupUnique: "23000",
|
||||
ErBlobKeyWithoutLength: "42000",
|
||||
ErPrimaryCantHaveNull: "42000",
|
||||
ErTooManyRows: "42000",
|
||||
ErRequiresPrimaryKey: "42000",
|
||||
ErKeyDoesNotExits: "42000",
|
||||
ErCheckNoSuchTable: "42000",
|
||||
ErCheckNotImplemented: "42000",
|
||||
ErCantDoThisDuringAnTransaction: "25000",
|
||||
ErNewAbortingConnection: "08S01",
|
||||
ErMasterNetRead: "08S01",
|
||||
ErMasterNetWrite: "08S01",
|
||||
ErTooManyUserConnections: "42000",
|
||||
ErReadOnlyTransaction: "25000",
|
||||
ErNoPermissionToCreateUser: "42000",
|
||||
ErLockDeadlock: "40001",
|
||||
ErNoReferencedRow: "23000",
|
||||
ErRowIsReferenced: "23000",
|
||||
ErConnectToMaster: "08S01",
|
||||
ErWrongNumberOfColumnsInSelect: "21000",
|
||||
ErUserLimitReached: "42000",
|
||||
ErSpecificAccessDeniedError: "42000",
|
||||
ErNoDefault: "42000",
|
||||
ErWrongValueForVar: "42000",
|
||||
ErWrongTypeForVar: "42000",
|
||||
ErCantUseOptionHere: "42000",
|
||||
ErNotSupportedYet: "42000",
|
||||
ErWrongFkDef: "42000",
|
||||
ErOperandColumns: "21000",
|
||||
ErSubqueryNo1Row: "21000",
|
||||
ErIllegalReference: "42S22",
|
||||
ErDerivedMustHaveAlias: "42000",
|
||||
ErSelectReduced: "01000",
|
||||
ErTablenameNotAllowedHere: "42000",
|
||||
ErNotSupportedAuthMode: "08004",
|
||||
ErSpatialCantHaveNull: "42000",
|
||||
ErCollationCharsetMismatch: "42000",
|
||||
ErWarnTooFewRecords: "01000",
|
||||
ErWarnTooManyRecords: "01000",
|
||||
ErWarnNullToNotnull: "22004",
|
||||
ErWarnDataOutOfRange: "22003",
|
||||
WarnDataTruncated: "01000",
|
||||
ErWrongNameForIndex: "42000",
|
||||
ErWrongNameForCatalog: "42000",
|
||||
ErUnknownStorageEngine: "42000",
|
||||
ErTruncatedWrongValue: "22007",
|
||||
ErSpNoRecursiveCreate: "2F003",
|
||||
ErSpAlreadyExists: "42000",
|
||||
ErSpDoesNotExist: "42000",
|
||||
ErSpLilabelMismatch: "42000",
|
||||
ErSpLabelRedefine: "42000",
|
||||
ErSpLabelMismatch: "42000",
|
||||
ErSpUninitVar: "01000",
|
||||
ErSpBadselect: "0A000",
|
||||
ErSpBadreturn: "42000",
|
||||
ErSpBadstatement: "0A000",
|
||||
ErUpdateLogDeprecatedIgnored: "42000",
|
||||
ErUpdateLogDeprecatedTranslated: "42000",
|
||||
ErQueryInterrupted: "70100",
|
||||
ErSpWrongNoOfArgs: "42000",
|
||||
ErSpCondMismatch: "42000",
|
||||
ErSpNoreturn: "42000",
|
||||
ErSpNoreturnend: "2F005",
|
||||
ErSpBadCursorQuery: "42000",
|
||||
ErSpBadCursorSelect: "42000",
|
||||
ErSpCursorMismatch: "42000",
|
||||
ErSpCursorAlreadyOpen: "24000",
|
||||
ErSpCursorNotOpen: "24000",
|
||||
ErSpUndeclaredVar: "42000",
|
||||
ErSpFetchNoData: "02000",
|
||||
ErSpDupParam: "42000",
|
||||
ErSpDupVar: "42000",
|
||||
ErSpDupCond: "42000",
|
||||
ErSpDupCurs: "42000",
|
||||
ErSpSubselectNyi: "0A000",
|
||||
ErStmtNotAllowedInSfOrTrg: "0A000",
|
||||
ErSpVarcondAfterCurshndlr: "42000",
|
||||
ErSpCursorAfterHandler: "42000",
|
||||
ErSpCaseNotFound: "20000",
|
||||
ErDivisionByZero: "22012",
|
||||
ErIllegalValueForType: "22007",
|
||||
ErProcaccessDeniedError: "42000",
|
||||
ErXaerNota: "XAE04",
|
||||
ErXaerInval: "XAE05",
|
||||
ErXaerRmfail: "XAE07",
|
||||
ErXaerOutside: "XAE09",
|
||||
ErXaerRmerr: "XAE03",
|
||||
ErXaRbrollback: "XA100",
|
||||
ErNonexistingProcGrant: "42000",
|
||||
ErDataTooLong: "22001",
|
||||
ErSpBadSQLstate: "42000",
|
||||
ErCantCreateUserWithGrant: "42000",
|
||||
ErSpDupHandler: "42000",
|
||||
ErSpNotVarArg: "42000",
|
||||
ErSpNoRetset: "0A000",
|
||||
ErCantCreateGeometryObject: "22003",
|
||||
ErTooBigScale: "42000",
|
||||
ErTooBigPrecision: "42000",
|
||||
ErMBiggerThanD: "42000",
|
||||
ErTooLongBody: "42000",
|
||||
ErTooBigDisplaywidth: "42000",
|
||||
ErXaerDupid: "XAE08",
|
||||
ErDatetimeFunctionOverflow: "22008",
|
||||
ErRowIsReferenced2: "23000",
|
||||
ErNoReferencedRow2: "23000",
|
||||
ErSpBadVarShadow: "42000",
|
||||
ErSpWrongName: "42000",
|
||||
ErSpNoAggregate: "42000",
|
||||
ErMaxPreparedStmtCountReached: "42000",
|
||||
ErNonGroupingFieldUsed: "42000",
|
||||
ErForeignDuplicateKeyOldUnused: "23000",
|
||||
ErCantChangeTxCharacteristics: "25001",
|
||||
ErWrongParamcountToNativeFct: "42000",
|
||||
ErWrongParametersToNativeFct: "42000",
|
||||
ErWrongParametersToStoredFct: "42000",
|
||||
ErDupEntryWithKeyName: "23000",
|
||||
ErXaRbtimeout: "XA106",
|
||||
ErXaRbdeadlock: "XA102",
|
||||
ErFuncInexistentNameCollision: "42000",
|
||||
ErDupSignalSet: "42000",
|
||||
ErSignalWarn: "01000",
|
||||
ErSignalNotFound: "02000",
|
||||
ErSignalException: "HY000",
|
||||
ErResignalWithoutActiveHandler: "0K000",
|
||||
ErSpatialMustHaveGeomCol: "42000",
|
||||
ErDataOutOfRange: "22003",
|
||||
ErAccessDeniedNoPasswordError: "28000",
|
||||
ErTruncateIllegalFk: "42000",
|
||||
ErDaInvalidConditionNumber: "35000",
|
||||
ErForeignDuplicateKeyWithChildInfo: "23000",
|
||||
ErForeignDuplicateKeyWithoutChildInfo: "23000",
|
||||
ErCantExecuteInReadOnlyTransaction: "25006",
|
||||
ErAlterOperationNotSupported: "0A000",
|
||||
ErAlterOperationNotSupportedReason: "0A000",
|
||||
ErDupUnknownInIndex: "23000",
|
||||
ErrDupKey: "23000",
|
||||
ErrOutofmemory: "HY001",
|
||||
ErrOutOfSortmemory: "HY001",
|
||||
ErrConCountError: "08004",
|
||||
ErrBadHostError: "08S01",
|
||||
ErrHandshakeError: "08S01",
|
||||
ErrDbaccessDeniedError: "42000",
|
||||
ErrAccessDeniedError: "28000",
|
||||
ErrNoDbError: "3D000",
|
||||
ErrUnknownComError: "08S01",
|
||||
ErrBadNullError: "23000",
|
||||
ErrBadDbError: "42000",
|
||||
ErrTableExistsError: "42S01",
|
||||
ErrBadTableError: "42S02",
|
||||
ErrNonUniqError: "23000",
|
||||
ErrServerShutdown: "08S01",
|
||||
ErrBadFieldError: "42S22",
|
||||
ErrWrongFieldWithGroup: "42000",
|
||||
ErrWrongSumSelect: "42000",
|
||||
ErrWrongGroupField: "42000",
|
||||
ErrWrongValueCount: "21S01",
|
||||
ErrTooLongIdent: "42000",
|
||||
ErrDupFieldname: "42S21",
|
||||
ErrDupKeyname: "42000",
|
||||
ErrDupEntry: "23000",
|
||||
ErrWrongFieldSpec: "42000",
|
||||
ErrParseError: "42000",
|
||||
ErrEmptyQuery: "42000",
|
||||
ErrNonuniqTable: "42000",
|
||||
ErrInvalidDefault: "42000",
|
||||
ErrMultiplePriKey: "42000",
|
||||
ErrTooManyKeys: "42000",
|
||||
ErrTooManyKeyParts: "42000",
|
||||
ErrTooLongKey: "42000",
|
||||
ErrKeyColumnDoesNotExits: "42000",
|
||||
ErrBlobUsedAsKey: "42000",
|
||||
ErrTooBigFieldlength: "42000",
|
||||
ErrWrongAutoKey: "42000",
|
||||
ErrForcingClose: "08S01",
|
||||
ErrIpsockError: "08S01",
|
||||
ErrNoSuchIndex: "42S12",
|
||||
ErrWrongFieldTerminators: "42000",
|
||||
ErrBlobsAndNoTerminated: "42000",
|
||||
ErrCantRemoveAllFields: "42000",
|
||||
ErrCantDropFieldOrKey: "42000",
|
||||
ErrBlobCantHaveDefault: "42000",
|
||||
ErrWrongDbName: "42000",
|
||||
ErrWrongTableName: "42000",
|
||||
ErrTooBigSelect: "42000",
|
||||
ErrUnknownProcedure: "42000",
|
||||
ErrWrongParamcountToProcedure: "42000",
|
||||
ErrUnknownTable: "42S02",
|
||||
ErrFieldSpecifiedTwice: "42000",
|
||||
ErrUnsupportedExtension: "42000",
|
||||
ErrTableMustHaveColumns: "42000",
|
||||
ErrUnknownCharacterSet: "42000",
|
||||
ErrTooBigRowsize: "42000",
|
||||
ErrWrongOuterJoin: "42000",
|
||||
ErrNullColumnInIndex: "42000",
|
||||
ErrPasswordAnonymousUser: "42000",
|
||||
ErrPasswordNotAllowed: "42000",
|
||||
ErrPasswordNoMatch: "42000",
|
||||
ErrWrongValueCountOnRow: "21S01",
|
||||
ErrInvalidUseOfNull: "22004",
|
||||
ErrRegexpError: "42000",
|
||||
ErrMixOfGroupFuncAndFields: "42000",
|
||||
ErrNonexistingGrant: "42000",
|
||||
ErrTableaccessDeniedError: "42000",
|
||||
ErrColumnaccessDeniedError: "42000",
|
||||
ErrIllegalGrantForTable: "42000",
|
||||
ErrGrantWrongHostOrUser: "42000",
|
||||
ErrNoSuchTable: "42S02",
|
||||
ErrNonexistingTableGrant: "42000",
|
||||
ErrNotAllowedCommand: "42000",
|
||||
ErrSyntaxError: "42000",
|
||||
ErrAbortingConnection: "08S01",
|
||||
ErrNetPacketTooLarge: "08S01",
|
||||
ErrNetReadErrorFromPipe: "08S01",
|
||||
ErrNetFcntlError: "08S01",
|
||||
ErrNetPacketsOutOfOrder: "08S01",
|
||||
ErrNetUncompressError: "08S01",
|
||||
ErrNetReadError: "08S01",
|
||||
ErrNetReadInterrupted: "08S01",
|
||||
ErrNetErrorOnWrite: "08S01",
|
||||
ErrNetWriteInterrupted: "08S01",
|
||||
ErrTooLongString: "42000",
|
||||
ErrTableCantHandleBlob: "42000",
|
||||
ErrTableCantHandleAutoIncrement: "42000",
|
||||
ErrWrongColumnName: "42000",
|
||||
ErrWrongKeyColumn: "42000",
|
||||
ErrDupUnique: "23000",
|
||||
ErrBlobKeyWithoutLength: "42000",
|
||||
ErrPrimaryCantHaveNull: "42000",
|
||||
ErrTooManyRows: "42000",
|
||||
ErrRequiresPrimaryKey: "42000",
|
||||
ErrKeyDoesNotExits: "42000",
|
||||
ErrCheckNoSuchTable: "42000",
|
||||
ErrCheckNotImplemented: "42000",
|
||||
ErrCantDoThisDuringAnTransaction: "25000",
|
||||
ErrNewAbortingConnection: "08S01",
|
||||
ErrMasterNetRead: "08S01",
|
||||
ErrMasterNetWrite: "08S01",
|
||||
ErrTooManyUserConnections: "42000",
|
||||
ErrReadOnlyTransaction: "25000",
|
||||
ErrNoPermissionToCreateUser: "42000",
|
||||
ErrLockDeadlock: "40001",
|
||||
ErrNoReferencedRow: "23000",
|
||||
ErrRowIsReferenced: "23000",
|
||||
ErrConnectToMaster: "08S01",
|
||||
ErrWrongNumberOfColumnsInSelect: "21000",
|
||||
ErrUserLimitReached: "42000",
|
||||
ErrSpecificAccessDeniedError: "42000",
|
||||
ErrNoDefault: "42000",
|
||||
ErrWrongValueForVar: "42000",
|
||||
ErrWrongTypeForVar: "42000",
|
||||
ErrCantUseOptionHere: "42000",
|
||||
ErrNotSupportedYet: "42000",
|
||||
ErrWrongFkDef: "42000",
|
||||
ErrOperandColumns: "21000",
|
||||
ErrSubqueryNo1Row: "21000",
|
||||
ErrIllegalReference: "42S22",
|
||||
ErrDerivedMustHaveAlias: "42000",
|
||||
ErrSelectReduced: "01000",
|
||||
ErrTablenameNotAllowedHere: "42000",
|
||||
ErrNotSupportedAuthMode: "08004",
|
||||
ErrSpatialCantHaveNull: "42000",
|
||||
ErrCollationCharsetMismatch: "42000",
|
||||
ErrWarnTooFewRecords: "01000",
|
||||
ErrWarnTooManyRecords: "01000",
|
||||
ErrWarnNullToNotnull: "22004",
|
||||
ErrWarnDataOutOfRange: "22003",
|
||||
WarnDataTruncated: "01000",
|
||||
ErrWrongNameForIndex: "42000",
|
||||
ErrWrongNameForCatalog: "42000",
|
||||
ErrUnknownStorageEngine: "42000",
|
||||
ErrTruncatedWrongValue: "22007",
|
||||
ErrSpNoRecursiveCreate: "2F003",
|
||||
ErrSpAlreadyExists: "42000",
|
||||
ErrSpDoesNotExist: "42000",
|
||||
ErrSpLilabelMismatch: "42000",
|
||||
ErrSpLabelRedefine: "42000",
|
||||
ErrSpLabelMismatch: "42000",
|
||||
ErrSpUninitVar: "01000",
|
||||
ErrSpBadselect: "0A000",
|
||||
ErrSpBadreturn: "42000",
|
||||
ErrSpBadstatement: "0A000",
|
||||
ErrUpdateLogDeprecatedIgnored: "42000",
|
||||
ErrUpdateLogDeprecatedTranslated: "42000",
|
||||
ErrQueryInterrupted: "70100",
|
||||
ErrSpWrongNoOfArgs: "42000",
|
||||
ErrSpCondMismatch: "42000",
|
||||
ErrSpNoreturn: "42000",
|
||||
ErrSpNoreturnend: "2F005",
|
||||
ErrSpBadCursorQuery: "42000",
|
||||
ErrSpBadCursorSelect: "42000",
|
||||
ErrSpCursorMismatch: "42000",
|
||||
ErrSpCursorAlreadyOpen: "24000",
|
||||
ErrSpCursorNotOpen: "24000",
|
||||
ErrSpUndeclaredVar: "42000",
|
||||
ErrSpFetchNoData: "02000",
|
||||
ErrSpDupParam: "42000",
|
||||
ErrSpDupVar: "42000",
|
||||
ErrSpDupCond: "42000",
|
||||
ErrSpDupCurs: "42000",
|
||||
ErrSpSubselectNyi: "0A000",
|
||||
ErrStmtNotAllowedInSfOrTrg: "0A000",
|
||||
ErrSpVarcondAfterCurshndlr: "42000",
|
||||
ErrSpCursorAfterHandler: "42000",
|
||||
ErrSpCaseNotFound: "20000",
|
||||
ErrDivisionByZero: "22012",
|
||||
ErrIllegalValueForType: "22007",
|
||||
ErrProcaccessDeniedError: "42000",
|
||||
ErrXaerNota: "XAE04",
|
||||
ErrXaerInval: "XAE05",
|
||||
ErrXaerRmfail: "XAE07",
|
||||
ErrXaerOutside: "XAE09",
|
||||
ErrXaerRmerr: "XAE03",
|
||||
ErrXaRbrollback: "XA100",
|
||||
ErrNonexistingProcGrant: "42000",
|
||||
ErrDataTooLong: "22001",
|
||||
ErrSpBadSQLstate: "42000",
|
||||
ErrCantCreateUserWithGrant: "42000",
|
||||
ErrSpDupHandler: "42000",
|
||||
ErrSpNotVarArg: "42000",
|
||||
ErrSpNoRetset: "0A000",
|
||||
ErrCantCreateGeometryObject: "22003",
|
||||
ErrTooBigScale: "42000",
|
||||
ErrTooBigPrecision: "42000",
|
||||
ErrMBiggerThanD: "42000",
|
||||
ErrTooLongBody: "42000",
|
||||
ErrTooBigDisplaywidth: "42000",
|
||||
ErrXaerDupid: "XAE08",
|
||||
ErrDatetimeFunctionOverflow: "22008",
|
||||
ErrRowIsReferenced2: "23000",
|
||||
ErrNoReferencedRow2: "23000",
|
||||
ErrSpBadVarShadow: "42000",
|
||||
ErrSpWrongName: "42000",
|
||||
ErrSpNoAggregate: "42000",
|
||||
ErrMaxPreparedStmtCountReached: "42000",
|
||||
ErrNonGroupingFieldUsed: "42000",
|
||||
ErrForeignDuplicateKeyOldUnused: "23000",
|
||||
ErrCantChangeTxCharacteristics: "25001",
|
||||
ErrWrongParamcountToNativeFct: "42000",
|
||||
ErrWrongParametersToNativeFct: "42000",
|
||||
ErrWrongParametersToStoredFct: "42000",
|
||||
ErrDupEntryWithKeyName: "23000",
|
||||
ErrXaRbtimeout: "XA106",
|
||||
ErrXaRbdeadlock: "XA102",
|
||||
ErrFuncInexistentNameCollision: "42000",
|
||||
ErrDupSignalSet: "42000",
|
||||
ErrSignalWarn: "01000",
|
||||
ErrSignalNotFound: "02000",
|
||||
ErrSignalException: "HY000",
|
||||
ErrResignalWithoutActiveHandler: "0K000",
|
||||
ErrSpatialMustHaveGeomCol: "42000",
|
||||
ErrDataOutOfRange: "22003",
|
||||
ErrAccessDeniedNoPasswordError: "28000",
|
||||
ErrTruncateIllegalFk: "42000",
|
||||
ErrDaInvalidConditionNumber: "35000",
|
||||
ErrForeignDuplicateKeyWithChildInfo: "23000",
|
||||
ErrForeignDuplicateKeyWithoutChildInfo: "23000",
|
||||
ErrCantExecuteInReadOnlyTransaction: "25006",
|
||||
ErrAlterOperationNotSupported: "0A000",
|
||||
ErrAlterOperationNotSupportedReason: "0A000",
|
||||
ErrDupUnknownInIndex: "23000",
|
||||
}
|
||||
|
||||
@ -201,11 +201,11 @@ func (cc *clientConn) readHandshakeResponse() error {
|
||||
addr := cc.conn.RemoteAddr().String()
|
||||
host, _, err1 := net.SplitHostPort(addr)
|
||||
if err1 != nil {
|
||||
return errors.Trace(mysql.NewDefaultError(mysql.ErAccessDeniedError, cc.user, addr, "Yes"))
|
||||
return errors.Trace(mysql.NewDefaultError(mysql.ErrAccessDeniedError, cc.user, addr, "Yes"))
|
||||
}
|
||||
user := fmt.Sprintf("%s@%s", cc.user, host)
|
||||
if !cc.ctx.Auth(user, auth, cc.salt) {
|
||||
return errors.Trace(mysql.NewDefaultError(mysql.ErAccessDeniedError, cc.user, host, "Yes"))
|
||||
return errors.Trace(mysql.NewDefaultError(mysql.ErrAccessDeniedError, cc.user, host, "Yes"))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
@ -284,7 +284,7 @@ func (cc *clientConn) dispatch(data []byte) error {
|
||||
return cc.handleStmtReset(data)
|
||||
default:
|
||||
msg := fmt.Sprintf("command %d not supported now", cmd)
|
||||
return mysql.NewError(mysql.ErUnknownError, msg)
|
||||
return mysql.NewError(mysql.ErrUnknownError, msg)
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,8 +322,9 @@ func (cc *clientConn) writeOK() error {
|
||||
func (cc *clientConn) writeError(e error) error {
|
||||
var m *mysql.SQLError
|
||||
var ok bool
|
||||
if m, ok = e.(*mysql.SQLError); !ok {
|
||||
m = mysql.NewError(mysql.ErUnknownError, e.Error())
|
||||
originErr := errors.Cause(e)
|
||||
if m, ok = originErr.(*mysql.SQLError); !ok {
|
||||
m = mysql.NewError(mysql.ErrUnknownError, e.Error())
|
||||
}
|
||||
|
||||
data := make([]byte, 4, 16+len(m.Message))
|
||||
|
||||
@ -113,7 +113,7 @@ func (cc *clientConn) handleStmtExecute(data []byte) (err error) {
|
||||
|
||||
stmt := cc.ctx.GetStatement(int(stmtID))
|
||||
if stmt == nil {
|
||||
return mysql.NewDefaultError(mysql.ErUnknownStmtHandler,
|
||||
return mysql.NewDefaultError(mysql.ErrUnknownStmtHandler,
|
||||
strconv.FormatUint(uint64(stmtID), 10), "stmt_execute")
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ func (cc *clientConn) handleStmtExecute(data []byte) (err error) {
|
||||
pos++
|
||||
//now we only support CURSOR_TYPE_NO_CURSOR flag
|
||||
if flag != 0 {
|
||||
return mysql.NewError(mysql.ErUnknownError, fmt.Sprintf("unsupported flag %d", flag))
|
||||
return mysql.NewError(mysql.ErrUnknownError, fmt.Sprintf("unsupported flag %d", flag))
|
||||
}
|
||||
|
||||
//skip iteration-count, always 1
|
||||
@ -324,7 +324,7 @@ func (cc *clientConn) handleStmtSendLongData(data []byte) (err error) {
|
||||
|
||||
stmt := cc.ctx.GetStatement(stmtID)
|
||||
if stmt == nil {
|
||||
return mysql.NewDefaultError(mysql.ErUnknownStmtHandler,
|
||||
return mysql.NewDefaultError(mysql.ErrUnknownStmtHandler,
|
||||
strconv.Itoa(stmtID), "stmt_send_longdata")
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ func (cc *clientConn) handleStmtReset(data []byte) (err error) {
|
||||
stmtID := int(binary.LittleEndian.Uint32(data[0:4]))
|
||||
stmt := cc.ctx.GetStatement(stmtID)
|
||||
if stmt == nil {
|
||||
return mysql.NewDefaultError(mysql.ErUnknownStmtHandler,
|
||||
return mysql.NewDefaultError(mysql.ErrUnknownStmtHandler,
|
||||
strconv.Itoa(stmtID), "stmt_reset")
|
||||
}
|
||||
stmt.Reset()
|
||||
|
||||
@ -78,7 +78,7 @@ func (ts *TiDBStatement) Execute(args ...interface{}) (rs ResultSet, err error)
|
||||
// AppendParam implements IStatement AppendParam method.
|
||||
func (ts *TiDBStatement) AppendParam(paramID int, data []byte) error {
|
||||
if paramID >= len(ts.boundParams) {
|
||||
return mysql.NewDefaultError(mysql.ErWrongArguments, "stmt_send_longdata")
|
||||
return mysql.NewDefaultError(mysql.ErrWrongArguments, "stmt_send_longdata")
|
||||
}
|
||||
ts.boundParams[paramID] = append(ts.boundParams[paramID], data...)
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user