mariadb/sql/sql_derived.cc

291 lines
8.2 KiB
C++
Raw Normal View History

/* Copyright (C) 2002-2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Derived tables
These were introduced by Sinisa <sinisa@mysql.com>
*/
#include "mysql_priv.h"
#include "sql_select.h"
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
/*
call given derived table processor (preparing or filling tables)
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
SYNOPSIS
mysql_handle_derived()
lex LEX for this thread
processor procedure of derived table processing
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
RETURN
0 ok
-1 Error
1 Error and error message given
*/
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
int
mysql_handle_derived(LEX *lex, int (*processor)(THD*, LEX*, TABLE_LIST*))
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
{
fixed mechanism of detection selection from table wich we update (BUG##9398, BUG#8703) fixed wrong join view detection in multi-delete which lead to server crash mysql-test/r/lowercase_view.result: added new tests of updation and selection from the same table mysql-test/r/view.result: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 mysql-test/t/lowercase_view.test: added new tests of updation and selection from the same table mysql-test/t/view.test: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 sql/sql_base.cc: changed procedure of finding tables sql/sql_class.cc: added derived table procession detection sql/sql_class.h: added derived table procession detection sql/sql_delete.cc: fixed detection of selection from table which update for multidelete sql/sql_derived.cc: added derived table procession detection sql/sql_lex.cc: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_lex.h: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_parse.cc: removed wrong test of join view (for multidelete in can be not only first table) sql/sql_prepare.cc: added detection os SELECTs processed inside derived tables (reset it for reusing in PS/SP) sql/sql_select.cc: added detection os SELECTs processed inside derived tables sql/sql_update.cc: fixed detection of selection from table which update for multiupdate
2005-03-28 14:13:31 +02:00
int res= 0;
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
if (lex->derived_tables)
{
fixed mechanism of detection selection from table wich we update (BUG##9398, BUG#8703) fixed wrong join view detection in multi-delete which lead to server crash mysql-test/r/lowercase_view.result: added new tests of updation and selection from the same table mysql-test/r/view.result: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 mysql-test/t/lowercase_view.test: added new tests of updation and selection from the same table mysql-test/t/view.test: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 sql/sql_base.cc: changed procedure of finding tables sql/sql_class.cc: added derived table procession detection sql/sql_class.h: added derived table procession detection sql/sql_delete.cc: fixed detection of selection from table which update for multidelete sql/sql_derived.cc: added derived table procession detection sql/sql_lex.cc: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_lex.h: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_parse.cc: removed wrong test of join view (for multidelete in can be not only first table) sql/sql_prepare.cc: added detection os SELECTs processed inside derived tables (reset it for reusing in PS/SP) sql/sql_select.cc: added detection os SELECTs processed inside derived tables sql/sql_update.cc: fixed detection of selection from table which update for multiupdate
2005-03-28 14:13:31 +02:00
lex->thd->derived_tables_processing= TRUE;
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
for (SELECT_LEX *sl= lex->all_selects_list;
sl;
sl= sl->next_select_in_list())
{
for (TABLE_LIST *cursor= sl->get_table_list();
cursor;
VIEW two TABLE_LIST copy eliminated include/mysqld_error.h: errors of view libmysqld/Makefile.am: new view file mysql-test/r/connect.result: SHOW TABLE show type of table mysql-test/r/ctype_recoding.result: SHOW TABLE show type of table mysql-test/r/drop.result: SHOW TABLE show type of table mysql-test/r/grant.result: new two privileges (CRETEA|SHOW VIEW) mysql-test/r/lowercase_table.result: SHOW TABLE show type of table mysql-test/r/ps_1general.result: SHOW TABLE show type of table mysql-test/r/rename.result: SHOW TABLE show type of table mysql-test/r/rpl000009.result: SHOW TABLE show type of table mysql-test/r/rpl_error_ignored_table.result: SHOW TABLE show type of table mysql-test/r/select.result: SHOW TABLE show type of table mysql-test/r/system_mysql_db.result: SHOW TABLE show type of table new two privileges (CRETEA|SHOW VIEW) mysql-test/t/system_mysql_db_fix.test: removing all system tables scripts/mysql_fix_privilege_tables.sql: new two privileges (CRETEA|SHOW VIEW) sql/Makefile.am: new VIEW related file sql/ha_myisammrg.cc: two TABLE_LIST copy eliminated sql/item.cc: VIEW sql/item.h: VIEW sql/item_subselect.cc: VIEW sql/item_subselect.h: VIEW sql/lex.h: VIEW sql/lock.cc: VIEW sql/mysql_priv.h: VIEW sql/mysqld.cc: VIEW new parameter - sql_updatable_view_key sql/opt_sum.cc: two TABLE_LIST copy eliminated sql/set_var.cc: new parameter - sql_updatable_view_key sql/share/czech/errmsg.txt: errors messages of views sql/share/danish/errmsg.txt: errors messages of views sql/share/dutch/errmsg.txt: errors messages of views sql/share/english/errmsg.txt: errors messages of views sql/share/estonian/errmsg.txt: errors messages of views sql/share/french/errmsg.txt: errors messages of views sql/share/german/errmsg.txt: errors messages of views sql/share/greek/errmsg.txt: errors messages of views sql/share/hungarian/errmsg.txt: errors messages of views sql/share/italian/errmsg.txt: errors messages of views sql/share/japanese/errmsg.txt: errors messages of views sql/share/korean/errmsg.txt: errors messages of views sql/share/norwegian-ny/errmsg.txt: errors messages of views sql/share/norwegian/errmsg.txt: errors messages of views sql/share/polish/errmsg.txt: errors messages of views sql/share/portuguese/errmsg.txt: errors messages of views sql/share/romanian/errmsg.txt: errors messages of views sql/share/russian/errmsg.txt: errors messages of views sql/share/serbian/errmsg.txt: errors messages of views sql/share/slovak/errmsg.txt: errors messages of views sql/share/spanish/errmsg.txt: errors messages of views sql/share/swedish/errmsg.txt: errors messages of views sql/share/ukrainian/errmsg.txt: errors messages of views sql/slave.cc: two TABLE_LIST copy eliminated sql/sp.cc: VIEW sql/sql_acl.cc: VIEW sql/sql_acl.h: VIEW sql/sql_base.cc: VIEW sql/sql_cache.cc: two TABLE_LIST copy eliminated sql/sql_class.h: VIEW sql/sql_db.cc: two TABLE_LIST copy eliminated sql/sql_delete.cc: VIEW sql/sql_derived.cc: VIEW sql/sql_handler.cc: two TABLE_LIST copy eliminated sql/sql_help.cc: two TABLE_LIST copy eliminated sql/sql_insert.cc: VIEW sql/sql_lex.cc: VIEW sql/sql_lex.h: VIEW sql/sql_load.cc: VIEW sql/sql_olap.cc: VIEW sql/sql_parse.cc: two TABLE_LIST copy eliminated VIEW sql/sql_prepare.cc: VIEW sql/sql_rename.cc: two TABLE_LIST copy eliminated sql/sql_select.cc: VIEW sql/sql_show.cc: VIEW sql/sql_table.cc: VIEW sql/sql_union.cc: VIEW sql/sql_update.cc: VIEW sql/sql_yacc.yy: VIEW sql/table.cc: VIEW sql/table.h: VIEW sql/tztime.cc: two TABLE_LIST copy eliminated sql/unireg.h: VIEW tests/client_test.c: VIEW
2004-07-16 00:15:55 +02:00
cursor= cursor->next_local)
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
{
if ((res= (*processor)(lex->thd, lex, cursor)))
fixed mechanism of detection selection from table wich we update (BUG##9398, BUG#8703) fixed wrong join view detection in multi-delete which lead to server crash mysql-test/r/lowercase_view.result: added new tests of updation and selection from the same table mysql-test/r/view.result: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 mysql-test/t/lowercase_view.test: added new tests of updation and selection from the same table mysql-test/t/view.test: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 sql/sql_base.cc: changed procedure of finding tables sql/sql_class.cc: added derived table procession detection sql/sql_class.h: added derived table procession detection sql/sql_delete.cc: fixed detection of selection from table which update for multidelete sql/sql_derived.cc: added derived table procession detection sql/sql_lex.cc: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_lex.h: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_parse.cc: removed wrong test of join view (for multidelete in can be not only first table) sql/sql_prepare.cc: added detection os SELECTs processed inside derived tables (reset it for reusing in PS/SP) sql/sql_select.cc: added detection os SELECTs processed inside derived tables sql/sql_update.cc: fixed detection of selection from table which update for multiupdate
2005-03-28 14:13:31 +02:00
goto out;
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
}
if (lex->describe)
{
/*
Force join->join_tmp creation, because we will use this JOIN
twice for EXPLAIN and we have to have unchanged join for EXPLAINing
*/
sl->uncacheable|= UNCACHEABLE_EXPLAIN;
sl->master_unit()->uncacheable|= UNCACHEABLE_EXPLAIN;
}
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
}
}
fixed mechanism of detection selection from table wich we update (BUG##9398, BUG#8703) fixed wrong join view detection in multi-delete which lead to server crash mysql-test/r/lowercase_view.result: added new tests of updation and selection from the same table mysql-test/r/view.result: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 mysql-test/t/lowercase_view.test: added new tests of updation and selection from the same table mysql-test/t/view.test: added new tests of updation and selection from the same table added test of multidelete command over join view which lead to server crash test suite from bugs #9398 and #8703 sql/sql_base.cc: changed procedure of finding tables sql/sql_class.cc: added derived table procession detection sql/sql_class.h: added derived table procession detection sql/sql_delete.cc: fixed detection of selection from table which update for multidelete sql/sql_derived.cc: added derived table procession detection sql/sql_lex.cc: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_lex.h: added detection os SELECTs processed inside derived tables removed old mechanism of multidelete/multiupdate table duplication detection (which can't work with views) sql/sql_parse.cc: removed wrong test of join view (for multidelete in can be not only first table) sql/sql_prepare.cc: added detection os SELECTs processed inside derived tables (reset it for reusing in PS/SP) sql/sql_select.cc: added detection os SELECTs processed inside derived tables sql/sql_update.cc: fixed detection of selection from table which update for multiupdate
2005-03-28 14:13:31 +02:00
out:
lex->thd->derived_tables_processing= FALSE;
return res;
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
}
/*
Create temporary table structure (but do not fill it)
SYNOPSIS
mysql_derived_prepare()
thd Thread handle
lex LEX for this thread
orig_table_list TABLE_LIST for the upper SELECT
IMPLEMENTATION
Derived table is resolved with temporary table.
After table creation, the above TABLE_LIST is updated with a new table.
This function is called before any command containing derived table
is executed.
Derived tables is stored in thd->derived_tables and freed in
close_thread_tables()
RETURN
0 ok
1 Error
-1 Error and error message given
*/
int mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
{
SELECT_LEX_UNIT *unit= orig_table_list->derived;
int res= 0;
DBUG_ENTER("mysql_derived_prepare");
if (unit)
{
SELECT_LEX *first_select= unit->first_select();
TABLE *table= 0;
select_union *derived_result;
bool is_union= first_select->next_select() &&
first_select->next_select()->linkage == UNION_TYPE;
Name resolution context added (BUG#6443) include/my_bitmap.h: new bitmap operation mysql-test/r/view.result: added warnings Correct inserting data check (absence of default value) for view underlying tables (BUG#6443) mysql-test/t/view.test: Correct inserting data check (absence of default value) for view underlying tables (BUG#6443) mysys/my_bitmap.c: new bitmap operation sql/field.h: index of field in table added sql/item.cc: Name resolution context added table list removed from fix_fields() arguments sql/item.h: Name resolution context added table list removed from fix_fields() arguments sql/item_cmpfunc.cc: table list removed from fix_fields() arguments sql/item_cmpfunc.h: table list removed from fix_fields() arguments sql/item_func.cc: table list removed from fix_fields() arguments sql/item_func.h: table list removed from fix_fields() arguments sql/item_row.cc: table list removed from fix_fields() arguments sql/item_row.h: table list removed from fix_fields() arguments sql/item_strfunc.cc: fixed server crash on NULL argument sql/item_strfunc.h: table list removed from fix_fields() arguments sql/item_subselect.cc: table list removed from fix_fields() arguments sql/item_subselect.h: table list removed from fix_fields() arguments sql/item_sum.cc: table list removed from fix_fields() arguments sql/item_sum.h: table list removed from fix_fields() arguments sql/item_timefunc.cc: table list removed from fix_fields() arguments sql/item_timefunc.h: table list removed from fix_fields() arguments sql/item_uniq.h: table list removed from fix_fields() arguments sql/log_event.cc: Name resolution context added sql/log_event.h: Name resolution context added sql/mysql_priv.h: Name resolution context added sql/set_var.cc: table list removed from fix_fields() arguments sql/share/errmsg.txt: new error message sql/sp.cc: Name resolution context added sql/sp_head.cc: table list removed from fix_fields() arguments sql/sp_head.h: Name resolution context added sql/sql_base.cc: table list removed from fix_fields() arguments Name resolution context added sql/sql_class.cc: renamed variable sql/sql_delete.cc: Name resolution context added sql/sql_derived.cc: Name resolution context added sql/sql_do.cc: table list removed from fix_fields() arguments sql/sql_handler.cc: Name resolution context added sql/sql_help.cc: Name resolution context added sql/sql_insert.cc: Name resolution context added table list removed from fix_fields() arguments sql/sql_lex.cc: Name resolution context added sql/sql_lex.h: removed resolve mode (information stored into name resolution context) sql/sql_load.cc: table list removed from fix_fields() arguments sql/sql_olap.cc: Name resolution context added sql/sql_parse.cc: Name resolution context added sql/sql_prepare.cc: table list removed from fix_fields() arguments sql/sql_select.cc: table list removed from fix_fields() arguments sql/sql_show.cc: Name resolution context added sql/sql_trigger.cc: table list removed from fix_fields() arguments sql/sql_udf.h: table list removed from fix_fields() arguments sql/sql_union.cc: Name resolution context added sql/sql_update.cc: Name resolution context added sql/sql_view.cc: Name resolution context added sql/sql_view.h: table list removed from fix_fields() arguments sql/sql_yacc.yy: Name resolution context added sql/table.cc: Name resolution context added merged view processing moved sql/table.h: merged view processing moved
2005-07-01 06:05:42 +02:00
/* prevent name resolving out of derived table */
for (SELECT_LEX *sl= first_select; sl; sl= sl->next_select())
sl->context.outer_context= 0;
if (!(derived_result= new select_union(0)))
DBUG_RETURN(1); // out of memory
// st_select_lex_unit::prepare correctly work for single select
if ((res= unit->prepare(thd, derived_result, 0, orig_table_list->alias)))
goto exit;
derived_result->tmp_table_param.init();
derived_result->tmp_table_param.field_count= unit->types.elements;
/*
Temp table is created so that it hounours if UNION without ALL is to be
processed
As 'distinct' parameter we always pass FALSE (0), because underlying
query will control distinct condition by itself. Correct test of
distinct underlying query will be is_union &&
!unit->union_distinct->next_select() (i.e. it is union and last distinct
SELECT is last SELECT of UNION).
*/
if (!(table= create_tmp_table(thd, &derived_result->tmp_table_param,
unit->types, (ORDER*) 0,
FALSE, 1,
(first_select->options | thd->options |
TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR,
orig_table_list->alias)))
{
res= -1;
goto exit;
}
derived_result->set_table(table);
exit:
/* Hide "Unknown column" or "Unknown function" error */
if (orig_table_list->view)
{
if (thd->net.last_errno == ER_BAD_FIELD_ERROR ||
thd->net.last_errno == ER_SP_DOES_NOT_EXIST)
{
thd->clear_error();
my_error(ER_VIEW_INVALID, MYF(0), orig_table_list->db,
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
orig_table_list->table_name);
}
}
/*
if it is preparation PS only or commands that need only VIEW structure
then we do not need real data and we can skip execution (and parameters
is not defined, too)
*/
if (res)
{
if (table)
free_tmp_table(thd, table);
delete derived_result;
}
else
{
if (!thd->fill_derived_tables())
WL#2130: Table locking for stored FUNCTIONs Collect all tables and SPs refered by a statement, and open all tables with an implicit LOCK TABLES. Do find things refered by triggers and views, we open them first (and then repeat this until nothing new is found), before doing the actual lock tables. mysql-test/r/information_schema.result: Updated result for WL#2130. mysql-test/r/lock.result: Updated result for WL#2130. mysql-test/r/sp-error.result: Updated result for WL#2130. mysql-test/r/sp.result: Updated result for WL#2130. mysql-test/r/view.result: Updated result for WL#2130. mysql-test/t/information_schema.test: Disabled one test case due to a bug involving LOCK TABLES, which shows up with WL#2130. mysql-test/t/lock.test: New error message with WL#2130. This change is under debate and might change in the future, but will do for now. mysql-test/t/sp-error.test: Updated for WL#2130. Some tests are voided when table access does work from functions. mysql-test/t/sp.test: Updated for WL#2130. mysql-test/t/view.test: Updated for WL#2130. sql/item_func.cc: We now have to set net.no_send_ok for functions too, with WL#2130. sql/share/errmsg.txt: Reused an error code since the old use was voided by WL#2130, but a new one was needed instead (similar, but more specific restriction). sql/sp.cc: Fixed error handling and collection of used tables for WL#2130. sql/sp.h: Fixed error handling and collection of used tables for WL#2130. sql/sp_head.cc: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sp_head.h: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sql_base.cc: Changed the way table->query_id is tested and set during with locked tables in effect. This makes some SP test cases work with WL#2130, but has a side effect on some error cases with explicit LOCK TABLES. It's still debated if this is the correct way, so it might change. sql/sql_class.h: Added flags for circumventing some interference between WL#2130 and mysql_make_view(). sql/sql_derived.cc: Added some missing initializations. (Potential bugs.) sql/sql_lex.cc: Clear the new hash tables for WL#2130. sql/sql_lex.h: Added hash tables for procedures and tables too (as for functions), for WL#2130. sql/sql_parse.cc: WL#2130: Make table accesses from stored functions work by adding an implicit LOCK TABLES around (most) executed statements. To do this, we have to go through a loop where we collect all SPs and tables in mysql_execute_statement. sql/sql_prepare.cc: Cache both functions and procedures for WL#2130. sql/sql_show.cc: Added some missing initializations. (Potential bugs.) sql/sql_view.cc: Shortcut mysql_make_view() if thd->shortcut_make_view is true during the pre-open phase for collecting tables in WL#2130. Otherwise, the similar mechanism here causes interference. sql/sql_yacc.yy: For WL#2130, added caching of procedures and disallowed LOCK/UNLOCK TABLES in SPs.
2005-02-08 20:52:50 +01:00
{
delete derived_result;
WL#2130: Table locking for stored FUNCTIONs Collect all tables and SPs refered by a statement, and open all tables with an implicit LOCK TABLES. Do find things refered by triggers and views, we open them first (and then repeat this until nothing new is found), before doing the actual lock tables. mysql-test/r/information_schema.result: Updated result for WL#2130. mysql-test/r/lock.result: Updated result for WL#2130. mysql-test/r/sp-error.result: Updated result for WL#2130. mysql-test/r/sp.result: Updated result for WL#2130. mysql-test/r/view.result: Updated result for WL#2130. mysql-test/t/information_schema.test: Disabled one test case due to a bug involving LOCK TABLES, which shows up with WL#2130. mysql-test/t/lock.test: New error message with WL#2130. This change is under debate and might change in the future, but will do for now. mysql-test/t/sp-error.test: Updated for WL#2130. Some tests are voided when table access does work from functions. mysql-test/t/sp.test: Updated for WL#2130. mysql-test/t/view.test: Updated for WL#2130. sql/item_func.cc: We now have to set net.no_send_ok for functions too, with WL#2130. sql/share/errmsg.txt: Reused an error code since the old use was voided by WL#2130, but a new one was needed instead (similar, but more specific restriction). sql/sp.cc: Fixed error handling and collection of used tables for WL#2130. sql/sp.h: Fixed error handling and collection of used tables for WL#2130. sql/sp_head.cc: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sp_head.h: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sql_base.cc: Changed the way table->query_id is tested and set during with locked tables in effect. This makes some SP test cases work with WL#2130, but has a side effect on some error cases with explicit LOCK TABLES. It's still debated if this is the correct way, so it might change. sql/sql_class.h: Added flags for circumventing some interference between WL#2130 and mysql_make_view(). sql/sql_derived.cc: Added some missing initializations. (Potential bugs.) sql/sql_lex.cc: Clear the new hash tables for WL#2130. sql/sql_lex.h: Added hash tables for procedures and tables too (as for functions), for WL#2130. sql/sql_parse.cc: WL#2130: Make table accesses from stored functions work by adding an implicit LOCK TABLES around (most) executed statements. To do this, we have to go through a loop where we collect all SPs and tables in mysql_execute_statement. sql/sql_prepare.cc: Cache both functions and procedures for WL#2130. sql/sql_show.cc: Added some missing initializations. (Potential bugs.) sql/sql_view.cc: Shortcut mysql_make_view() if thd->shortcut_make_view is true during the pre-open phase for collecting tables in WL#2130. Otherwise, the similar mechanism here causes interference. sql/sql_yacc.yy: For WL#2130, added caching of procedures and disallowed LOCK/UNLOCK TABLES in SPs.
2005-02-08 20:52:50 +01:00
derived_result= NULL;
}
orig_table_list->derived_result= derived_result;
orig_table_list->table= table;
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
orig_table_list->table_name= (char*) table->s->table_name;
WL#2130: Table locking for stored FUNCTIONs Collect all tables and SPs refered by a statement, and open all tables with an implicit LOCK TABLES. Do find things refered by triggers and views, we open them first (and then repeat this until nothing new is found), before doing the actual lock tables. mysql-test/r/information_schema.result: Updated result for WL#2130. mysql-test/r/lock.result: Updated result for WL#2130. mysql-test/r/sp-error.result: Updated result for WL#2130. mysql-test/r/sp.result: Updated result for WL#2130. mysql-test/r/view.result: Updated result for WL#2130. mysql-test/t/information_schema.test: Disabled one test case due to a bug involving LOCK TABLES, which shows up with WL#2130. mysql-test/t/lock.test: New error message with WL#2130. This change is under debate and might change in the future, but will do for now. mysql-test/t/sp-error.test: Updated for WL#2130. Some tests are voided when table access does work from functions. mysql-test/t/sp.test: Updated for WL#2130. mysql-test/t/view.test: Updated for WL#2130. sql/item_func.cc: We now have to set net.no_send_ok for functions too, with WL#2130. sql/share/errmsg.txt: Reused an error code since the old use was voided by WL#2130, but a new one was needed instead (similar, but more specific restriction). sql/sp.cc: Fixed error handling and collection of used tables for WL#2130. sql/sp.h: Fixed error handling and collection of used tables for WL#2130. sql/sp_head.cc: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sp_head.h: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sql_base.cc: Changed the way table->query_id is tested and set during with locked tables in effect. This makes some SP test cases work with WL#2130, but has a side effect on some error cases with explicit LOCK TABLES. It's still debated if this is the correct way, so it might change. sql/sql_class.h: Added flags for circumventing some interference between WL#2130 and mysql_make_view(). sql/sql_derived.cc: Added some missing initializations. (Potential bugs.) sql/sql_lex.cc: Clear the new hash tables for WL#2130. sql/sql_lex.h: Added hash tables for procedures and tables too (as for functions), for WL#2130. sql/sql_parse.cc: WL#2130: Make table accesses from stored functions work by adding an implicit LOCK TABLES around (most) executed statements. To do this, we have to go through a loop where we collect all SPs and tables in mysql_execute_statement. sql/sql_prepare.cc: Cache both functions and procedures for WL#2130. sql/sql_show.cc: Added some missing initializations. (Potential bugs.) sql/sql_view.cc: Shortcut mysql_make_view() if thd->shortcut_make_view is true during the pre-open phase for collecting tables in WL#2130. Otherwise, the similar mechanism here causes interference. sql/sql_yacc.yy: For WL#2130, added caching of procedures and disallowed LOCK/UNLOCK TABLES in SPs.
2005-02-08 20:52:50 +01:00
orig_table_list->table_name_length= strlen((char*)table->s->table_name);
table->derived_select_number= first_select->select_number;
First stage of table definition cache Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon) Created Field::make_field() and made Field_num::make_field() to call this Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer. Renamed TABLE_SHARE->real_name to table_name Renamed TABLE->table_name to alias Renamed TABLE_LIST->real_name to table_name include/myisam.h: Added const before names mysql-test/r/group_min_max.result: Make results repeatable mysql-test/t/group_min_max.test: Make results repeatable sql/field.cc: Created Field::make_field() and made Field_num::make_field() to call this Use TABLE_SHARE Use sql_strmake() instead of sql_memdup() to simplify code sql/field.h: Changed table_name to be pointer to table_name. This allows us to change alias for all fields by just changing one pointer. Use TABLE_SHARE sql/field_conv.cc: Use TABLE_SHARE sql/filesort.cc: Use TABLE_SHARE sql/ha_berkeley.cc: Use TABLE_SHARE sql/ha_heap.cc: Use TABLE_SHARE sql/ha_innodb.cc: Use TABLE_SHARE sql/ha_myisam.cc: Use TABLE_SHARE sql/ha_myisammrg.cc: Use TABLE_SHARE Change some pointer handling to use const char* sql/ha_ndbcluster.cc: Use TABLE_SHARE sql/handler.cc: Use TABLE_SHARE sql/item.cc: Use TABLE_SHARE sql/item_func.cc: Use TABLE_SHARE sql/item_subselect.cc: Use TABLE_SHARE sql/item_sum.cc: Use TABLE_SHARE sql/key.cc: Use TABLE_SHARE sql/lock.cc: Use TABLE_SHARE sql/log_event.cc: real_name -> table_name sql/mysql_priv.h: Use TABLE_SHARE sql/opt_range.cc: Use TABLE_SHARE sql/opt_sum.cc: Use TABLE_SHARE sql/records.cc: Use TABLE_SHARE sql/repl_failsafe.cc: real_name -> table_name sql/slave.cc: Use TABLE_SHARE sql/sp.cc: Use TABLE_SHARE sql/sp_head.cc: real_name -> table_name sql/sql_acl.cc: Use TABLE_SHARE removed unnecessary assert fixed indentation changed some char * -> const char* sql/sql_acl.h: changed some char* -> const char* sql/sql_base.cc: Use TABLE_SHARE sql/sql_cache.cc: Use TABLE_SHARE sql/sql_class.cc: Use TABLE_SHARE sql/sql_db.cc: real_name -> table_name sql/sql_delete.cc: Use TABLE_SHARE sql/sql_derived.cc: Use TABLE_SHARE sql/sql_handler.cc: Use TABLE_SHARE sql/sql_help.cc: Use TABLE_SHARE sql/sql_insert.cc: Use TABLE_SHARE sql/sql_load.cc: Use TABLE_SHARE sql/sql_parse.cc: Use TABLE_SHARE sql/sql_rename.cc: real_name -> table_name sql/sql_select.cc: Use TABLE_SHARE table->blob_fields now points to field offsets, not fields tmp_table->table_name now points to alias name sql/sql_show.cc: Use TABLE_SHARE sql/sql_table.cc: Use TABLE_SHARE sql/sql_test.cc: Use TABLE_SHARE sql/sql_trigger.cc: Use TABLE_SHARE sql/sql_udf.cc: Use TABLE_SHARE sql/sql_union.cc: real_name -> table_name sql/sql_update.cc: Use TABLE_SHARE sql/sql_view.cc: Use TABLE_SHARE sql/table.cc: Split TABLE to TABLE and TABLE_SHARE Changed blob_field to be field offsets instead of pointer to fields Only initialize table->s->default_values with default record (not all table->record[#]) Some indentation changes sql/table.h: Split TABLE to TABLE and TABLE_SHARE sql/tztime.cc: real_name -> table_name sql/unireg.cc: Use TABLE_SHARE sql/unireg.h: Use TABLE_SHARE
2005-01-06 12:00:13 +01:00
table->s->tmp_table= TMP_TABLE;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
table->grant.privilege= SELECT_ACL;
#endif
orig_table_list->db= (char *)"";
WL#2130: Table locking for stored FUNCTIONs Collect all tables and SPs refered by a statement, and open all tables with an implicit LOCK TABLES. Do find things refered by triggers and views, we open them first (and then repeat this until nothing new is found), before doing the actual lock tables. mysql-test/r/information_schema.result: Updated result for WL#2130. mysql-test/r/lock.result: Updated result for WL#2130. mysql-test/r/sp-error.result: Updated result for WL#2130. mysql-test/r/sp.result: Updated result for WL#2130. mysql-test/r/view.result: Updated result for WL#2130. mysql-test/t/information_schema.test: Disabled one test case due to a bug involving LOCK TABLES, which shows up with WL#2130. mysql-test/t/lock.test: New error message with WL#2130. This change is under debate and might change in the future, but will do for now. mysql-test/t/sp-error.test: Updated for WL#2130. Some tests are voided when table access does work from functions. mysql-test/t/sp.test: Updated for WL#2130. mysql-test/t/view.test: Updated for WL#2130. sql/item_func.cc: We now have to set net.no_send_ok for functions too, with WL#2130. sql/share/errmsg.txt: Reused an error code since the old use was voided by WL#2130, but a new one was needed instead (similar, but more specific restriction). sql/sp.cc: Fixed error handling and collection of used tables for WL#2130. sql/sp.h: Fixed error handling and collection of used tables for WL#2130. sql/sp_head.cc: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sp_head.h: Added support functions for collecting and merging hash tables and lists of used tables from SPs and substatements, for WL#2130. sql/sql_base.cc: Changed the way table->query_id is tested and set during with locked tables in effect. This makes some SP test cases work with WL#2130, but has a side effect on some error cases with explicit LOCK TABLES. It's still debated if this is the correct way, so it might change. sql/sql_class.h: Added flags for circumventing some interference between WL#2130 and mysql_make_view(). sql/sql_derived.cc: Added some missing initializations. (Potential bugs.) sql/sql_lex.cc: Clear the new hash tables for WL#2130. sql/sql_lex.h: Added hash tables for procedures and tables too (as for functions), for WL#2130. sql/sql_parse.cc: WL#2130: Make table accesses from stored functions work by adding an implicit LOCK TABLES around (most) executed statements. To do this, we have to go through a loop where we collect all SPs and tables in mysql_execute_statement. sql/sql_prepare.cc: Cache both functions and procedures for WL#2130. sql/sql_show.cc: Added some missing initializations. (Potential bugs.) sql/sql_view.cc: Shortcut mysql_make_view() if thd->shortcut_make_view is true during the pre-open phase for collecting tables in WL#2130. Otherwise, the similar mechanism here causes interference. sql/sql_yacc.yy: For WL#2130, added caching of procedures and disallowed LOCK/UNLOCK TABLES in SPs.
2005-02-08 20:52:50 +01:00
orig_table_list->db_length= 0;
// Force read of table stats in the optimizer
table->file->info(HA_STATUS_VARIABLE);
/* Add new temporary table to list of open derived tables */
table->next= thd->derived_tables;
thd->derived_tables= table;
}
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
}
else if (orig_table_list->ancestor)
orig_table_list->set_ancestor();
DBUG_RETURN(res);
}
/*
fill derived table
SYNOPSIS
mysql_derived_filling()
thd Thread handle
lex LEX for this thread
unit node that contains all SELECT's for derived tables
orig_table_list TABLE_LIST for the upper SELECT
IMPLEMENTATION
Derived table is resolved with temporary table. It is created based on the
queries defined. After temporary table is filled, if this is not EXPLAIN,
then the entire unit / node is deleted. unit is deleted if UNION is used
for derived table and node is deleted is it is a simple SELECT.
Patch two (the final one) for Bug#7306 "the server side preparedStatement error for LIMIT placeholder". The patch adds grammar support for LIMIT ?, ? and changes the type of ST_SELECT_LEX::select_limit,offset_limit from ha_rows to Item*, so that it can point to Item_param. mysql-test/include/ps_modify.inc: Fix existing tests: now LIMIT can contain placeholders. mysql-test/include/ps_query.inc: Fix existing tests: now LIMIT can contain placeholders. mysql-test/r/ps.result: Add basic test coverage for LIMIT ?, ? and fix test results. mysql-test/r/ps_2myisam.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_3innodb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_4heap.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_5merge.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_6bdb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_7ndb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/t/ps.test: Add basic test coverage for LIMIT ?, ?. sql/item.h: Add a short-cut for (ulonglong) val_int() to Item. Add a constructor to Item_int() that accepts ulonglong. Simplify Item_uint constructor by using the c-tor above. sql/item_subselect.cc: Now select_limit has type Item *. We can safely create an Item in Item_exists_subselect::fix_length_and_dec(): it will be allocated in runtime memory root and freed in the end of execution. sql/sp_head.cc: Add a special initalization state for stored procedures to be able to easily distinguish the first execution of a stored procedure from prepared statement prepare. sql/sql_class.h: Introduce new state 'INITIALIZED_FOR_SP' to be able to easily distinguish the first execution of a stored procedure from prepared statement prepare. sql/sql_derived.cc: - use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt evreryplace. Add a warning about use of set_limit in mysql_derived_filling. sql/sql_error.cc: - use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt evreryplace. - this change is also aware of bug#11095 "show warnings limit 0 returns all rows instead of zero rows", so the one who merges the bugfix from 4.1 can use local version of sql_error.cc. sql/sql_handler.cc: - use unit->set_limit() to initalize unit->select_limit_cnt,offset_limit_cnt everyplace. sql/sql_lex.cc: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_lex.h: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_parse.cc: - use unit->set_limit() to initalize unit->select_limit_cnt,offset_limit_cnt everyplace. - we can create an Item_int to set global limit of a statement: it will be created in the runtime mem root and freed in the end of execution. sql/sql_repl.cc: Use unit->set_limit to initialize limits. sql/sql_select.cc: - select_limit is now Item* so the proper way to check for default value is to compare it with NULL. sql/sql_union.cc: Evaluate offset_limit_cnt using the new type of ST_SELECT_LEX::offset_limit sql/sql_view.cc: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_yacc.yy: Add grammar support for LIMIT ?, ? clause.
2005-06-07 12:11:36 +02:00
If you use this function, make sure it's not called at prepare.
Due to evaluation of LIMIT clause it can not be used at prepared stage.
RETURN
0 ok
1 Error
-1 Error and error message given
*/
int mysql_derived_filling(THD *thd, LEX *lex, TABLE_LIST *orig_table_list)
{
TABLE *table= orig_table_list->table;
SELECT_LEX_UNIT *unit= orig_table_list->derived;
int res= 0;
/*check that table creation pass without problem and it is derived table */
if (table && unit)
now all tables of query are locked in one place (including derived tables) fixed BUG#2120 and other problem with EXPLAINing derived tables mysql-test/r/derived.result: correct tables names & Co in derived tables test case for BUG#2120 mysql-test/t/derived.test: test case for BUG#2120 sql/mysql_priv.h: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/repl_failsafe.cc: correct initialization of TABLE_LIST sql/sql_acl.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_base.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_delete.cc: all tables processing is done during opening sql/sql_derived.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) to sutisfy "all query tables locking" at the moment sql/sql_insert.cc: all tables processing is done during opening correct initialization of TABLE_LIST sql/sql_lex.cc: now table list will be created for whole query layout fix correct check of updated table in subqueries sql/sql_lex.h: now table list will be created for whole query correct check of updated table in subqueries sql/sql_olap.cc: THIS FUNCTION IS USED NOWHERE it will be good to remove it at all (handle_olaps) sql/sql_parse.cc: derived tables processing moved after open/locking all tables (in open_and_lock_tables) sql/sql_prepare.cc: new creating list parameters all tables processing is done during opening sql/sql_select.cc: all tables processing is done during opening sql/sql_select.h: now it used only within file where is defined sql/sql_udf.cc: used simple table opening without derived table processing to avoid unneeded initialization of SELECT_LEX sql/sql_update.cc: all tables processing is done during opening
2004-02-01 14:30:32 +01:00
{
SELECT_LEX *first_select= unit->first_select();
select_union *derived_result= orig_table_list->derived_result;
SELECT_LEX *save_current_select= lex->current_select;
bool is_union= first_select->next_select() &&
first_select->next_select()->linkage == UNION_TYPE;
if (is_union)
{
// execute union without clean up
res= unit->exec();
}
else
{
Patch two (the final one) for Bug#7306 "the server side preparedStatement error for LIMIT placeholder". The patch adds grammar support for LIMIT ?, ? and changes the type of ST_SELECT_LEX::select_limit,offset_limit from ha_rows to Item*, so that it can point to Item_param. mysql-test/include/ps_modify.inc: Fix existing tests: now LIMIT can contain placeholders. mysql-test/include/ps_query.inc: Fix existing tests: now LIMIT can contain placeholders. mysql-test/r/ps.result: Add basic test coverage for LIMIT ?, ? and fix test results. mysql-test/r/ps_2myisam.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_3innodb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_4heap.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_5merge.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_6bdb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/r/ps_7ndb.result: Fix test results: now LIMIT can contain placeholders. mysql-test/t/ps.test: Add basic test coverage for LIMIT ?, ?. sql/item.h: Add a short-cut for (ulonglong) val_int() to Item. Add a constructor to Item_int() that accepts ulonglong. Simplify Item_uint constructor by using the c-tor above. sql/item_subselect.cc: Now select_limit has type Item *. We can safely create an Item in Item_exists_subselect::fix_length_and_dec(): it will be allocated in runtime memory root and freed in the end of execution. sql/sp_head.cc: Add a special initalization state for stored procedures to be able to easily distinguish the first execution of a stored procedure from prepared statement prepare. sql/sql_class.h: Introduce new state 'INITIALIZED_FOR_SP' to be able to easily distinguish the first execution of a stored procedure from prepared statement prepare. sql/sql_derived.cc: - use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt evreryplace. Add a warning about use of set_limit in mysql_derived_filling. sql/sql_error.cc: - use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt evreryplace. - this change is also aware of bug#11095 "show warnings limit 0 returns all rows instead of zero rows", so the one who merges the bugfix from 4.1 can use local version of sql_error.cc. sql/sql_handler.cc: - use unit->set_limit() to initalize unit->select_limit_cnt,offset_limit_cnt everyplace. sql/sql_lex.cc: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_lex.h: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_parse.cc: - use unit->set_limit() to initalize unit->select_limit_cnt,offset_limit_cnt everyplace. - we can create an Item_int to set global limit of a statement: it will be created in the runtime mem root and freed in the end of execution. sql/sql_repl.cc: Use unit->set_limit to initialize limits. sql/sql_select.cc: - select_limit is now Item* so the proper way to check for default value is to compare it with NULL. sql/sql_union.cc: Evaluate offset_limit_cnt using the new type of ST_SELECT_LEX::offset_limit sql/sql_view.cc: Now ST_SELECT_LEX::select_limit, offset_limit have type Item * sql/sql_yacc.yy: Add grammar support for LIMIT ?, ? clause.
2005-06-07 12:11:36 +02:00
unit->set_limit(first_select);
if (unit->select_limit_cnt == HA_POS_ERROR)
first_select->options&= ~OPTION_FOUND_ROWS;
lex->current_select= first_select;
res= mysql_select(thd, &first_select->ref_pointer_array,
(TABLE_LIST*) first_select->table_list.first,
first_select->with_wild,
first_select->item_list, first_select->where,
(first_select->order_list.elements+
first_select->group_list.elements),
(ORDER *) first_select->order_list.first,
(ORDER *) first_select->group_list.first,
first_select->having, (ORDER*) NULL,
(first_select->options | thd->options |
SELECT_NO_UNLOCK),
derived_result, unit, first_select);
}
if (!res)
{
/*
Here we entirely fix both TABLE_LIST and list of SELECT's as
there were no derived tables
*/
if (derived_result->flush())
res= 1;
Fixed UNION fields type/length detecting mysql-test/r/union.result: new results with max union field length detecting type conversion tests mysql-test/t/union.test: type conversion tests sql/field.h: field converion support sql/item.cc: fixed printing field of internal temporary table of SELECT (reference from HAVING clause) layout fix new item for storing field type sql/item.h: new item for storing field type sql/item_subselect.cc: new subquery item length/dec detecting sql/mysql_priv.h: we do not need pre-inited tables and fields sql/sql_base.cc: we do not need double fix_fielding sql/sql_class.h: we do not need double fix_fielding sql/sql_derived.cc: preparing moved before temporary table creation sql/sql_lex.h: we do not need pre-inited tables and fields new lists to store fields types and fields of temporary table sql/sql_parse.cc: we do not need pre-inited tables and fields sql/sql_prepare.cc: we do not need pre-inited tables and fields sql/sql_select.cc: we do not need pre-inited tables and fields support mysql_select call from derived tables after it preparing (in derived table routing) support of crreating temporary table fields from Item_type_holder sql/sql_select.h: we do not need pre-inited tables and fields sql/sql_union.cc: we do not need pre-inited tables and fields check of columns number in union moved to prepare() prepering of SELECTS moved before temporary table creation, fixed union columns type/length detecting sql/sql_update.cc: we do not need pre-inited tables and fields
2003-11-23 01:01:15 +01:00
if (!lex->describe)
unit->cleanup();
}
else
unit->cleanup();
lex->current_select= save_current_select;
}
return res;
}