mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +03:00
Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0
into a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.1-new mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/grant.result: Auto merged mysql-test/r/heap_btree.result: Auto merged mysql-test/r/information_schema_db.result: Auto merged mysql-test/r/lock_multi.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/view_grant.result: Auto merged mysql-test/t/lock_multi.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/view_grant.test: Auto merged mysys/default.c: Auto merged server-tools/instance-manager/guardian.cc: Auto merged sql/field.h: Auto merged sql/item.h: Auto merged sql/item_subselect.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/lock.cc: Auto merged sql/mysql_priv.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_update.cc: Auto merged sql/table.cc: Auto merged storage/heap/hp_write.c: Auto merged storage/ndb/src/ndbapi/DictCache.cpp: Auto merged storage/ndb/src/ndbapi/DictCache.hpp: Auto merged client/mysqlbinlog.cc: Manual merge from 5.0 client/mysqldump.c: Manual merge from 5.0 configure.in: Manual merge from 5.0 mysql-test/r/mysqldump.result: Manual merge from 5.0 mysql-test/t/mysqldump.test: Manual merge from 5.0 mysql-test/t/rpl_insert_id.test: Manual merge from 5.0 server-tools/instance-manager/manager.cc: Manual merge from 5.0 sql/field.cc: Manual merge from 5.0 sql/ha_ndbcluster.cc: Manual merge from 5.0 sql/mysqld.cc: Manual merge from 5.0 sql/sql_base.cc: Manual merge from 5.0 sql/sql_lex.cc: Manual merge from 5.0 sql/sql_select.cc: Manual merge from 5.0 sql/sql_table.cc: Manual merge from 5.0
This commit is contained in:
108
sql/sql_lex.cc
108
sql/sql_lex.cc
@@ -152,8 +152,7 @@ void lex_start(THD *thd, const uchar *buf, uint length)
|
||||
lex->found_semicolon= 0;
|
||||
lex->safe_to_cache_query= 1;
|
||||
lex->time_zone_tables_used= 0;
|
||||
lex->leaf_tables_insert= lex->query_tables= 0;
|
||||
lex->query_tables_last= &lex->query_tables;
|
||||
lex->leaf_tables_insert= 0;
|
||||
lex->variables_used= 0;
|
||||
lex->empty_field_list_on_rset= 0;
|
||||
lex->select_lex.select_number= 1;
|
||||
@@ -175,17 +174,12 @@ void lex_start(THD *thd, const uchar *buf, uint length)
|
||||
lex->sphead= NULL;
|
||||
lex->spcont= NULL;
|
||||
lex->proc_list.first= 0;
|
||||
lex->query_tables_own_last= 0;
|
||||
lex->escape_used= lex->et_compile_phase= FALSE;
|
||||
lex->reset_query_tables_list(FALSE);
|
||||
|
||||
lex->name= 0;
|
||||
lex->et= NULL;
|
||||
|
||||
if (lex->sroutines.records)
|
||||
my_hash_reset(&lex->sroutines);
|
||||
lex->sroutines_list.empty();
|
||||
lex->sroutines_list_own_last= lex->sroutines_list.next;
|
||||
lex->sroutines_list_own_elements= 0;
|
||||
lex->nest_level=0 ;
|
||||
lex->allow_sum_func= 0;
|
||||
lex->in_sum_func= NULL;
|
||||
@@ -1603,6 +1597,52 @@ void st_select_lex::print_limit(THD *thd, String *str)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Initialize (or reset) Query_tables_list object.
|
||||
|
||||
SYNOPSIS
|
||||
reset_query_tables_list()
|
||||
init TRUE - we should perform full initialization of object with
|
||||
allocating needed memory
|
||||
FALSE - object is already initialized so we should only reset
|
||||
its state so it can be used for parsing/processing
|
||||
of new statement
|
||||
|
||||
DESCRIPTION
|
||||
This method initializes Query_tables_list so it can be used as part
|
||||
of LEX object for parsing/processing of statement. One can also use
|
||||
this method to reset state of already initialized Query_tables_list
|
||||
so it can be used for processing of new statement.
|
||||
*/
|
||||
|
||||
void Query_tables_list::reset_query_tables_list(bool init)
|
||||
{
|
||||
query_tables= 0;
|
||||
query_tables_last= &query_tables;
|
||||
query_tables_own_last= 0;
|
||||
if (init)
|
||||
hash_init(&sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, 0, 0);
|
||||
else if (sroutines.records)
|
||||
my_hash_reset(&sroutines);
|
||||
sroutines_list.empty();
|
||||
sroutines_list_own_last= sroutines_list.next;
|
||||
sroutines_list_own_elements= 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Destroy Query_tables_list object with freeing all resources used by it.
|
||||
|
||||
SYNOPSIS
|
||||
destroy_query_tables_list()
|
||||
*/
|
||||
|
||||
void Query_tables_list::destroy_query_tables_list()
|
||||
{
|
||||
hash_free(&sroutines);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Initialize LEX object.
|
||||
|
||||
@@ -1619,12 +1659,9 @@ void st_select_lex::print_limit(THD *thd, String *str)
|
||||
|
||||
st_lex::st_lex()
|
||||
:result(0), yacc_yyss(0), yacc_yyvs(0),
|
||||
sql_command(SQLCOM_END), query_tables_own_last(0)
|
||||
sql_command(SQLCOM_END)
|
||||
{
|
||||
hash_init(&sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, 0, 0);
|
||||
sroutines_list.empty();
|
||||
sroutines_list_own_last= sroutines_list.next;
|
||||
sroutines_list_own_elements= 0;
|
||||
reset_query_tables_list(TRUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -2008,6 +2045,11 @@ void st_lex::link_first_table_back(TABLE_LIST *first,
|
||||
|
||||
SYNOPSIS
|
||||
st_lex::cleanup_after_one_table_open()
|
||||
|
||||
NOTE
|
||||
This method is mostly responsible for cleaning up of selects lists and
|
||||
derived tables state. To rollback changes in Query_tables_list one has
|
||||
to call Query_tables_list::reset_query_tables_list(FALSE).
|
||||
*/
|
||||
|
||||
void st_lex::cleanup_after_one_table_open()
|
||||
@@ -2034,11 +2076,41 @@ void st_lex::cleanup_after_one_table_open()
|
||||
select_lex.cut_subtree();
|
||||
}
|
||||
time_zone_tables_used= 0;
|
||||
if (sroutines.records)
|
||||
my_hash_reset(&sroutines);
|
||||
sroutines_list.empty();
|
||||
sroutines_list_own_last= sroutines_list.next;
|
||||
sroutines_list_own_elements= 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Save current state of Query_tables_list for this LEX, and prepare it
|
||||
for processing of new statemnt.
|
||||
|
||||
SYNOPSIS
|
||||
reset_n_backup_query_tables_list()
|
||||
backup Pointer to Query_tables_list instance to be used for backup
|
||||
*/
|
||||
|
||||
void st_lex::reset_n_backup_query_tables_list(Query_tables_list *backup)
|
||||
{
|
||||
backup->set_query_tables_list(this);
|
||||
/*
|
||||
We have to perform full initialization here since otherwise we
|
||||
will damage backed up state.
|
||||
*/
|
||||
this->reset_query_tables_list(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Restore state of Query_tables_list for this LEX from backup.
|
||||
|
||||
SYNOPSIS
|
||||
restore_backup_query_tables_list()
|
||||
backup Pointer to Query_tables_list instance used for backup
|
||||
*/
|
||||
|
||||
void st_lex::restore_backup_query_tables_list(Query_tables_list *backup)
|
||||
{
|
||||
this->destroy_query_tables_list();
|
||||
this->set_query_tables_list(backup);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user