summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-09-03 05:16:15 +0300
committerunknown <monty@hundin.mysql.fi>2001-09-03 05:16:15 +0300
commit5160501770aafc0b2b9ee287e5a8b7627b1b51bb (patch)
treee5faac23f2977c577bc7fac42a2b90e5f53f2855 /sql/sql_delete.cc
parentb4a417109c16fcb15c2ad050ba156f1bdf099e5e (diff)
downloadmariadb-git-5160501770aafc0b2b9ee287e5a8b7627b1b51bb.tar.gz
Update of manual with 4.0 changes
Create innodb table space if configuring with InnoDB and not using --skip-innodb Fixes for TRUNCATE TABLE and DROP DATABASE. Docs/manual.texi: Update of manual with 4.0 changes. mysql-test/mysql-test-run.sh: Fixed option --mysqld mysql-test/r/innodb.result: More test cases mysql-test/r/truncate.result: More test cases mysql-test/t/drop.test: More test cases mysql-test/t/innodb.test: More test cases mysql-test/t/truncate.test: More test cases sql/gen_lex_hash.cc: Smaller array sql/ha_innobase.cc: Create innodb table space if not using --skip-innodb sql/lock.cc: Fixed wrong mutex handling in global read lock. sql/md5.c: Fixed bug from merge sql/sql_base.cc: cleanup sql/sql_db.cc: Use new global lock functions. Fixed new bug that database wasn't always dropped. sql/sql_delete.cc: Fixed problem with mysql_truncate() when called from restore_table sql/sql_parse.cc: Fixed error message handling. sql/sql_table.cc: cleanup
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 1a855c927a4..afaa310cbfb 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -488,6 +488,7 @@ bool multi_delete::send_eof()
normally can't safely do this.
- We don't want an ok to be sent to the end user.
- We don't want to log the truncate command
+ - If we want to have a name lock on the table on exit without errors.
*/
int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
@@ -499,8 +500,8 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
DBUG_ENTER("mysql_truncate");
/* If it is a temporary table, close and regenerate it */
- if ((table_ptr=find_temporary_table(thd,table_list->db,
- table_list->real_name)))
+ if (!dont_send_ok && (table_ptr=find_temporary_table(thd,table_list->db,
+ table_list->real_name)))
{
TABLE *table= *table_ptr;
HA_CREATE_INFO create_info;
@@ -536,7 +537,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
{
/* Probably InnoDB table */
DBUG_RETURN(mysql_delete(thd,table_list, (COND*) 0, (ORDER*) 0,
- (ha_rows) 0, TL_WRITE, 0));
+ HA_POS_ERROR, TL_WRITE, 0));
}
if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(-1);
@@ -545,18 +546,22 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
bzero((char*) &create_info,sizeof(create_info));
*fn_ext(path)=0; // Remove the .frm extension
error= ha_create_table(path,&create_info,1) ? -1 : 0;
- VOID(pthread_mutex_unlock(&LOCK_open));
- if (!error && !dont_send_ok)
+ if (!dont_send_ok)
{
- mysql_update_log.write(thd,thd->query,thd->query_length);
- if (mysql_bin_log.is_open())
+ if (!error)
{
- Query_log_event qinfo(thd, thd->query);
- mysql_bin_log.write(&qinfo);
+ mysql_update_log.write(thd,thd->query,thd->query_length);
+ if (mysql_bin_log.is_open())
+ {
+ Query_log_event qinfo(thd, thd->query);
+ mysql_bin_log.write(&qinfo);
+ }
+ send_ok(&thd->net); // This should return record count
}
- send_ok(&thd->net); // This should return record count
+ unlock_table_name(thd, table_list);
}
- unlock_table_name(thd, table_list);
+ else if (error)
+ unlock_table_name(thd, table_list);
DBUG_RETURN(error ? -1 : 0);
}