summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-07-27 13:05:30 +0300
committerunknown <monty@mysql.com>2005-07-27 13:05:30 +0300
commiteb7dadb0c16aeda52225ad56708911114c501b38 (patch)
tree98f6433b43d4608089696991aa88d949421481d7
parentd98177e4cb718d6aa80a4438aa2a953cf660ea1c (diff)
downloadmariadb-git-eb7dadb0c16aeda52225ad56708911114c501b38.tar.gz
Review of new code:
Change argument order to be database, tablename for some functions sql/lock.cc: Remove not needed block sql/mysql_priv.h: Change argument order to be database, tablename (like in most other functions) sql/sql_table.cc: Change argument order to be database, tablename (like in most other functions) Make 'flags' inline sql/table.cc: Change argument order to be database, tablename (like in most other functions) sql/unireg.cc: Change argument order to be database, tablename (like in most other functions)
-rw-r--r--sql/lock.cc7
-rw-r--r--sql/mysql_priv.h6
-rw-r--r--sql/sql_table.cc19
-rw-r--r--sql/table.cc2
-rw-r--r--sql/unireg.cc12
5 files changed, 22 insertions, 24 deletions
diff --git a/sql/lock.cc b/sql/lock.cc
index f8697cd9bc6..c198ff1e7d4 100644
--- a/sql/lock.cc
+++ b/sql/lock.cc
@@ -584,12 +584,9 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(-1);
}
+ if (remove_table_from_cache(thd, db, table_list->real_name, RTFC_NO_FLAG))
{
- if (remove_table_from_cache(thd, db,
- table_list->real_name, RTFC_NO_FLAG))
- {
- DBUG_RETURN(1); // Table is in use
- }
+ DBUG_RETURN(1); // Table is in use
}
DBUG_RETURN(0);
}
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 4b570c7bbd1..53a2273eb6e 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1029,12 +1029,12 @@ void unlock_table_names(THD *thd, TABLE_LIST *table_list,
void unireg_init(ulong options);
void unireg_end(void);
bool mysql_create_frm(THD *thd, my_string file_name,
- const char *table, const char* db,
+ const char *db, const char *table,
HA_CREATE_INFO *create_info,
List<create_field> &create_field,
uint key_count,KEY *key_info,handler *db_type);
int rea_create_table(THD *thd, my_string file_name,
- const char *table, const char* db,
+ const char *db, const char *table,
HA_CREATE_INFO *create_info,
List<create_field> &create_field,
uint key_count,KEY *key_info);
@@ -1107,7 +1107,7 @@ ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
const char *newname);
ulong next_io_size(ulong pos);
void append_unescaped(String *res, const char *pos, uint length);
-int create_frm(char *name, const char *table, const char *db,
+int create_frm(char *name, const char *db, const char *table,
uint reclength,uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys);
void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 69d13e19309..87b864c73fa 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -220,7 +220,6 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
for (table=tables ; table ; table=table->next)
{
char *db=table->db;
- uint flags;
mysql_ha_flush(thd, table, MYSQL_HA_CLOSE_FINAL);
if (!close_temporary_table(thd, db, table->real_name))
{
@@ -232,8 +231,9 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
if (!drop_temporary)
{
abort_locked_tables(thd,db,table->real_name);
- flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG;
- remove_table_from_cache(thd,db,table->real_name,flags);
+ remove_table_from_cache(thd,db,table->real_name,
+ RTFC_WAIT_OTHER_THREAD_FLAG |
+ RTFC_CHECK_KILLED_FLAG);
drop_locked_tables(thd,db,table->real_name);
if (thd->killed)
DBUG_RETURN(-1);
@@ -1418,7 +1418,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
create_info->data_file_name= create_info->index_file_name= 0;
create_info->table_options=db_options;
- if (rea_create_table(thd, path, table_name, db,
+ if (rea_create_table(thd, path, db, table_name,
create_info, fields, key_count,
key_info_buffer))
goto end;
@@ -1979,14 +1979,14 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
/* Close all instances of the table to allow repair to rename files */
if (lock_type == TL_WRITE && table->table->version)
{
- uint flags;
pthread_mutex_lock(&LOCK_open);
const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_open,
"Waiting to get writelock");
mysql_lock_abort(thd,table->table);
- flags= RTFC_WAIT_OTHER_THREAD_FLAG | RTFC_CHECK_KILLED_FLAG;
remove_table_from_cache(thd, table->table->table_cache_key,
- table->table->real_name, flags);
+ table->table->real_name,
+ RTFC_WAIT_OTHER_THREAD_FLAG |
+ RTFC_CHECK_KILLED_FLAG);
thd->exit_cond(old_message);
if (thd->killed)
goto err;
@@ -3410,9 +3410,10 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (table)
{
VOID(table->file->extra(HA_EXTRA_FORCE_REOPEN)); // Use new file
+ /* Mark in-use copies old */
remove_table_from_cache(thd,db,table_name,RTFC_NO_FLAG);
- // Mark in-use copies old
- mysql_lock_abort(thd,table); // end threads waiting on lock
+ /* end threads waiting on lock */
+ mysql_lock_abort(thd,table);
}
VOID(quick_rm_table(old_db_type,db,old_name));
if (close_data_tables(thd,db,table_name) ||
diff --git a/sql/table.cc b/sql/table.cc
index eb8746cec53..04d1a95cd9b 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1238,7 +1238,7 @@ void append_unescaped(String *res, const char *pos, uint length)
/* Create a .frm file */
-File create_frm(register my_string name, const char *table, const char *db,
+File create_frm(register my_string name, const char *db, const char *table,
uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys)
{
diff --git a/sql/unireg.cc b/sql/unireg.cc
index a3d461513b8..e3bf763f700 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -56,8 +56,8 @@ static bool make_empty_rec(int file, enum db_type table_type,
mysql_create_frm()
thd Thread handler
file_name Name of file (including database and .frm)
- table Name of table
db Name of database
+ table Name of table
create_info create info parameters
create_fields Fields to create
keys number of keys to create
@@ -70,7 +70,7 @@ static bool make_empty_rec(int file, enum db_type table_type,
*/
bool mysql_create_frm(THD *thd, my_string file_name,
- const char *table, const char *db,
+ const char *db, const char *table,
HA_CREATE_INFO *create_info,
List<create_field> &create_fields,
uint keys, KEY *key_info,
@@ -117,7 +117,7 @@ bool mysql_create_frm(THD *thd, my_string file_name,
reclength=uint2korr(forminfo+266);
null_fields=uint2korr(forminfo+282);
- if ((file=create_frm(file_name, table, db, reclength, fileinfo,
+ if ((file=create_frm(file_name, db, table, reclength, fileinfo,
create_info, keys)) < 0)
{
my_free((gptr) screen_buff,MYF(0));
@@ -219,8 +219,8 @@ err3:
rea_create_table()
thd Thread handler
file_name Name of file (including database and .frm)
- table Name of table
db Name of database
+ table Name of table
create_info create info parameters
create_fields Fields to create
keys number of keys to create
@@ -233,14 +233,14 @@ err3:
*/
int rea_create_table(THD *thd, my_string file_name,
- const char *table, const char *db,
+ const char *db, const char *table,
HA_CREATE_INFO *create_info,
List<create_field> &create_fields,
uint keys, KEY *key_info)
{
DBUG_ENTER("rea_create_table");
- if (mysql_create_frm(thd, file_name, table, db, create_info,
+ if (mysql_create_frm(thd, file_name, db, table, create_info,
create_fields, keys, key_info, NULL))
DBUG_RETURN(1);
if (ha_create_table(file_name,create_info,0))