diff options
author | unknown <monty@hundin.mysql.fi> | 2001-09-02 13:47:00 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2001-09-02 13:47:00 +0300 |
commit | b67d11e17ca6ae8b4b0a0d5a5b5fccceff641a26 (patch) | |
tree | e5581eaf73302fbd721a4c17983fb6fdfca266d0 /sql/sql_table.cc | |
parent | fc14066488c52252779495a411fee6de2e478192 (diff) | |
download | mariadb-git-b67d11e17ca6ae8b4b0a0d5a5b5fccceff641a26.tar.gz |
Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB
Fix that DROP DATABASE works with all table types
Use BULK_INSERT when inserting more than one row
Better TRUNCATE TABLE
BitKeeper/deleted/.del-compilation_finished.au.gz~70bd14095a918139:
Delete: sounds/compilation_finished.au.gz
BUILD/FINISH.sh:
Removed 'finished' sound as this isn't a general solution.
Docs/manual.texi:
Added upgrading from 3.23
configure.in:
Fixed version number
sql/ha_innobase.cc:
Default creation of InnoDB tables.
sql/ha_myisam.cc:
Disable BULK_INSERT of using safe mode
sql/handler.cc:
Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB
sql/handler.h:
Changed DB_TYPE_INNOBASE to DB_TYPE_INNODB
sql/lock.cc:
Added lock_and_wait_for_table_name
sql/mysql_priv.h:
Better TRUNCATE TABLE
sql/sql_db.cc:
Fix that DROP DATABASE works with all table types
sql/sql_delete.cc:
Better TRUNCATE TABLE
sql/sql_insert.cc:
Use BULK_INSERT when inserting more than one row
sql/sql_load.cc:
Small bug fix.
sql/sql_parse.cc:
Better TRUNCATE TABLE
sql/sql_select.cc:
Change INNOBASE -> INNODB
sql/sql_table.cc:
Better TRUNCATE TABLE
sql/sql_yacc.yy:
INNOBASE -> INNODB
sql/thr_malloc.cc:
Fix for replication
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 81 |
1 files changed, 36 insertions, 45 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f8c3aa59d65..f248c675e8e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -43,12 +43,7 @@ static int copy_data_between_tables(TABLE *from,TABLE *to, int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) { - char path[FN_REFLEN]; - String wrong_tables; - bool some_tables_deleted=0; - uint error; - db_type table_type; - TABLE_LIST *table; + int error; DBUG_ENTER("mysql_rm_table"); /* mark for close and remove all cached entries */ @@ -74,7 +69,35 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) } } - + error=mysql_rm_table_part2(thd,tables,if_exists,0); + + err: + VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh + pthread_mutex_unlock(&LOCK_open); + + pthread_mutex_lock(&thd->mysys_var->mutex); + thd->mysys_var->current_mutex= 0; + thd->mysys_var->current_cond= 0; + pthread_mutex_unlock(&thd->mysys_var->mutex); + + if (error) + DBUG_RETURN(-1); + send_ok(&thd->net); + DBUG_RETURN(0); +} + + +int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, + bool dont_log_query) +{ + TABLE_LIST *table; + char path[FN_REFLEN]; + String wrong_tables; + db_type table_type; + int error; + bool some_tables_deleted=0; + DBUG_ENTER("mysql_rm_table_part2"); + for (table=tables ; table ; table=table->next) { char *db=table->db ? table->db : thd->db; @@ -137,7 +160,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) wrong_tables.append(String(table->real_name)); } } - if (some_tables_deleted) + if (some_tables_deleted && !dont_log_query) { mysql_update_log.write(thd, thd->query,thd->query_length); if (mysql_bin_log.is_open()) @@ -148,24 +171,12 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists) } error = 0; - err: - VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh - pthread_mutex_unlock(&LOCK_open); - - pthread_mutex_lock(&thd->mysys_var->mutex); - thd->mysys_var->current_mutex= 0; - thd->mysys_var->current_cond= 0; - pthread_mutex_unlock(&thd->mysys_var->mutex); - if (wrong_tables.length()) { my_error(ER_BAD_TABLE_ERROR,MYF(0),wrong_tables.c_ptr()); error=1; } - if(error) - DBUG_RETURN(-1); - send_ok(&thd->net); - DBUG_RETURN(0); + DBUG_RETURN(error); } @@ -837,21 +848,8 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table) sprintf(dst_path, "%s/%s/%s", mysql_real_data_home, db, table_name); - int lock_retcode; - pthread_mutex_lock(&LOCK_open); - if ((lock_retcode = lock_table_name(thd, table)) < 0) - { - pthread_mutex_unlock(&LOCK_open); - DBUG_RETURN(-1); - } - - if (lock_retcode && wait_for_locked_table_names(thd, table)) - { - unlock_table_name(thd, table); - pthread_mutex_unlock(&LOCK_open); + if (lock_and_wait_for_table_name(thd,table)) DBUG_RETURN(-1); - } - pthread_mutex_unlock(&LOCK_open); if (my_copy(src_path, fn_format(dst_path, dst_path,"", @@ -862,25 +860,18 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table) DBUG_RETURN(send_check_errmsg(thd, table, "restore", "Failed copying .frm file")); } - bool save_no_send_ok = thd->net.no_send_ok; - thd->net.no_send_ok = 1; - // generate table will try to send OK which messes up the output - // for the client - - if (generate_table(thd, table, 0)) + if (mysql_truncate(thd, table, 1)) { unlock_table_name(thd, table); - thd->net.no_send_ok = save_no_send_ok; DBUG_RETURN(send_check_errmsg(thd, table, "restore", "Failed generating table from .frm file")); } - - thd->net.no_send_ok = save_no_send_ok; + /* truncate has released name lock */ } - DBUG_RETURN(0); } + static int mysql_admin_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt, const char *operator_name, |