From c9d856c8b78812dd402b89c62bcea23cc7dbe2a1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 8 Apr 2004 00:16:17 +0300 Subject: new error for unsupported command in PS fixed IN subselect with basic constant left expression SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406) fixed multiupdate privelege check (BUG#3408) fixed multiupdate tables check (BUG#3411) unchecked commands now is rejected by PS protocol to avoid serever crash fixed cleunup procedure to be compatible sith DO/SET (BUG#3393) include/mysqld_error.h: new error for unsupported command in PS mysql-test/r/multi_update.result: test sutes (BUG#3408, BUG#3411) mysql-test/t/multi_update.test: test sutes (BUG#3408, BUG#3411) sql/item_cmpfunc.cc: fixed IN subselect with basic constant left expression sql/mysql_priv.h: some function frop sql_parse.h become public sql/set_var.cc: check for SET command via PS sql/set_var.h: check for SET command via PS sql/share/czech/errmsg.txt: new error for unsupported command in PS sql/share/danish/errmsg.txt: new error for unsupported command in PS sql/share/dutch/errmsg.txt: new error for unsupported command in PS sql/share/english/errmsg.txt: new error for unsupported command in PS sql/share/estonian/errmsg.txt: new error for unsupported command in PS sql/share/french/errmsg.txt: new error for unsupported command in PS sql/share/german/errmsg.txt: new error for unsupported command in PS sql/share/greek/errmsg.txt: new error for unsupported command in PS sql/share/hungarian/errmsg.txt: new error for unsupported command in PS sql/share/italian/errmsg.txt: new error for unsupported command in PS sql/share/japanese/errmsg.txt: new error for unsupported command in PS sql/share/korean/errmsg.txt: new error for unsupported command in PS sql/share/norwegian-ny/errmsg.txt: new error for unsupported command in PS sql/share/norwegian/errmsg.txt: new error for unsupported command in PS sql/share/polish/errmsg.txt: new error for unsupported command in PS sql/share/portuguese/errmsg.txt: new error for unsupported command in PS sql/share/romanian/errmsg.txt: new error for unsupported command in PS sql/share/russian/errmsg.txt: new error for unsupported command in PS sql/share/serbian/errmsg.txt: new error for unsupported command in PS sql/share/slovak/errmsg.txt: new error for unsupported command in PS sql/share/spanish/errmsg.txt: new error for unsupported command in PS sql/share/swedish/errmsg.txt: new error for unsupported command in PS sql/share/ukrainian/errmsg.txt: new error for unsupported command in PS sql/sql_lex.cc: first table unlincking procedures for CREATE command sql/sql_lex.h: first table unlincking procedures for CREATE command sql/sql_parse.cc: used function to exclude first table from list SQLCOM_CREATE_TABLE, SQLCOM_UPDATE_MULTI, SQLCOM_REPLACE_SELECT, SQLCOM_INSERT_SELECT, QLCOM_DELETE_MULTI fixed to be compatible with PS (BUG#3398, BUG#3406) fixed multiupdate privelege check (BUG#3408) fixed multiupdate tables check (BUG#3411) sql/sql_prepare.cc: fixed a lot of commands to be compatible with PS unchecked commands now is rejected to avoid serever crash sql/sql_select.cc: allow empty result for PS preparing sql/sql_union.cc: fixed cleunup procedure to be compatible sith DO/SET (BUG#3393) sql/sql_update.cc: fixed update to use correct tables lists (BUG#3408) sql/table.h: flag to support multi update tables check (BUG#3408) tests/client_test.c: removed unsupported tables fixed show table test added new tests --- sql/sql_lex.cc | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index df7d487194a..7ff2fb4643a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1634,6 +1634,66 @@ void st_select_lex::print_limit(THD *thd, String *str) } } +/* + unlink first table from table lists + + SYNOPSIS + unlink_first_table() + tables - global table list + global_first - save first global table passed using this parameter + local_first - save first local table passed using this parameter + + RETURN + global list without first table +*/ +TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, + TABLE_LIST **global_first, + TABLE_LIST **local_first) +{ + *global_first= tables; + *local_first= (TABLE_LIST*)select_lex.table_list.first; + // exclude from global table list + tables= tables->next; + // and from local list if it is not the same + if (&select_lex != all_selects_list) + select_lex.table_list.first= (gptr)(*local_first)->next; + else + select_lex.table_list.first= (gptr)tables; + (*global_first)->next= 0; + return tables; +} + +/* + link unlinked first table back + + SYNOPSIS + link_first_table_back() + tables - global table list + global_first - save first global table + local_first - save first local table + + RETURN + global list +*/ +TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables, + TABLE_LIST *global_first, + TABLE_LIST *local_first) +{ + global_first->next= tables; + tables= global_first; + if (&select_lex != all_selects_list) + { + /* + we do not touch local table 'next' field => we need just + put the table in the list + */ + select_lex.table_list.first= (gptr) local_first; + } + else + select_lex.table_list.first= (gptr) tables; + return tables; +} + /* There are st_select_lex::add_table_to_list & st_select_lex::set_lock_for_tables are in sql_parse.cc -- cgit v1.2.1 From 8ab58393c5c9732c032faac3f0d04a4536e5562b Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 10 Apr 2004 01:14:32 +0300 Subject: after review PS fixes sql/item_cmpfunc.cc: merged in one if sql/mysql_priv.h: removed unused paremeter of check_one_table_access declaration of new function for SP share code sql/set_var.cc: function descriotion added unneeded parantses removed sql/sql_acl.cc: new parameter to limit number of checked tables for check_grant sql/sql_acl.h: new parameter to limit number of checked tables for check_grant sql/sql_delete.cc: preparation moved in separate function sql/sql_insert.cc: preparation moved in separate function sql/sql_lex.cc: comment style fixed unneeded assignment removed sql/sql_parse.cc: new parameter to limit number of checked tables for check_grant table list manipulation removed (because of above) new precheck function sql/sql_prepare.cc: function rewrited to shere code with sql_prepare.cc flow control fixed sql/sql_show.cc: new parameter to limit number of checked tables for check_grant sql/sql_update.cc: preparation moved in separate function sql/table.h: flag renamed --- sql/sql_lex.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7fa0591ddc8..995f3702ab3 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1634,8 +1634,10 @@ void st_select_lex::print_limit(THD *thd, String *str) } } + /* - unlink first table from table lists + Unlink first table from global table list and first must outer select list + (lex->select_lex) SYNOPSIS unlink_first_table() @@ -1652,9 +1654,13 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, { *global_first= tables; *local_first= (TABLE_LIST*)select_lex.table_list.first; - // exclude from global table list + /* + exclude from global table list + */ tables= tables->next; - // and from local list if it is not the same + /* + and from local list if it is not the same + */ if (&select_lex != all_selects_list) select_lex.table_list.first= (gptr)(*local_first)->next; else @@ -1663,8 +1669,9 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, return tables; } + /* - link unlinked first table back + Link table back that was unlinked with unlink_first_table() SYNOPSIS link_first_table_back() @@ -1680,7 +1687,6 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables, TABLE_LIST *local_first) { global_first->next= tables; - tables= global_first; if (&select_lex != all_selects_list) { /* @@ -1690,8 +1696,8 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables, select_lex.table_list.first= (gptr) local_first; } else - select_lex.table_list.first= (gptr) tables; - return tables; + select_lex.table_list.first= (gptr) global_first; + return global_first; } /* -- cgit v1.2.1 From 0ba6cb48d84f1ff951d09871a96be6cdef3f2c3c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Apr 2004 03:26:32 +0300 Subject: Added missing return statement sql/sql_delete.cc: Added missing return sql/sql_lex.cc: Comment fixes sql/sql_parse.cc: Comment fixes --- sql/sql_lex.cc | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 995f3702ab3..e0e8fed29c8 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1636,17 +1636,21 @@ void st_select_lex::print_limit(THD *thd, String *str) /* - Unlink first table from global table list and first must outer select list - (lex->select_lex) + Unlink first table from global table list and first table from outer select + list (lex->select_lex) SYNOPSIS unlink_first_table() - tables - global table list - global_first - save first global table passed using this parameter - local_first - save first local table passed using this parameter + tables Global table list + global_first Save first global table here + local_first Save first local table here + + NORES + global_first & local_first are used to save result for link_first_table_back RETURN global list without first table + */ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, TABLE_LIST **global_first, @@ -1655,16 +1659,15 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, *global_first= tables; *local_first= (TABLE_LIST*)select_lex.table_list.first; /* - exclude from global table list + Exclude from global table list */ tables= tables->next; /* and from local list if it is not the same */ - if (&select_lex != all_selects_list) - select_lex.table_list.first= (gptr)(*local_first)->next; - else - select_lex.table_list.first= (gptr)tables; + select_lex.table_list.first= ((&select_lex != all_selects_list) ? + (gptr) (*local_first)->next : + (gptr) tables); (*global_first)->next= 0; return tables; } @@ -1675,9 +1678,9 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, SYNOPSIS link_first_table_back() - tables - global table list - global_first - save first global table - local_first - save first local table + tables Global table list + global_first Saved first global table + local_first Saved first local table RETURN global list -- cgit v1.2.1 From 43dcf48e2f00c7cce50dfe30cc5593afac6a91c8 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 15 Apr 2004 09:17:55 +0200 Subject: Formatting changes requested by Monty sql/gen_lex_hash.cc: Minor changes - fix space between for and ( sql/item_subselect.cc: Minor changes - fix space between for and ( sql/sql_lex.cc: Minor changes - fix space between for and ( sql/sql_string.cc: Minor changes - fix space between for and ( --- sql/sql_lex.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index e0e8fed29c8..d16e1f87085 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1529,7 +1529,7 @@ bool st_select_lex::setup_ref_array(THD *thd, uint order_group_num) */ bool st_select_lex_unit::check_updateable(char *db, char *table) { - for(SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) + for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select()) if (sl->check_updateable(db, table)) return 1; return 0; -- cgit v1.2.1 From 978ba8f47ef6adf41c5a9eb75cc927c3aa1b8e69 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 27 Apr 2004 03:44:41 +0400 Subject: Fix for BUG#3567: Disallow several SQL statements inside a Prepared Statement. --- sql/sql_lex.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index d16e1f87085..66e2782dd84 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -882,10 +882,12 @@ int yylex(void *arg, void *yythd) case MY_LEX_COLON: // optional line terminator if (yyPeek()) { - if (((THD *)yythd)->client_capabilities & CLIENT_MULTI_STATEMENTS) + THD* thd= (THD*)yythd; + if ((thd->client_capabilities & CLIENT_MULTI_STATEMENTS) && + (thd->command != COM_PREPARE)) { lex->found_colon=(char*)lex->ptr; - ((THD *)yythd)->server_status |= SERVER_MORE_RESULTS_EXISTS; + thd->server_status |= SERVER_MORE_RESULTS_EXISTS; lex->next_state=MY_LEX_END; return(END_OF_INPUT); } -- cgit v1.2.1 From f1ab98d48e05c473affa18333dce9e8226821617 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 28 Apr 2004 01:49:05 +0400 Subject: Renamed MY_LEX_COLON to MY_LEX_SEMICOLON (at Serg's request) --- sql/sql_lex.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 66e2782dd84..19a6941fe32 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -879,7 +879,7 @@ int yylex(void *arg, void *yythd) } yySkip(); return (SET_VAR); - case MY_LEX_COLON: // optional line terminator + case MY_LEX_SEMICOLON: // optional line terminator if (yyPeek()) { THD* thd= (THD*)yythd; -- cgit v1.2.1 From bddee0c170454f54c1f87299d88d3aa9e44a3872 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 May 2004 02:59:17 -0300 Subject: Windows fixes for VC++ compiler compability myisam/myisam_ftdump.c: VC++ compiler compability fix mysys/my_getsystime.c: Applied Sergei's code for Windows (still subject to changes by him) sql/handler.cc: VC++ compiler compability fix sql/item_geofunc.cc: Removed non-used variable sql/item_strfunc.cc: VC++ compiler compability fix sql/opt_range.cc: VC++ compiler compability fix sql/sql_insert.cc: VC++ compiler compability fix sql/sql_lex.cc: VC++ compiler compability fix sql/sql_parse.cc: VC++ compiler compability fix sql/sql_prepare.cc: VC++ compiler compability fix sql/sql_union.cc: Removed non-used variable and VC++ compiler compability fix --- sql/sql_lex.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 19a6941fe32..63247a64319 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1668,8 +1668,8 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, and from local list if it is not the same */ select_lex.table_list.first= ((&select_lex != all_selects_list) ? - (gptr) (*local_first)->next : - (gptr) tables); + (byte*) (*local_first)->next : + (byte*) tables); (*global_first)->next= 0; return tables; } @@ -1698,10 +1698,10 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables, we do not touch local table 'next' field => we need just put the table in the list */ - select_lex.table_list.first= (gptr) local_first; + select_lex.table_list.first= (byte*) local_first; } else - select_lex.table_list.first= (gptr) global_first; + select_lex.table_list.first= (byte*) global_first; return global_first; } -- cgit v1.2.1 From f6428e8bb9ac0cad24465513c5969a50cd13f6f2 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 May 2004 21:21:41 +0300 Subject: caching of queries with isammerge tables forbiden using general way SQL_SELECT_LIMIT as default will be applied only for SELECT statement if there was not explicit LIMIT clause correct table list passed to class constructor of select_update mysql-test/r/subselect.result: do not show limit if it is not explicit mysql-test/r/union.result: test of LIMIT + ORDER mysql-test/t/union.test: test of LIMIT + ORDER sql/ha_isammrg.h: caching of queries with isammerge tables forbiden sql/sql_cache.cc: removed check on isammerge sql/sql_lex.cc: tag of explicit limit in statement sql/sql_lex.h: tag of explicit limit in statement sql/sql_parse.cc: blanks in empty line removed no limit by default (SQL_SELECT_LIMIT as default will be applied only for SELECT statement if there was not explicit LIMIT clause) sql/sql_union.cc: reverted incorrect patch sql/sql_update.cc: reverted incorrect patch correct table list passed to class constructor sql/sql_yacc.yy: explicit LIMIT marked --- sql/sql_lex.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sql/sql_lex.cc') diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 19a6941fe32..e545e35921a 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1023,6 +1023,7 @@ void st_select_lex::init_query() ref_pointer_array= 0; select_n_having_items= 0; prep_where= 0; + explicit_limit= 0; } void st_select_lex::init_select() @@ -1616,10 +1617,7 @@ void st_select_lex::print_limit(THD *thd, String *str) if (!thd) thd= current_thd; - if ((select_limit != thd->variables.select_limit && - this == &thd->lex->select_lex) || - (select_limit != HA_POS_ERROR && this != &thd->lex->select_lex) || - offset_limit != 0L) + if (explicit_limit) { str->append(" limit ", 7); char buff[20]; -- cgit v1.2.1