diff options
author | unknown <gni/root@dev3-221.dev.cn.tlan> | 2007-04-03 18:44:29 +0800 |
---|---|---|
committer | unknown <gni/root@dev3-221.dev.cn.tlan> | 2007-04-03 18:44:29 +0800 |
commit | 5203ea6ccb349aae5e53e3f0247256a9fc60208e (patch) | |
tree | f54056d12cacaac1d0a887906fd01c6d9ab2c9b9 /sql/sql_table.cc | |
parent | 1f7b3e569df0212219c0741aa70f240f09e02772 (diff) | |
download | mariadb-git-5203ea6ccb349aae5e53e3f0247256a9fc60208e.tar.gz |
BUG#18676 when cluster storage engine is down, misleading error message on create table with 4009.
mysql-test/r/ndb_autodiscover.result:
changes ndbd error code to mysqld error code when no cluster connection
sql/ha_ndbcluster.cc:
map 4009 error code to mysql not connected error
sql/handler.cc:
define return codes to ha_table_exists_in_engine to something useful
NOTE: in 5.1 this should call a handlerton method, not horrible ifdef ndb stuff
sql/sql_table.cc:
clearly define what happens on create table if exits/not exists/not connected to engine
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 512d990347f..1ad1cb6426b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1696,6 +1696,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, alias); DBUG_RETURN(FALSE); } + DBUG_PRINT("info",("1")); my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias); DBUG_RETURN(TRUE); } @@ -1706,6 +1707,7 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, { if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) goto warn; + DBUG_PRINT("info",("2")); my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); goto end; } @@ -1724,14 +1726,25 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name, { bool create_if_not_exists = create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS; - if (ha_table_exists_in_engine(thd, db, table_name)) + int retcode = ha_table_exists_in_engine(thd, db, table_name); + DBUG_PRINT("info", ("exists_in_engine: %u",retcode)); + switch (retcode) { - DBUG_PRINT("info", ("Table with same name already existed in handler")); + case HA_ERR_NO_SUCH_TABLE: + /* Normal case, no table exists. we can go and create it */ + break; + case HA_ERR_TABLE_EXIST: + DBUG_PRINT("info", ("Table existed in handler")); - if (create_if_not_exists) - goto warn; - my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); - goto end; + if (create_if_not_exists) + goto warn; + my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); + goto end; + break; + default: + DBUG_PRINT("info", ("error: %u from storage engine", retcode)); + my_error(retcode, MYF(0),table_name); + goto end; } } |