summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-07-21 22:48:05 +0300
committerunknown <bell@sanja.is.com.ua>2004-07-21 22:48:05 +0300
commit062ac038dfd9332d121287aa4b91eaff0477aa34 (patch)
treec8401236319e4bc97183ee7ebe06f75d176da1df
parent1cd522ec04e9f0beff5f014a07f9f36c1d45bd7a (diff)
parentff4aa03dc5e20501fbb3541dfef55f13cd7ca221 (diff)
downloadmariadb-git-062ac038dfd9332d121287aa4b91eaff0477aa34.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/mysql_priv.h2
-rw-r--r--sql/sql_lex.cc12
-rw-r--r--sql/sql_lex.h6
-rw-r--r--sql/sql_parse.cc12
-rw-r--r--sql/sql_prepare.cc4
6 files changed, 18 insertions, 20 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc
index ffc54362ea2..d10b83d550a 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -1706,7 +1706,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli,
Usually mysql_init_query() is called by mysql_parse(), but we need it here
as the present method does not call mysql_parse().
*/
- mysql_init_query(thd);
+ mysql_init_query(thd, 0, 0);
if (!use_rli_only_for_errors)
{
#if MYSQL_VERSION_ID < 50000
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 8707bc205df..53f21213d0e 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -434,7 +434,7 @@ bool mysql_test_parse_for_slave(THD *thd,char *inBuf,uint length);
bool is_update_query(enum enum_sql_command command);
bool alloc_query(THD *thd, char *packet, ulong packet_length);
void mysql_init_select(LEX *lex);
-void mysql_init_query(THD *thd);
+void mysql_init_query(THD *thd, uchar *buf, uint length);
bool mysql_new_select(LEX *lex, bool move_down);
void create_select_for_variable(const char *var_name);
void mysql_init_multi_delete(LEX *lex);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index d945eef1425..949eaba7311 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -104,14 +104,13 @@ void lex_free(void)
(We already do too much here)
*/
-LEX *lex_start(THD *thd, uchar *buf,uint length)
+void lex_start(THD *thd, uchar *buf,uint length)
{
LEX *lex= thd->lex;
lex->thd= thd;
lex->next_state=MY_LEX_START;
lex->end_of_query=(lex->ptr=buf)+length;
lex->yylineno = 1;
- lex->select_lex.parsing_place= SELECT_LEX_NODE::NO_MATTER;
lex->in_comment=0;
lex->length=0;
lex->select_lex.in_sum_expr=0;
@@ -125,7 +124,6 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex->ignore_space=test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
lex->sql_command=SQLCOM_END;
lex->duplicates= DUP_ERROR;
- return lex;
}
void lex_end(LEX *lex)
@@ -1009,6 +1007,7 @@ void st_select_lex::init_query()
select_n_having_items= 0;
prep_where= 0;
subquery_in_having= explicit_limit= 0;
+ parsing_place= SELECT_LEX_NODE::NO_MATTER;
}
void st_select_lex::init_select()
@@ -1022,9 +1021,9 @@ void st_select_lex::init_select()
in_sum_expr= with_wild= 0;
options= 0;
braces= 0;
- when_list.empty();
+ when_list.empty();
expr_list.empty();
- interval_list.empty();
+ interval_list.empty();
use_index.empty();
ftfunc_list_alloc.empty();
ftfunc_list= &ftfunc_list_alloc;
@@ -1035,7 +1034,6 @@ void st_select_lex::init_select()
select_limit= HA_POS_ERROR;
offset_limit= 0;
with_sum_func= 0;
- parsing_place= SELECT_LEX_NODE::NO_MATTER;
}
/*
@@ -1055,7 +1053,7 @@ void st_select_lex_node::include_down(st_select_lex_node *upper)
/*
include on level down (but do not link)
-
+
SYNOPSYS
st_select_lex_node::include_standalone()
upper - reference on node underr which this node should be included
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 328df2f6bb9..5348d5e5646 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -375,7 +375,7 @@ public:
ulong init_prepare_fake_select_lex(THD *thd);
int change_result(select_subselect *result, select_subselect *old_result);
- friend void mysql_init_query(THD *thd);
+ friend void mysql_init_query(THD *thd, uchar *buf, uint length);
friend int subselect_union_engine::exec();
private:
bool create_total_list_n_last_return(THD *thd, st_lex *lex,
@@ -514,7 +514,7 @@ public:
bool test_limit();
- friend void mysql_init_query(THD *thd);
+ friend void mysql_init_query(THD *thd, uchar *buf, uint length);
st_select_lex() {}
void make_empty_select()
{
@@ -664,7 +664,7 @@ typedef struct st_lex
void lex_init(void);
void lex_free(void);
-LEX *lex_start(THD *thd, uchar *buf,uint length);
+void lex_start(THD *thd, uchar *buf,uint length);
void lex_end(LEX *lex);
extern pthread_key(LEX*,THR_LEX);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e83868bac7c..b69d582f30b 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3850,7 +3850,7 @@ bool my_yyoverflow(short **yyss, YYSTYPE **yyvs, ulong *yystacksize)
****************************************************************************/
void
-mysql_init_query(THD *thd)
+mysql_init_query(THD *thd, uchar *buf, uint length)
{
DBUG_ENTER("mysql_init_query");
LEX *lex= thd->lex;
@@ -3875,6 +3875,7 @@ mysql_init_query(THD *thd)
lex->lock_option= TL_READ;
lex->found_colon= 0;
lex->safe_to_cache_query= 1;
+ lex_start(thd, buf, length);
thd->select_number= lex->select_lex.select_number= 1;
thd->free_list= 0;
thd->total_warn_count=0; // Warnings for this query
@@ -4012,10 +4013,10 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
{
DBUG_ENTER("mysql_parse");
- mysql_init_query(thd);
+ mysql_init_query(thd, (uchar*) inBuf, length);
if (query_cache_send_result_to_client(thd, inBuf, length) <= 0)
{
- LEX *lex=lex_start(thd, (uchar*) inBuf, length);
+ LEX *lex= thd->lex;
if (!yyparse((void *)thd) && ! thd->is_fatal_error)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@@ -4062,11 +4063,10 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
{
- LEX *lex;
+ LEX *lex= thd->lex;
bool error= 0;
- mysql_init_query(thd);
- lex= lex_start(thd, (uchar*) inBuf, length);
+ mysql_init_query(thd, (uchar*) inBuf, length);
if (!yyparse((void*) thd) && ! thd->is_fatal_error &&
all_tables_not_ok(thd,(TABLE_LIST*) lex->select_lex.table_list.first))
error= 1; /* Ignore question */
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 4305bee42a2..6435c7407a9 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1613,8 +1613,8 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
mysql_log.write(thd, COM_PREPARE, "%s", packet);
thd->current_statement= stmt;
- lex= lex_start(thd, (uchar *) thd->query, thd->query_length);
- mysql_init_query(thd);
+ mysql_init_query(thd, (uchar *) thd->query, thd->query_length);
+ lex= thd->lex;
lex->safe_to_cache_query= 0;
error= yyparse((void *)thd) || thd->is_fatal_error ||