Commit 834ca9f5 authored by unknown's avatar unknown

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
parent 33e00db8
This diff is collapsed.
...@@ -171,7 +171,7 @@ while test $# -gt 0; do ...@@ -171,7 +171,7 @@ while test $# -gt 0; do
;; ;;
--mysqld=*) --mysqld=*)
TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"` TMP=`$ECHO "$1" | $SED -e "s;--mysqld=;;"`
EXTRA_MYSQL_TEST_OPT="$EXTRA_MYSQL_TEST_OPT $TMP" EXTRA_MASTER_MYSQLD_OPT="$EXTRA_MASTER_MYSQLD_OPT $TMP"
EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $TMP" EXTRA_SLAVE_MYSQLD_OPT="$EXTRA_SLAVE_MYSQLD_OPT $TMP"
;; ;;
--gcov ) --gcov )
......
...@@ -479,3 +479,5 @@ id name value uid ...@@ -479,3 +479,5 @@ id name value uid
1 one one value 101 1 one one value 101
3 three three value 103 3 three three value 103
6 two other value 102 6 two other value 102
a
a
...@@ -2,3 +2,4 @@ count(*) ...@@ -2,3 +2,4 @@ count(*)
0 0
count(*) count(*)
1 1
a b c1
...@@ -28,16 +28,16 @@ drop database foo; ...@@ -28,16 +28,16 @@ drop database foo;
# test drop/create database and FLUSH TABLES WITH READ LOCK # test drop/create database and FLUSH TABLES WITH READ LOCK
drop database if exists foo; drop database if exists foo;
flush tables with read lock; flush tables with read lock;
--error 1209 --error 1209,1218;
create database foo; create database foo;
unlock tables; unlock tables;
create database foo; create database foo;
show databases; show databases;
flush tables with read lock; flush tables with read lock;
--error 1208 --error 1208,1218;
drop database foo; drop database foo;
unlock tables; unlock tables;
drop database foo; drop database foo;
show databases; show databases;
--error 1008
drop database foo;
...@@ -512,3 +512,37 @@ replace into t1 (value,name,uid) values ('other value','two',102); ...@@ -512,3 +512,37 @@ replace into t1 (value,name,uid) values ('other value','two',102);
select * from t1; select * from t1;
drop table t1; drop table t1;
#
# Test DROP DATABASE
#
create database test_$1;
create table test_$1.t1 (a int not null) type= innodb;
insert into test_$1.t1 values(1);
create table test_$1.t2 (a int not null) type= myisam;
insert into test_$1.t2 values(1);
create table test_$1.t3 (a int not null) type= heap;
insert into test_$1.t3 values(1);
commit;
drop database test_$1;
--error 12
show tables from test_$1;
#
# Test truncate table
#
create table t1 (a int not null) type= innodb;
insert into t1 values(1),(2);
--error 1192
truncate table t1;
commit;
truncate table t1;
select * from t1;
insert into t1 values(1),(2);
delete from t1;
select * from t1;
commit;
drop table t1;
...@@ -2,10 +2,14 @@ ...@@ -2,10 +2,14 @@
# Test of truncate # Test of truncate
# #
create table t1 (a integer, b integer,c1 CHAR(10)); create table t1 (a integer, b integer,c1 CHAR(10));
insert into t1 (a) values (1),(2);
truncate table t1; truncate table t1;
select count(*) from t1; select count(*) from t1;
insert into t1 values(1,2,"test"); insert into t1 values(1,2,"test");
select count(*) from t1; select count(*) from t1;
delete from t1;
select * from t1;
drop table t1; drop table t1;
# The following should fail # The following should fail
!$1146 select count(*) from t1; --error 1146
select count(*) from t1;
...@@ -472,7 +472,7 @@ int main(int argc,char **argv) ...@@ -472,7 +472,7 @@ int main(int argc,char **argv)
int error; int error;
MY_INIT(argv[0]); MY_INIT(argv[0]);
start_value=6130115L; best_t1=3632784L; best_t2=86437L; best_type=3; /* mode=4229 add=2 type: 0 */ start_value=3579077L; best_t1=6681742L; best_t2=142815L; best_type=3; /* mode=5167 add=7 type: 0 */
if (get_options(argc,(char **) argv)) if (get_options(argc,(char **) argv))
exit(1); exit(1);
......
...@@ -92,7 +92,7 @@ bool innobase_flush_log_at_trx_commit, innobase_log_archive, ...@@ -92,7 +92,7 @@ bool innobase_flush_log_at_trx_commit, innobase_log_archive,
to specify any startup options. to specify any startup options.
*/ */
char *innobase_data_file_path= (char*) "ibdata:64M"; char *innobase_data_file_path= (char*) "ibdata1:64M";
/* The following counter is used to convey information to InnoDB /* The following counter is used to convey information to InnoDB
about server activity: in selects it is not sensible to call about server activity: in selects it is not sensible to call
...@@ -1915,7 +1915,7 @@ ha_innobase::change_active_index( ...@@ -1915,7 +1915,7 @@ ha_innobase::change_active_index(
build_template(prebuilt, user_thd, table, ROW_MYSQL_WHOLE_ROW); build_template(prebuilt, user_thd, table, ROW_MYSQL_WHOLE_ROW);
return(0); DBUG_RETURN(0);
} }
/************************************************************************** /**************************************************************************
......
...@@ -394,8 +394,8 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list) ...@@ -394,8 +394,8 @@ int lock_and_wait_for_table_name(THD *thd, TABLE_LIST *table_list)
error=0; error=0;
end: end:
start_waiting_global_read_lock(thd);
pthread_mutex_unlock(&LOCK_open); pthread_mutex_unlock(&LOCK_open);
start_waiting_global_read_lock(thd);
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -532,6 +532,10 @@ bool lock_global_read_lock(THD *thd) ...@@ -532,6 +532,10 @@ bool lock_global_read_lock(THD *thd)
(void) pthread_mutex_lock(&LOCK_open); (void) pthread_mutex_lock(&LOCK_open);
const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_open, const char *old_message=thd->enter_cond(&COND_refresh, &LOCK_open,
"Waiting to get readlock"); "Waiting to get readlock");
DBUG_PRINT("info",
("waiting_for: %d protect_against: %d",
waiting_for_read_lock, protect_against_global_read_lock));
waiting_for_read_lock++; waiting_for_read_lock++;
while (protect_against_global_read_lock && !thd->killed) while (protect_against_global_read_lock && !thd->killed)
pthread_cond_wait(&COND_refresh, &LOCK_open); pthread_cond_wait(&COND_refresh, &LOCK_open);
...@@ -573,8 +577,9 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh) ...@@ -573,8 +577,9 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh)
if (thd->global_read_lock) // This thread had the read locks if (thd->global_read_lock) // This thread had the read locks
{ {
my_error(ER_CANT_UPDATE_WITH_READLOCK,MYF(0)); my_error(ER_CANT_UPDATE_WITH_READLOCK,MYF(0));
(void) pthread_mutex_unlock(&LOCK_open);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
old_message=thd->enter_cond(&COND_refresh, &LOCK_open, old_message=thd->enter_cond(&COND_refresh, &LOCK_open,
"Waiting for release of readlock"); "Waiting for release of readlock");
while (global_read_lock && ! thd->killed && while (global_read_lock && ! thd->killed &&
...@@ -594,9 +599,11 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh) ...@@ -594,9 +599,11 @@ bool wait_if_global_read_lock(THD *thd, bool abort_on_refresh)
void start_waiting_global_read_lock(THD *thd) void start_waiting_global_read_lock(THD *thd)
{ {
bool tmp; bool tmp;
DBUG_ENTER("start_waiting_global_read_lock");
(void) pthread_mutex_lock(&LOCK_open); (void) pthread_mutex_lock(&LOCK_open);
tmp= (!--protect_against_global_read_lock && waiting_for_read_lock); tmp= (!--protect_against_global_read_lock && waiting_for_read_lock);
(void) pthread_mutex_unlock(&LOCK_open); (void) pthread_mutex_unlock(&LOCK_open);
if (tmp) if (tmp)
pthread_cond_broadcast(&COND_refresh); pthread_cond_broadcast(&COND_refresh);
DBUG_VOID_RETURN;
} }
...@@ -124,7 +124,7 @@ void my_MD5Init (my_MD5_CTX *context) /* context */ ...@@ -124,7 +124,7 @@ void my_MD5Init (my_MD5_CTX *context) /* context */
context. context.
*/ */
void MD5Update ( void my_MD5Update (
my_MD5_CTX *context, /* context */ my_MD5_CTX *context, /* context */
unsigned char *input, /* input block */ unsigned char *input, /* input block */
unsigned int inputLen) /* length of input block */ unsigned int inputLen) /* length of input block */
...@@ -165,9 +165,10 @@ unsigned int inputLen) /* length of input block */ ...@@ -165,9 +165,10 @@ unsigned int inputLen) /* length of input block */
/* MD5 finalization. Ends an MD5 message-digest operation, writing the /* MD5 finalization. Ends an MD5 message-digest operation, writing the
the message digest and zeroizing the context. the message digest and zeroizing the context.
*/ */
void my_MD5Final ( void my_MD5Final (
unsigned char digest[16], /* message digest */ unsigned char digest[16], /* message digest */
MD5_CTX *context) /* context */ my_MD5_CTX *context) /* context */
{ {
unsigned char bits[8]; unsigned char bits[8];
unsigned int idx, padLen; unsigned int idx, padLen;
......
...@@ -691,7 +691,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) ...@@ -691,7 +691,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
if (thd->killed) if (thd->killed)
DBUG_RETURN(0); DBUG_RETURN(0);
TABLE* table; TABLE* table;
if(!(table = table_list->table)) if (!(table = table_list->table))
DBUG_RETURN(0); DBUG_RETURN(0);
char* db = thd->db ? thd->db : table_list->db; char* db = thd->db ? thd->db : table_list->db;
......
...@@ -40,32 +40,13 @@ int mysql_create_db(THD *thd, char *db, uint create_options) ...@@ -40,32 +40,13 @@ int mysql_create_db(THD *thd, char *db, uint create_options)
DBUG_ENTER("mysql_create_db"); DBUG_ENTER("mysql_create_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
VOID(pthread_mutex_lock(&LOCK_open));
// do not create database if another thread is holding read lock // do not create database if another thread is holding read lock
if (global_read_lock) if (wait_if_global_read_lock(thd,0))
{ {
if (thd->global_read_lock) error= -1;
{ goto exit2;
net_printf(&thd->net, ER_CREATE_DB_WITH_READ_LOCK);
VOID(pthread_mutex_unlock(&LOCK_open));
goto exit;
}
while (global_read_lock && ! thd->killed)
{
(void) pthread_cond_wait(&COND_refresh,&LOCK_open);
}
if (thd->killed)
{
net_printf(&thd->net, ER_SERVER_SHUTDOWN);
VOID(pthread_mutex_unlock(&LOCK_open));
goto exit;
}
} }
VOID(pthread_mutex_unlock(&LOCK_open));
/* Check directory */ /* Check directory */
(void)sprintf(path,"%s/%s", mysql_data_home, db); (void)sprintf(path,"%s/%s", mysql_data_home, db);
...@@ -75,7 +56,7 @@ int mysql_create_db(THD *thd, char *db, uint create_options) ...@@ -75,7 +56,7 @@ int mysql_create_db(THD *thd, char *db, uint create_options)
my_dirend(dirp); my_dirend(dirp);
if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS)) if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS))
{ {
if(thd) if (thd)
net_printf(&thd->net,ER_DB_CREATE_EXISTS,db); net_printf(&thd->net,ER_DB_CREATE_EXISTS,db);
error = 1; error = 1;
goto exit; goto exit;
...@@ -87,14 +68,14 @@ int mysql_create_db(THD *thd, char *db, uint create_options) ...@@ -87,14 +68,14 @@ int mysql_create_db(THD *thd, char *db, uint create_options)
strend(path)[-1]=0; // Remove last '/' from path strend(path)[-1]=0; // Remove last '/' from path
if (my_mkdir(path,0777,MYF(0)) < 0) if (my_mkdir(path,0777,MYF(0)) < 0)
{ {
if(thd) if (thd)
net_printf(&thd->net,ER_CANT_CREATE_DB,db,my_errno); net_printf(&thd->net,ER_CANT_CREATE_DB,db,my_errno);
error = 1; error = 1;
goto exit; goto exit;
} }
} }
if(thd) if (thd)
{ {
if (!thd->query) if (!thd->query)
{ {
...@@ -117,7 +98,10 @@ int mysql_create_db(THD *thd, char *db, uint create_options) ...@@ -117,7 +98,10 @@ int mysql_create_db(THD *thd, char *db, uint create_options)
} }
send_ok(&thd->net, result); send_ok(&thd->net, result);
} }
exit: exit:
start_waiting_global_read_lock(thd);
exit2:
VOID(pthread_mutex_unlock(&LOCK_mysql_create_db)); VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -126,6 +110,10 @@ const char *del_exts[]= {".frm", ".BAK", NullS}; ...@@ -126,6 +110,10 @@ const char *del_exts[]= {".frm", ".BAK", NullS};
static TYPELIB deletable_extentions= static TYPELIB deletable_extentions=
{array_elements(del_exts)-1,"del_exts", del_exts}; {array_elements(del_exts)-1,"del_exts", del_exts};
const char *known_exts[]=
{".ISM",".ISD",".ISM",".MRG",".MYI",".MYD", ".db", NullS};
static TYPELIB known_extentions=
{array_elements(del_exts)-1,"del_exts", known_exts};
/* /*
Drop all tables in a database. Drop all tables in a database.
...@@ -145,11 +133,13 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists) ...@@ -145,11 +133,13 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists)
DBUG_ENTER("mysql_rm_db"); DBUG_ENTER("mysql_rm_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db)); VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
VOID(pthread_mutex_lock(&LOCK_open));
// do not drop database if another thread is holding read lock // do not drop database if another thread is holding read lock
if (wait_if_global_read_lock(thd,0)) if (wait_if_global_read_lock(thd,0))
goto exit; {
error= -1;
goto exit2;
}
(void) sprintf(path,"%s/%s",mysql_data_home,db); (void) sprintf(path,"%s/%s",mysql_data_home,db);
unpack_dirname(path,path); // Convert if not unix unpack_dirname(path,path); // Convert if not unix
...@@ -188,14 +178,14 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists) ...@@ -188,14 +178,14 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists)
thd->query = 0; // just in case thd->query = 0; // just in case
thd->query_length = 0; thd->query_length = 0;
} }
send_ok(&thd->net,(ulong) deleted); send_ok(&thd->net,(ulong) deleted);
error = 0;
} }
exit: exit:
VOID(pthread_mutex_unlock(&LOCK_open));
VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
start_waiting_global_read_lock(thd); start_waiting_global_read_lock(thd);
exit2:
VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
DBUG_RETURN(error); DBUG_RETURN(error);
} }
...@@ -246,7 +236,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, ...@@ -246,7 +236,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
} }
if (find_type(fn_ext(file->name),&deletable_extentions,1+2) <= 0) if (find_type(fn_ext(file->name),&deletable_extentions,1+2) <= 0)
{ {
found_other_files++; if (find_type(fn_ext(file->name),&known_extentions,1+2) <= 0)
found_other_files++;
continue; continue;
} }
strxmov(filePath,org_path,"/",file->name,NullS); strxmov(filePath,org_path,"/",file->name,NullS);
......
...@@ -488,6 +488,7 @@ bool multi_delete::send_eof() ...@@ -488,6 +488,7 @@ bool multi_delete::send_eof()
normally can't safely do this. normally can't safely do this.
- We don't want an ok to be sent to the end user. - We don't want an ok to be sent to the end user.
- We don't want to log the truncate command - 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) 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) ...@@ -499,8 +500,8 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
DBUG_ENTER("mysql_truncate"); DBUG_ENTER("mysql_truncate");
/* If it is a temporary table, close and regenerate it */ /* If it is a temporary table, close and regenerate it */
if ((table_ptr=find_temporary_table(thd,table_list->db, if (!dont_send_ok && (table_ptr=find_temporary_table(thd,table_list->db,
table_list->real_name))) table_list->real_name)))
{ {
TABLE *table= *table_ptr; TABLE *table= *table_ptr;
HA_CREATE_INFO create_info; HA_CREATE_INFO create_info;
...@@ -536,7 +537,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) ...@@ -536,7 +537,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
{ {
/* Probably InnoDB table */ /* Probably InnoDB table */
DBUG_RETURN(mysql_delete(thd,table_list, (COND*) 0, (ORDER*) 0, 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)) if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(-1); DBUG_RETURN(-1);
...@@ -545,18 +546,22 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) ...@@ -545,18 +546,22 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
bzero((char*) &create_info,sizeof(create_info)); bzero((char*) &create_info,sizeof(create_info));
*fn_ext(path)=0; // Remove the .frm extension *fn_ext(path)=0; // Remove the .frm extension
error= ha_create_table(path,&create_info,1) ? -1 : 0; 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 (!error)
if (mysql_bin_log.is_open())
{ {
Query_log_event qinfo(thd, thd->query); mysql_update_log.write(thd,thd->query,thd->query_length);
mysql_bin_log.write(&qinfo); 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); DBUG_RETURN(error ? -1 : 0);
} }
...@@ -890,7 +890,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -890,7 +890,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
error=TRUE; // End server error=TRUE; // End server
break; break;
case COM_CREATE_DB: case COM_CREATE_DB: // QQ: To be removed
{ {
char *db=thd->strdup(packet); char *db=thd->strdup(packet);
// null test to handle EOM // null test to handle EOM
...@@ -905,7 +905,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -905,7 +905,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_create_db(thd,db,0); mysql_create_db(thd,db,0);
break; break;
} }
case COM_DROP_DB: case COM_DROP_DB: // QQ: To be removed
{ {
char *db=thd->strdup(packet); char *db=thd->strdup(packet);
// null test to handle EOM // null test to handle EOM
...@@ -914,8 +914,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -914,8 +914,11 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL"); net_printf(&thd->net,ER_WRONG_DB_NAME, db ? db : "NULL");
break; break;
} }
if (check_access(thd,DROP_ACL,db,0,1) || end_active_trans(thd)) if (thd->locked_tables || thd->active_transaction())
{
send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION);
break; break;
}
mysql_log.write(thd,command,db); mysql_log.write(thd,command,db);
mysql_rm_db(thd,db,0); mysql_rm_db(thd,db,0);
break; break;
...@@ -1632,7 +1635,7 @@ mysql_execute_command(void) ...@@ -1632,7 +1635,7 @@ mysql_execute_command(void)
*/ */
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION,MYF(0)); send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION,NullS);
goto error; goto error;
} }
res=mysql_truncate(thd,tables); res=mysql_truncate(thd,tables);
...@@ -1963,7 +1966,7 @@ mysql_execute_command(void) ...@@ -1963,7 +1966,7 @@ mysql_execute_command(void)
} }
if (check_access(thd,CREATE_ACL,lex->name,0,1)) if (check_access(thd,CREATE_ACL,lex->name,0,1))
break; break;
mysql_create_db(thd,lex->name,lex->create_info.options); res=mysql_create_db(thd,lex->name,lex->create_info.options);
break; break;
} }
case SQLCOM_DROP_DB: case SQLCOM_DROP_DB:
...@@ -1977,10 +1980,10 @@ mysql_execute_command(void) ...@@ -1977,10 +1980,10 @@ mysql_execute_command(void)
break; break;
if (thd->locked_tables || thd->active_transaction()) if (thd->locked_tables || thd->active_transaction())
{ {
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION,MYF(0)); send_error(&thd->net,ER_LOCK_OR_ACTIVE_TRANSACTION);
goto error; goto error;
} }
mysql_rm_db(thd,lex->name,lex->drop_if_exists); res=mysql_rm_db(thd,lex->name,lex->drop_if_exists);
break; break;
} }
case SQLCOM_CREATE_FUNCTION: case SQLCOM_CREATE_FUNCTION:
...@@ -2057,7 +2060,7 @@ mysql_execute_command(void) ...@@ -2057,7 +2060,7 @@ mysql_execute_command(void)
{ {
if (lex->columns.elements) if (lex->columns.elements)
{ {
net_printf(&thd->net,ER_ILLEGAL_GRANT_FOR_TABLE); send_error(&thd->net,ER_ILLEGAL_GRANT_FOR_TABLE);
res=1; res=1;
} }
else else
...@@ -2305,7 +2308,7 @@ static bool check_merge_table_access(THD *thd, char *db, ...@@ -2305,7 +2308,7 @@ static bool check_merge_table_access(THD *thd, char *db,
{ {
if (!tmp->db || !tmp->db[0]) if (!tmp->db || !tmp->db[0])
tmp->db=db; tmp->db=db;
else if (!strcmp(tmp->db,db)) else if (strcmp(tmp->db,db))
{ {
send_error(&thd->net,ER_UNION_TABLES_IN_DIFFERENT_DIR); send_error(&thd->net,ER_UNION_TABLES_IN_DIFFERENT_DIR);
return 1; return 1;
......
...@@ -864,7 +864,6 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table) ...@@ -864,7 +864,6 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table)
DBUG_RETURN(send_check_errmsg(thd, table, "restore", DBUG_RETURN(send_check_errmsg(thd, table, "restore",
"Failed generating table from .frm file")); "Failed generating table from .frm file"));
} }
/* truncate has released name lock */
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment