1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merge mysql.com:/home/mydev/mysql-4.1-4100

into  mysql.com:/home/mydev/mysql-5.0-5000


myisam/mi_search.c:
  Auto merged
mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
mysql-test/t/innodb.test:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/innodb.result:
  Hand merged.
mysql-test/r/key.result:
  Hand merged.
mysql-test/r/myisam.result:
  Hand merged.
mysql-test/t/key.test:
  Hand merged.
mysql-test/t/myisam.test:
  Hand merged.
sql/sql_delete.cc:
  Hand merged.
sql/sql_parse.cc:
  Hand merged.
This commit is contained in:
unknown
2005-08-29 18:18:30 +02:00
12 changed files with 205 additions and 25 deletions

View File

@@ -768,6 +768,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);
@@ -786,7 +788,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)
{
@@ -798,19 +800,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));
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);
}
@@ -844,4 +834,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));
ha_enable_transaction(thd, TRUE);
thd->options= save_options;
DBUG_RETURN(error);
}