diff options
author | unknown <ramil@mysql.com> | 2005-02-02 15:06:36 +0400 |
---|---|---|
committer | unknown <ramil@mysql.com> | 2005-02-02 15:06:36 +0400 |
commit | 84405cbaa8adcc9343d19a0e7480cca828f993ab (patch) | |
tree | 4fa61592249ffc57fe2ca7ad2e49f3d16bf318cb | |
parent | f229695845b2fc0d208c48fccab75e5f61076559 (diff) | |
parent | 70fe41d2ec0fccdd54f643d832b67274a8f76f16 (diff) | |
download | mariadb-git-84405cbaa8adcc9343d19a0e7480cca828f993ab.tar.gz |
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/ram/work/4.1.b4802
client/mysql.cc:
Auto merged
include/mysql_com.h:
Auto merged
sql/sql_db.cc:
Auto merged
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
-rw-r--r-- | BitKeeper/etc/logging_ok | 1 | ||||
-rw-r--r-- | client/mysql.cc | 38 | ||||
-rw-r--r-- | include/mysql_com.h | 1 | ||||
-rw-r--r-- | sql/sql_db.cc | 2 |
4 files changed, 24 insertions, 18 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 6ccc886e161..bf88e38a780 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -180,6 +180,7 @@ ram@gw.mysql.r18.ru ram@gw.udmsearch.izhnet.ru ram@mysql.r18.ru ram@ram.(none) +ramil@mysql.com ranger@regul.home.lan rburnett@build.mysql.com reggie@bob.(none) diff --git a/client/mysql.cc b/client/mysql.cc index 635973e946c..a799027542b 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1581,6 +1581,22 @@ static int reconnect(void) return 0; } +static void get_current_db() +{ + MYSQL_RES *res; + + my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); + current_db= NULL; + /* In case of error below current_db will be NULL */ + if (!mysql_query(&mysql, "SELECT DATABASE()") && + (res= mysql_use_result(&mysql))) + { + MYSQL_ROW row= mysql_fetch_row(res); + if (row[0]) + current_db= my_strdup(row[0], MYF(MY_WME)); + mysql_free_result(res); + } +} /*************************************************************************** The different commands @@ -1905,6 +1921,9 @@ com_go(String *buffer,char *line __attribute__((unused))) if (err >= 1) error= put_error(&mysql); + if (!status.batch && (mysql.server_status & SERVER_STATUS_DB_DROPPED)) + get_current_db(); + return error; /* New command follows */ } @@ -2621,24 +2640,7 @@ com_use(String *buffer __attribute__((unused)), char *line) under our feet, for example if DROP DATABASE or RENAME DATABASE (latter one not yet available by the time the comment was written) */ - /* Let's reset current_db, assume it's gone */ - my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); - current_db= 0; - /* - We don't care about in case of an error below because current_db - was just set to 0. - */ - if (!mysql_query(&mysql, "SELECT DATABASE()") && - (res= mysql_use_result(&mysql))) - { - row= mysql_fetch_row(res); - if (row[0]) - { - current_db= my_strdup(row[0], MYF(MY_WME)); - } - (void) mysql_fetch_row(res); // Read eof - mysql_free_result(res); - } + get_current_db(); if (!current_db || cmp_database(charset_info, current_db,tmp)) { diff --git a/include/mysql_com.h b/include/mysql_com.h index 6a6136bd974..56c7f7d2ab5 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -130,6 +130,7 @@ enum enum_server_command #define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ #define SERVER_QUERY_NO_GOOD_INDEX_USED 16 #define SERVER_QUERY_NO_INDEX_USED 32 +#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ #define MYSQL_ERRMSG_SIZE 512 #define NET_READ_TIMEOUT 30 /* Timeout on read */ diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 407e2b23e38..731ca1d781e 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -668,7 +668,9 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) thd->clear_error(); mysql_bin_log.write(&qinfo); } + thd->server_status|= SERVER_STATUS_DB_DROPPED; send_ok(thd, (ulong) deleted); + thd->server_status&= !SERVER_STATUS_DB_DROPPED; } exit: |