summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorvva@eagle.mysql.r18.ru <>2004-04-03 02:44:38 +0500
committervva@eagle.mysql.r18.ru <>2004-04-03 02:44:38 +0500
commit8cc3b3cfdcb36562160ca3f8570684d8f33ba856 (patch)
tree04e49a857e720460475ff9d3941032ffff965c24 /sql/sql_table.cc
parent15cd52c6cb1e69b118f03e8cca4a3b61f3125534 (diff)
downloadmariadb-git-8cc3b3cfdcb36562160ca3f8570684d8f33ba856.tar.gz
made some optimization of last patch for
Bug #2385 "CREATE TABLE LIKE lacks locking on source and destination table" (in sql_table.cc and mysql-test/t/synchronization.test)
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 8a1ecc115df..e06b0efaadf 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1986,27 +1986,25 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
mysql_bin_log.write(&qinfo);
}
res= 0;
-
-err:
- pthread_mutex_lock(&LOCK_open);
- unlock_table_name(thd, &src_tables_list);
- pthread_mutex_unlock(&LOCK_open);
- DBUG_RETURN(res);
+ goto err;
table_exists:
- pthread_mutex_lock(&LOCK_open);
- unlock_table_name(thd, &src_tables_list);
- pthread_mutex_unlock(&LOCK_open);
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff,ER(ER_TABLE_EXISTS_ERROR),table_name);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_EXISTS_ERROR,warn_buff);
- DBUG_RETURN(0);
+ res= 0;
}
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
- DBUG_RETURN(-1);
+ else
+ my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+
+err:
+ pthread_mutex_lock(&LOCK_open);
+ unlock_table_name(thd, &src_tables_list);
+ pthread_mutex_unlock(&LOCK_open);
+ DBUG_RETURN(res);
}