Commit 02614a02 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
parents 849ab318 a1b6f6db
......@@ -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
......
......@@ -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);
......
......@@ -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
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment