summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authormsvensson@neptunus.(none) <>2005-06-08 13:31:59 +0200
committermsvensson@neptunus.(none) <>2005-06-08 13:31:59 +0200
commit8771c73258a1e1c25be67ed342280a8d3f6a84c0 (patch)
treeb82e8da8fb00ab3aeb74266b31c0094ac048b5a8 /sql/sql_table.cc
parentdbcf3b3a2e4da8568a3d08efc61c17e205382a72 (diff)
downloadmariadb-git-8771c73258a1e1c25be67ed342280a8d3f6a84c0.tar.gz
BUG#10365 Cluster handler uses non-standard error codes
- Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table. - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 67aade519f5..70dd17cc8bc 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -217,15 +217,18 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
strxmov(path, mysql_data_home, "/", db, "/", alias, reg_ext, NullS);
(void) unpack_filename(path,path);
}
- if (drop_temporary ||
- (access(path,F_OK) && ha_create_table_from_engine(thd,db,alias,TRUE)))
+ if (drop_temporary ||
+ (access(path,F_OK) &&
+ ha_create_table_from_engine(thd, db, alias)))
{
+ // Table was not found on disk and table can't be created from engine
if (if_exists)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
table->real_name);
else
- error= 1;
+ error= 1;
+
}
else
{
@@ -1371,15 +1374,14 @@ int 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_create_table_from_engine(thd, db, table_name,
- create_if_not_exists))
+ if (ha_table_exists_in_engine(thd, db, table_name))
{
- DBUG_PRINT("info", ("Table already existed in handler"));
+ DBUG_PRINT("info", ("Table with same name already existed in handler"));
if (create_if_not_exists)
{
- create_info->table_existed= 1; // Mark that table existed
- error= 0;
+ create_info->table_existed= 1; // Mark that table existed
+ error= 0;
}
else
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);