From aaa733335952f4f04c2da13fd1ba393f5e757518 Mon Sep 17 00:00:00 2001 From: xia Date: Thu, 31 Mar 2016 15:51:44 +0800 Subject: [PATCH] mysql: rename Db to DB --- infoschema/infoschema.go | 10 +++++----- meta/meta.go | 4 ++-- mysql/errcode.go | 28 ++++++++++++++-------------- mysql/errname.go | 28 ++++++++++++++-------------- mysql/error_test.go | 4 ++-- mysql/state.go | 8 ++++---- tidb-server/server/server_test.go | 6 +++--- 7 files changed, 44 insertions(+), 44 deletions(-) diff --git a/infoschema/infoschema.go b/infoschema/infoschema.go index f1c4bfdff7498..4eb026acb0ea2 100644 --- a/infoschema/infoschema.go +++ b/infoschema/infoschema.go @@ -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. @@ -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 @@ -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, diff --git a/meta/meta.go b/meta/meta.go index 7780a92ad1c9f..3d39e931ec93f 100644 --- a/meta/meta.go +++ b/meta/meta.go @@ -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, } diff --git a/mysql/errcode.go b/mysql/errcode.go index f792a27c2b192..e4072f8bf8030 100644 --- a/mysql/errcode.go +++ b/mysql/errcode.go @@ -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 @@ -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 @@ -119,7 +119,7 @@ const ( ErrTableNotLockedForWrite = 1099 ErrTableNotLocked = 1100 ErrBlobCantHaveDefault = 1101 - ErrWrongDbName = 1102 + ErrWrongDBName = 1102 ErrWrongTableName = 1103 ErrTooBigSelect = 1104 ErrUnknown = 1105 @@ -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 @@ -261,7 +261,7 @@ const ( ErrOperandColumns = 1241 ErrSubqueryNo1Row = 1242 ErrUnknownStmtHandler = 1243 - ErrCorruptHelpDb = 1244 + ErrCorruptHelpDB = 1244 ErrCyclicReference = 1245 ErrAutoConvert = 1246 ErrIllegalReference = 1247 @@ -594,7 +594,7 @@ const ( ErrRbrNotAvailable = 1574 ErrBase64Decode = 1575 ErrEventRecursionForbidden = 1576 - ErrEventsDb = 1577 + ErrEventsDB = 1577 ErrOnlyIntegersAllowed = 1578 ErrUnsuportedLogEngine = 1579 ErrBadLogStatement = 1580 @@ -771,7 +771,7 @@ const ( ErrWarningNotCompleteRollbackWithCreatedTempTable = 1751 ErrWarningNotCompleteRollbackWithDroppedTempTable = 1752 ErrMtsFeatureIsNotSupported = 1753 - ErrMtsUpdatedDbsGreaterMax = 1754 + ErrMtsUpdatedDBsGreaterMax = 1754 ErrMtsCantParallel = 1755 ErrMtsInconsistentData = 1756 ErrFulltextNotSupportedWithPartitioning = 1757 diff --git a/mysql/errname.go b/mysql/errname.go index eb7588e33c75e..56d0374a5abca 100644 --- a/mysql/errname.go +++ b/mysql/errname.go @@ -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)", @@ -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", @@ -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", @@ -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", @@ -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)", @@ -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", @@ -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.", diff --git a/mysql/error_test.go b/mysql/error_test.go index 1e499ff304b81..a57c548353f7d 100644 --- a/mysql/error_test.go +++ b/mysql/error_test.go @@ -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") diff --git a/mysql/state.go b/mysql/state.go index 8034e29c8eb2a..e341aa0b061d1 100644 --- a/mysql/state.go +++ b/mysql/state.go @@ -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", @@ -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", diff --git a/tidb-server/server/server_test.go b/tidb-server/server/server_test.go index dbdbf36fcc0fd..649b53a7c4c94 100644 --- a/tidb-server/server/server_test.go +++ b/tidb-server/server/server_test.go @@ -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;")