From 447baa9011c8a2403a84f3b4b79cba9c69ee0aaf Mon Sep 17 00:00:00 2001 From: "monty@mysql.com" <> Date: Fri, 26 Mar 2004 11:06:53 +0200 Subject: [PATCH] After merge fixes + simple optimizations --- mysql-test/r/alter_table.result | 2 +- mysql-test/r/drop_temp_table.result | 4 ++-- mysql-test/r/union.result | 2 +- sql/sql_db.cc | 10 +++++----- sql/sql_union.cc | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index c82f181da81..571ba7429fc 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -121,7 +121,7 @@ create database mysqltest; create table mysqltest.t1 (a int,b int,c int); grant all on mysqltest.t1 to mysqltest_1@localhost; alter table t1 rename t2; -insert command denied to user: 'mysqltest_1@localhost' for table 't2' +ERROR 42000: insert command denied to user: 'mysqltest_1'@'localhost' for table 't2' revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; delete from mysql.user where user='mysqltest_1'; drop database mysqltest; diff --git a/mysql-test/r/drop_temp_table.result b/mysql-test/r/drop_temp_table.result index 78efc9d90e2..99ee0143c05 100644 --- a/mysql-test/r/drop_temp_table.result +++ b/mysql-test/r/drop_temp_table.result @@ -13,6 +13,6 @@ Log_name Pos Event_type Server_id Orig_log_pos Info master-bin.000001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3 master-bin.000001 79 Query 1 79 use `test`; create database `drop-temp+table-test` master-bin.000001 152 Query 1 152 use `drop-temp+table-test`; create temporary table `table:name` (a int) -master-bin.000001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE `drop-temp+table-test`.`table:name` -master-bin.000001 365 Query 1 365 use `drop-temp+table-test`; DO RELEASE_LOCK("a") +master-bin.000001 246 Query 1 246 use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `drop-temp+table-test`.`table:name` +master-bin.000001 375 Query 1 375 use `drop-temp+table-test`; DO RELEASE_LOCK("a") drop database `drop-temp+table-test`; diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index 908c1d285f5..ece2970198b 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -435,7 +435,7 @@ drop temporary table t1; create table t1 select a from t1 union select a from t2; ERROR HY000: You can't specify target table 't1' for update in FROM clause select a from t1 union select a from t2 order by t2.a; -Unknown column 't2.a' in 'ORDER BY' +ERROR 42S22: Unknown column 't2.a' in 'ORDER BY' drop table t1,t2; select length(version()) > 1 as `*` UNION select 2; * diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 08582391754..32878c011f1 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -164,9 +164,9 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, bool silent) { char path[FN_REFLEN+16]; - MY_DIR *dirp; long result=1; int error = 0; + MY_STAT stat_info; uint create_options = create_info ? create_info->options : 0; DBUG_ENTER("mysql_create_db"); @@ -180,12 +180,12 @@ int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, } /* Check directory */ - (void)sprintf(path,"%s/%s", mysql_data_home, db); + strxmov(path, mysql_data_home, "/", db, NullS); unpack_dirname(path,path); // Convert if not unix - if ((dirp = my_dir(path,MYF(MY_DONT_SORT)))) + + if (my_stat(path,&stat_info,MYF(MY_WME))) { - my_dirend(dirp); - if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS)) + if (!(create_options & HA_LEX_CREATE_IF_NOT_EXISTS)) { my_error(ER_DB_CREATE_EXISTS,MYF(0),db); error = -1; diff --git a/sql/sql_union.cc b/sql/sql_union.cc index cb385b482cf..907250b11c8 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -210,7 +210,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, for (tmp_order= (ORDER*) global_parameters->order_list.first; tmp_order ; - tmp_order= tmp_order->next; + tmp_order= tmp_order->next) { Item *item= *tmp_order->item; if (((item->type() == Item::FIELD_ITEM) &&