Commit 1b142600 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/home/dlenev/src/mysql-4.1-bg6081


sql/sql_parse.cc:
  Auto merged
parents 6a931667 c8ef55cc
No related merge requests found
...@@ -1562,6 +1562,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1562,6 +1562,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
case COM_CREATE_DB: // QQ: To be removed case COM_CREATE_DB: // QQ: To be removed
{ {
char *db=thd->strdup(packet), *alias; char *db=thd->strdup(packet), *alias;
HA_CREATE_INFO create_info;
statistic_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_status); statistic_increment(com_stat[SQLCOM_CREATE_DB],&LOCK_status);
// null test to handle EOM // null test to handle EOM
...@@ -1573,7 +1574,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1573,7 +1574,10 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if (check_access(thd,CREATE_ACL,db,0,1,0)) if (check_access(thd,CREATE_ACL,db,0,1,0))
break; break;
mysql_log.write(thd,command,packet); mysql_log.write(thd,command,packet);
mysql_create_db(thd,(lower_case_table_names == 2 ? alias : db),0,0); bzero(&create_info, sizeof(create_info));
if (mysql_create_db(thd, (lower_case_table_names == 2 ? alias : db),
&create_info, 0) < 0)
send_error(thd, thd->killed ? ER_SERVER_SHUTDOWN : 0);
break; break;
} }
case COM_DROP_DB: // QQ: To be removed case COM_DROP_DB: // QQ: To be removed
...@@ -1594,7 +1598,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1594,7 +1598,9 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
break; break;
} }
mysql_log.write(thd,command,db); mysql_log.write(thd,command,db);
mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db), 0, 0); if (mysql_rm_db(thd, (lower_case_table_names == 2 ? alias : db),
0, 0) < 0)
send_error(thd, thd->killed ? ER_SERVER_SHUTDOWN : 0);
break; break;
} }
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
......
...@@ -10688,6 +10688,31 @@ static void test_bug6046() ...@@ -10688,6 +10688,31 @@ static void test_bug6046()
} }
/*
Altough mysql_create_db(), mysql_rm_db() are deprecated since 4.0 they
should not crash server and should not hang in case of errors.
Since those functions can't be seen in modern API (unless client library
was compiled with USE_OLD_FUNCTIONS define) we use simple_command() macro.
*/
static void test_bug6081()
{
int rc;
myheader("test_bug6081");
rc= simple_command(mysql, COM_DROP_DB, current_db,
(ulong)strlen(current_db), 0);
myquery(rc);
rc= simple_command(mysql, COM_DROP_DB, current_db,
(ulong)strlen(current_db), 0);
myquery_r(rc);
rc= simple_command(mysql, COM_CREATE_DB, current_db,
(ulong)strlen(current_db), 0);
myquery(rc);
rc= simple_command(mysql, COM_CREATE_DB, current_db,
(ulong)strlen(current_db), 0);
myquery_r(rc);
}
/* /*
...@@ -11004,6 +11029,7 @@ int main(int argc, char **argv) ...@@ -11004,6 +11029,7 @@ int main(int argc, char **argv)
test_bug6058(); /* check support for 0000-00-00 dates */ test_bug6058(); /* check support for 0000-00-00 dates */
test_bug6059(); /* correct metadata for SELECT ... INTO OUTFILE */ test_bug6059(); /* correct metadata for SELECT ... INTO OUTFILE */
test_bug6046(); /* NATURAL JOIN transformation works in PS */ test_bug6046(); /* NATURAL JOIN transformation works in PS */
test_bug6081(); /* test of mysql_create_db()/mysql_rm_db() */
/* /*
XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST
DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH.
......
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