Skip to content

Commit

Permalink
mysql: rename Db to DB
Browse files Browse the repository at this point in the history
  • Loading branch information
zimulala committed Mar 31, 2016
1 parent c4d97a7 commit aaa7333
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 44 deletions.
10 changes: 5 additions & 5 deletions infoschema/infoschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

var (
// ErrDatabaseDropExists returns for dropping a non-existent database.
ErrDatabaseDropExists = terror.ClassSchema.New(codeDbDropExists, "database doesn't exist")
ErrDatabaseDropExists = terror.ClassSchema.New(codeDBDropExists, "database doesn't exist")
// ErrDatabaseNotExists returns for database not exists.
ErrDatabaseNotExists = terror.ClassSchema.New(codeDatabaseNotExists, "database not exists")
// ErrTableNotExists returns for table not exists.
Expand Down Expand Up @@ -479,7 +479,7 @@ func (h *Handle) Get() InfoSchema {

// Schema error codes.
const (
codeDbDropExists terror.ErrCode = 1008
codeDBDropExists terror.ErrCode = 1008
codeDatabaseNotExists = 1049
codeTableNotExists = 1146
codeColumnNotExists = 1054
Expand All @@ -493,11 +493,11 @@ const (

func init() {
schemaMySQLErrCodes := map[terror.ErrCode]uint16{
codeDbDropExists: mysql.ErrDbDropExists,
codeDatabaseNotExists: mysql.ErrBadDb,
codeDBDropExists: mysql.ErrDBDropExists,
codeDatabaseNotExists: mysql.ErrBadDB,
codeTableNotExists: mysql.ErrNoSuchTable,
codeColumnNotExists: mysql.ErrBadField,
codeDatabaseExists: mysql.ErrDbCreateExists,
codeDatabaseExists: mysql.ErrDBCreateExists,
codeTableExists: mysql.ErrTableExists,
codeBadTable: mysql.ErrBadTable,
codeColumnExists: mysql.ErrDupFieldName,
Expand Down
4 changes: 2 additions & 2 deletions meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,8 @@ const (

func init() {
metaMySQLErrCodes := map[terror.ErrCode]uint16{
codeDatabaseExists: mysql.ErrDbCreateExists,
codeDatabaseNotExists: mysql.ErrBadDb,
codeDatabaseExists: mysql.ErrDBCreateExists,
codeDatabaseNotExists: mysql.ErrBadDB,
codeTableNotExists: mysql.ErrNoSuchTable,
codeTableExists: mysql.ErrTableExists,
}
Expand Down
28 changes: 14 additions & 14 deletions mysql/errcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ const (
ErrYes = 1003
ErrCantCreateFile = 1004
ErrCantCreateTable = 1005
ErrCantCreateDb = 1006
ErrDbCreateExists = 1007
ErrDbDropExists = 1008
ErrDbDropDelete = 1009
ErrDbDropRmdir = 1010
ErrCantCreateDB = 1006
ErrDBCreateExists = 1007
ErrDBDropExists = 1008
ErrDBDropDelete = 1009
ErrDBDropRmdir = 1010
ErrCantDeleteFile = 1011
ErrCantFindSystemRec = 1012
ErrCantGetStat = 1013
Expand Down Expand Up @@ -61,12 +61,12 @@ const (
ErrOutOfResources = 1041
ErrBadHost = 1042
ErrHandshake = 1043
ErrDbaccessDenied = 1044
ErrDBaccessDenied = 1044
ErrAccessDenied = 1045
ErrNoDb = 1046
ErrNoDB = 1046
ErrUnknownCom = 1047
ErrBadNull = 1048
ErrBadDb = 1049
ErrBadDB = 1049
ErrTableExists = 1050
ErrBadTable = 1051
ErrNonUniq = 1052
Expand Down Expand Up @@ -119,7 +119,7 @@ const (
ErrTableNotLockedForWrite = 1099
ErrTableNotLocked = 1100
ErrBlobCantHaveDefault = 1101
ErrWrongDbName = 1102
ErrWrongDBName = 1102
ErrWrongTableName = 1103
ErrTooBigSelect = 1104
ErrUnknown = 1105
Expand Down Expand Up @@ -225,8 +225,8 @@ const (
ErrLockWaitTimeout = 1205
ErrLockTableFull = 1206
ErrReadOnlyTransaction = 1207
ErrDropDbWithReadLock = 1208
ErrCreateDbWithReadLock = 1209
ErrDropDBWithReadLock = 1208
ErrCreateDBWithReadLock = 1209
ErrWrongArguments = 1210
ErrNoPermissionToCreateUser = 1211
ErrUnionTablesInDifferentDir = 1212
Expand Down Expand Up @@ -261,7 +261,7 @@ const (
ErrOperandColumns = 1241
ErrSubqueryNo1Row = 1242
ErrUnknownStmtHandler = 1243
ErrCorruptHelpDb = 1244
ErrCorruptHelpDB = 1244
ErrCyclicReference = 1245
ErrAutoConvert = 1246
ErrIllegalReference = 1247
Expand Down Expand Up @@ -594,7 +594,7 @@ const (
ErrRbrNotAvailable = 1574
ErrBase64Decode = 1575
ErrEventRecursionForbidden = 1576
ErrEventsDb = 1577
ErrEventsDB = 1577
ErrOnlyIntegersAllowed = 1578
ErrUnsuportedLogEngine = 1579
ErrBadLogStatement = 1580
Expand Down Expand Up @@ -771,7 +771,7 @@ const (
ErrWarningNotCompleteRollbackWithCreatedTempTable = 1751
ErrWarningNotCompleteRollbackWithDroppedTempTable = 1752
ErrMtsFeatureIsNotSupported = 1753
ErrMtsUpdatedDbsGreaterMax = 1754
ErrMtsUpdatedDBsGreaterMax = 1754
ErrMtsCantParallel = 1755
ErrMtsInconsistentData = 1756
ErrFulltextNotSupportedWithPartitioning = 1757
Expand Down
28 changes: 14 additions & 14 deletions mysql/errname.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ var MySQLErrName = map[uint16]string{
ErrYes: "YES",
ErrCantCreateFile: "Can't create file '%-.200s' (errno: %d - %s)",
ErrCantCreateTable: "Can't create table '%-.200s' (errno: %d)",
ErrCantCreateDb: "Can't create database '%-.192s' (errno: %d)",
ErrDbCreateExists: "Can't create database '%-.192s'; database exists",
ErrDbDropExists: "Can't drop database '%-.192s'; database doesn't exist",
ErrDbDropDelete: "Error dropping database (can't delete '%-.192s', errno: %d)",
ErrDbDropRmdir: "Error dropping database (can't rmdir '%-.192s', errno: %d)",
ErrCantCreateDB: "Can't create database '%-.192s' (errno: %d)",
ErrDBCreateExists: "Can't create database '%-.192s'; database exists",
ErrDBDropExists: "Can't drop database '%-.192s'; database doesn't exist",
ErrDBDropDelete: "Error dropping database (can't delete '%-.192s', errno: %d)",
ErrDBDropRmdir: "Error dropping database (can't rmdir '%-.192s', errno: %d)",
ErrCantDeleteFile: "Error on delete of '%-.192s' (errno: %d - %s)",
ErrCantFindSystemRec: "Can't read record in system table",
ErrCantGetStat: "Can't get status of '%-.200s' (errno: %d - %s)",
Expand Down Expand Up @@ -59,12 +59,12 @@ var MySQLErrName = map[uint16]string{
ErrOutOfResources: "Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space",
ErrBadHost: "Can't get hostname for your address",
ErrHandshake: "Bad handshake",
ErrDbaccessDenied: "Access denied for user '%-.48s'@'%-.64s' to database '%-.192s'",
ErrDBaccessDenied: "Access denied for user '%-.48s'@'%-.64s' to database '%-.192s'",
ErrAccessDenied: "Access denied for user '%-.48s'@'%-.64s' (using password: %s)",
ErrNoDb: "No database selected",
ErrNoDB: "No database selected",
ErrUnknownCom: "Unknown command",
ErrBadNull: "Column '%-.192s' cannot be null",
ErrBadDb: "Unknown database '%-.192s'",
ErrBadDB: "Unknown database '%-.192s'",
ErrTableExists: "Table '%-.192s' already exists",
ErrBadTable: "Unknown table '%-.100s'",
ErrNonUniq: "Column '%-.192s' in %-.192s is ambiguous",
Expand Down Expand Up @@ -117,7 +117,7 @@ var MySQLErrName = map[uint16]string{
ErrTableNotLockedForWrite: "Table '%-.192s' was locked with a READ lock and can't be updated",
ErrTableNotLocked: "Table '%-.192s' was not locked with LOCK TABLES",
ErrBlobCantHaveDefault: "BLOB/TEXT column '%-.192s' can't have a default value",
ErrWrongDbName: "Incorrect database name '%-.100s'",
ErrWrongDBName: "Incorrect database name '%-.100s'",
ErrWrongTableName: "Incorrect table name '%-.100s'",
ErrTooBigSelect: "The SELECT would examine more than MAXJOINSIZE rows; check your WHERE and use SET SQLBIGSELECTS=1 or SET MAXJOINSIZE=# if the SELECT is okay",
ErrUnknown: "Unknown error",
Expand Down Expand Up @@ -223,8 +223,8 @@ var MySQLErrName = map[uint16]string{
ErrLockWaitTimeout: "Lock wait timeout exceeded; try restarting transaction",
ErrLockTableFull: "The total number of locks exceeds the lock table size",
ErrReadOnlyTransaction: "Update locks cannot be acquired during a READ UNCOMMITTED transaction",
ErrDropDbWithReadLock: "DROP DATABASE not allowed while thread is holding global read lock",
ErrCreateDbWithReadLock: "CREATE DATABASE not allowed while thread is holding global read lock",
ErrDropDBWithReadLock: "DROP DATABASE not allowed while thread is holding global read lock",
ErrCreateDBWithReadLock: "CREATE DATABASE not allowed while thread is holding global read lock",
ErrWrongArguments: "Incorrect arguments to %s",
ErrNoPermissionToCreateUser: "'%-.48s'@'%-.64s' is not allowed to create new users",
ErrUnionTablesInDifferentDir: "Incorrect table definition; all MERGE tables must be in the same database",
Expand Down Expand Up @@ -259,7 +259,7 @@ var MySQLErrName = map[uint16]string{
ErrOperandColumns: "Operand should contain %d column(s)",
ErrSubqueryNo1Row: "Subquery returns more than 1 row",
ErrUnknownStmtHandler: "Unknown prepared statement handler (%.*s) given to %s",
ErrCorruptHelpDb: "Help database is corrupt or does not exist",
ErrCorruptHelpDB: "Help database is corrupt or does not exist",
ErrCyclicReference: "Cyclic reference on subqueries",
ErrAutoConvert: "Converting column '%s' from %s to %s",
ErrIllegalReference: "Reference '%-.64s' not supported (%s)",
Expand Down Expand Up @@ -592,7 +592,7 @@ var MySQLErrName = map[uint16]string{
ErrRbrNotAvailable: "The server was not built with row-based replication",
ErrBase64Decode: "Decoding of base64 string failed",
ErrEventRecursionForbidden: "Recursion of EVENT DDL statements is forbidden when body is present",
ErrEventsDb: "Cannot proceed because system tables used by Event Scheduler were found damaged at server start",
ErrEventsDB: "Cannot proceed because system tables used by Event Scheduler were found damaged at server start",
ErrOnlyIntegersAllowed: "Only integers allowed as number here",
ErrUnsuportedLogEngine: "This storage engine cannot be used for log tables\"",
ErrBadLogStatement: "You cannot '%s' a log table if logging is enabled",
Expand Down Expand Up @@ -769,7 +769,7 @@ var MySQLErrName = map[uint16]string{
ErrWarningNotCompleteRollbackWithCreatedTempTable: "The creation of some temporary tables could not be rolled back.",
ErrWarningNotCompleteRollbackWithDroppedTempTable: "Some temporary tables were dropped, but these operations could not be rolled back.",
ErrMtsFeatureIsNotSupported: "%s is not supported in multi-threaded slave mode. %s",
ErrMtsUpdatedDbsGreaterMax: "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata.",
ErrMtsUpdatedDBsGreaterMax: "The number of modified databases exceeds the maximum %d; the database names will not be included in the replication event metadata.",
ErrMtsCantParallel: "Cannot execute the current event group in the parallel mode. Encountered event %s, relay-log name %s, position %s which prevents execution of this event group in parallel mode. Reason: %s.",
ErrMtsInconsistentData: "%s",
ErrFulltextNotSupportedWithPartitioning: "FULLTEXT index is not supported for partitioned tables.",
Expand Down
4 changes: 2 additions & 2 deletions mysql/error_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ type testSQLErrorSuite struct {
}

func (s *testSQLErrorSuite) TestSQLError(c *C) {
e := NewErrf(ErrNoDb, "no db error")
e := NewErrf(ErrNoDB, "no db error")
c.Assert(len(e.Error()), Greater, 0)

e = NewErrf(0, "customized error")
c.Assert(len(e.Error()), Greater, 0)

e = NewErr(ErrNoDb)
e = NewErr(ErrNoDB)
c.Assert(len(e.Error()), Greater, 0)

e = NewErr(0, "customized error")
Expand Down
8 changes: 4 additions & 4 deletions mysql/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ var MySQLState = map[uint16]string{
ErrConCount: "08004",
ErrBadHost: "08S01",
ErrHandshake: "08S01",
ErrDbaccessDenied: "42000",
ErrDBaccessDenied: "42000",
ErrAccessDenied: "28000",
ErrNoDb: "3D000",
ErrNoDB: "3D000",
ErrUnknownCom: "08S01",
ErrBadNull: "23000",
ErrBadDb: "42000",
ErrBadDB: "42000",
ErrTableExists: "42S01",
ErrBadTable: "42S02",
ErrNonUniq: "23000",
Expand Down Expand Up @@ -67,7 +67,7 @@ var MySQLState = map[uint16]string{
ErrCantRemoveAllFields: "42000",
ErrCantDropFieldOrKey: "42000",
ErrBlobCantHaveDefault: "42000",
ErrWrongDbName: "42000",
ErrWrongDBName: "42000",
ErrWrongTableName: "42000",
ErrTooBigSelect: "42000",
ErrUnknownProcedure: "42000",
Expand Down
6 changes: 3 additions & 3 deletions tidb-server/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,17 @@ func runTestErrorCode(c *C) {
txn2, err := dbt.db.Begin()
c.Assert(err, IsNil)
_, err = txn2.Exec("use db_not_exists;")
checkErrorCode(c, err, tmysql.ErrBadDb)
checkErrorCode(c, err, tmysql.ErrBadDB)
_, err = txn2.Exec("select * from tbl_not_exists;")
checkErrorCode(c, err, tmysql.ErrNoSuchTable)
_, err = txn2.Exec("create database test;")
checkErrorCode(c, err, tmysql.ErrDbCreateExists)
checkErrorCode(c, err, tmysql.ErrDBCreateExists)
_, err = txn2.Exec("create table test (c int);")
checkErrorCode(c, err, tmysql.ErrTableExists)
_, err = txn2.Exec("drop table unknown_table;")
checkErrorCode(c, err, tmysql.ErrBadTable)
_, err = txn2.Exec("drop database unknown_db;")
checkErrorCode(c, err, tmysql.ErrDbDropExists)
checkErrorCode(c, err, tmysql.ErrDBDropExists)

// Optimizer errors
_, err = txn2.Exec("select *, * from test;")
Expand Down

0 comments on commit aaa7333

Please sign in to comment.