summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2005-08-30 12:35:37 +0200
committerunknown <ingo@mysql.com>2005-08-30 12:35:37 +0200
commit40e1a3f53049670073afbfe4a29b4966113938af (patch)
tree53c1440916313313e88f5095f3618810e0090262 /sql/sql_delete.cc
parent954590b10c28235f72367c2660dddc1e0f8f23a2 (diff)
parenta830cefa503fe1cc28a91a40b04c295ce1a5c6d7 (diff)
downloadmariadb-git-40e1a3f53049670073afbfe4a29b4966113938af.tar.gz
Merge mysql.com:/home/mydev/mysql-5.0
into mysql.com:/home/mydev/mysql-5.0-5000 mysql-test/r/innodb.result: Auto merged mysql-test/t/innodb.test: Auto merged sql/sql_parse.cc: Auto merged sql/sql_delete.cc: After merge fix.
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index c7fabdaf18e..4e86e3972c2 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -791,6 +791,8 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
TABLE *table= *table_ptr;
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
db_type table_type= table->s->db_type;
+ if (!ha_supports_generate(table_type))
+ goto trunc_by_del;
strmov(path, table->s->path);
*table_ptr= table->next; // Unlink table from list
close_temporary(table,0);
@@ -809,7 +811,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
(void) sprintf(path,"%s/%s/%s%s",mysql_data_home,table_list->db,
table_list->table_name,reg_ext);
- fn_format(path,path,"","",4);
+ fn_format(path, path, "", "", MY_UNPACK_FILENAME);
if (!dont_send_ok)
{
@@ -821,19 +823,7 @@ bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
DBUG_RETURN(TRUE);
}
if (!ha_supports_generate(table_type) || thd->lex->sphead)
- {
- /* Probably InnoDB table */
- ulong save_options= thd->options;
- table_list->lock_type= TL_WRITE;
- thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
- ha_enable_transaction(thd, FALSE);
- mysql_init_select(thd->lex);
- error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
- HA_POS_ERROR, LL(0), TRUE);
- ha_enable_transaction(thd, TRUE);
- thd->options= save_options;
- DBUG_RETURN(error);
- }
+ goto trunc_by_del;
if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(TRUE);
}
@@ -867,4 +857,17 @@ end:
VOID(pthread_mutex_unlock(&LOCK_open));
}
DBUG_RETURN(error);
+
+ trunc_by_del:
+ /* Probably InnoDB table */
+ ulong save_options= thd->options;
+ table_list->lock_type= TL_WRITE;
+ thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_NOT_AUTOCOMMIT);
+ ha_enable_transaction(thd, FALSE);
+ mysql_init_select(thd->lex);
+ error= mysql_delete(thd, table_list, (COND*) 0, (SQL_LIST*) 0,
+ HA_POS_ERROR, LL(0), TRUE);
+ ha_enable_transaction(thd, TRUE);
+ thd->options= save_options;
+ DBUG_RETURN(error);
}