Merging lex-pointer change from 4.1 to 5.0.
libmysqld/lib_sql.cc: Auto merged sql/filesort.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/item_func.cc: Auto merged sql/item_subselect.cc: Auto merged sql/item_sum.cc: Auto merged sql/mysql_priv.h: Auto merged sql/protocol.cc: Auto merged sql/slave.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_union.cc: Auto merged sql/sql_update.cc: Auto merged
This commit is contained in:
commit
24e886a3fb
@ -390,7 +390,7 @@ int ha_myisam::analyze(THD *thd, HA_CHECK_OPT* check_opt)
|
|||||||
int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
|
int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
|
||||||
{
|
{
|
||||||
HA_CHECK_OPT tmp_check_opt;
|
HA_CHECK_OPT tmp_check_opt;
|
||||||
char* backup_dir = thd->lex->backup_dir;
|
char* backup_dir= thd->lex->backup_dir;
|
||||||
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
|
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
|
||||||
char* table_name = table->real_name;
|
char* table_name = table->real_name;
|
||||||
int error;
|
int error;
|
||||||
@ -430,7 +430,7 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
|
|||||||
|
|
||||||
int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
|
int ha_myisam::backup(THD* thd, HA_CHECK_OPT *check_opt)
|
||||||
{
|
{
|
||||||
char* backup_dir = thd->lex->backup_dir;
|
char* backup_dir= thd->lex->backup_dir;
|
||||||
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
|
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
|
||||||
char* table_name = table->real_name;
|
char* table_name = table->real_name;
|
||||||
int error;
|
int error;
|
||||||
|
@ -54,7 +54,7 @@ Item::Item():
|
|||||||
thd->free_list= this;
|
thd->free_list= this;
|
||||||
/*
|
/*
|
||||||
Item constructor can be called during execution other then SQL_COM
|
Item constructor can be called during execution other then SQL_COM
|
||||||
command => we should check thd->lex.current_select on zero (thd->lex
|
command => we should check thd->lex->current_select on zero (thd->lex
|
||||||
can be uninitialised)
|
can be uninitialised)
|
||||||
*/
|
*/
|
||||||
if (thd->lex->current_select)
|
if (thd->lex->current_select)
|
||||||
@ -873,7 +873,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||||||
Item **refer= (Item **)not_found_item;
|
Item **refer= (Item **)not_found_item;
|
||||||
uint counter;
|
uint counter;
|
||||||
// Prevent using outer fields in subselects, that is not supported now
|
// Prevent using outer fields in subselects, that is not supported now
|
||||||
SELECT_LEX *cursel=(SELECT_LEX *) thd->lex->current_select;
|
SELECT_LEX *cursel= (SELECT_LEX *) thd->lex->current_select;
|
||||||
if (cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE)
|
if (cursel->master_unit()->first_select()->linkage != DERIVED_TABLE_TYPE)
|
||||||
{
|
{
|
||||||
SELECT_LEX_UNIT *prev_unit= cursel->master_unit();
|
SELECT_LEX_UNIT *prev_unit= cursel->master_unit();
|
||||||
|
@ -1723,7 +1723,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||||||
if (item->maybe_null)
|
if (item->maybe_null)
|
||||||
maybe_null=1;
|
maybe_null=1;
|
||||||
}
|
}
|
||||||
thd->lex->current_select->cond_count+=list.elements;
|
thd->lex->current_select->cond_count+= list.elements;
|
||||||
fix_length_and_dec();
|
fix_length_and_dec();
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -76,7 +76,7 @@ Item *create_func_ceiling(Item* a)
|
|||||||
Item *create_func_connection_id(void)
|
Item *create_func_connection_id(void)
|
||||||
{
|
{
|
||||||
THD *thd=current_thd;
|
THD *thd=current_thd;
|
||||||
thd->lex->safe_to_cache_query=0;
|
thd->lex->safe_to_cache_query= 0;
|
||||||
return new Item_int(NullS,(longlong)
|
return new Item_int(NullS,(longlong)
|
||||||
((thd->slave_thread) ?
|
((thd->slave_thread) ?
|
||||||
thd->variables.pseudo_thread_id :
|
thd->variables.pseudo_thread_id :
|
||||||
@ -148,7 +148,7 @@ Item *create_func_floor(Item* a)
|
|||||||
Item *create_func_found_rows(void)
|
Item *create_func_found_rows(void)
|
||||||
{
|
{
|
||||||
THD *thd=current_thd;
|
THD *thd=current_thd;
|
||||||
thd->lex->safe_to_cache_query=0;
|
thd->lex->safe_to_cache_query= 0;
|
||||||
return new Item_int(NullS,(longlong) thd->found_rows(),21);
|
return new Item_int(NullS,(longlong) thd->found_rows(),21);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1278,7 +1278,7 @@ static void server_init(void)
|
|||||||
void yyerror(const char *s)
|
void yyerror(const char *s)
|
||||||
{
|
{
|
||||||
THD *thd=current_thd;
|
THD *thd=current_thd;
|
||||||
char *yytext=(char*) thd->lex->tok_start;
|
char *yytext= (char*) thd->lex->tok_start;
|
||||||
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
|
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
|
||||||
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
|
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
|
||||||
s=ER(ER_SYNTAX_ERROR);
|
s=ER(ER_SYNTAX_ERROR);
|
||||||
@ -1885,7 +1885,7 @@ extern "C" int my_message_sql(uint error, const char *str,
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
thd->lex.current_select == 0 if lex structure is not inited
|
thd->lex->current_select == 0 if lex structure is not inited
|
||||||
(not query command (COM_QUERY))
|
(not query command (COM_QUERY))
|
||||||
*/
|
*/
|
||||||
if (thd->lex->current_select &&
|
if (thd->lex->current_select &&
|
||||||
|
@ -441,7 +441,7 @@ int show_new_master(THD* thd)
|
|||||||
DBUG_ENTER("show_new_master");
|
DBUG_ENTER("show_new_master");
|
||||||
List<Item> field_list;
|
List<Item> field_list;
|
||||||
char errmsg[SLAVE_ERRMSG_SIZE];
|
char errmsg[SLAVE_ERRMSG_SIZE];
|
||||||
LEX_MASTER_INFO* lex_mi = &thd->lex->mi;
|
LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
|
||||||
|
|
||||||
errmsg[0]=0; // Safety
|
errmsg[0]=0; // Safety
|
||||||
if (translate_master(thd, lex_mi, errmsg))
|
if (translate_master(thd, lex_mi, errmsg))
|
||||||
|
@ -1573,7 +1573,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
USER_RESOURCES mqh = thd->lex->mqh;
|
USER_RESOURCES mqh= thd->lex->mqh;
|
||||||
if (mqh.bits & 1)
|
if (mqh.bits & 1)
|
||||||
table->field[28]->store((longlong) mqh.questions);
|
table->field[28]->store((longlong) mqh.questions);
|
||||||
if (mqh.bits & 2)
|
if (mqh.bits & 2)
|
||||||
|
@ -2269,7 +2269,7 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
cond_and->used_tables_cache= t1->map | t2->map;
|
cond_and->used_tables_cache= t1->map | t2->map;
|
||||||
thd->lex->current_select->cond_count+=cond_and->list.elements;
|
thd->lex->current_select->cond_count+= cond_and->list.elements;
|
||||||
if (!table->outer_join) // Not left join
|
if (!table->outer_join) // Not left join
|
||||||
{
|
{
|
||||||
if (!(*conds=and_conds(*conds, cond_and)))
|
if (!(*conds=and_conds(*conds, cond_and)))
|
||||||
|
@ -289,7 +289,7 @@ TODO list:
|
|||||||
|
|
||||||
if (thd->temp_tables || global_merge_table_count)
|
if (thd->temp_tables || global_merge_table_count)
|
||||||
|
|
||||||
- Another option would be to set thd->lex.safe_to_cache_query to 0
|
- Another option would be to set thd->lex->safe_to_cache_query to 0
|
||||||
in 'get_lock_data' if any of the tables was a tmp table or a
|
in 'get_lock_data' if any of the tables was a tmp table or a
|
||||||
MRG_ISAM table.
|
MRG_ISAM table.
|
||||||
(This could be done with almost no speed penalty)
|
(This could be done with almost no speed penalty)
|
||||||
|
@ -92,6 +92,7 @@ THD::THD():user_time(0), is_fatal_error(0),
|
|||||||
global_read_lock(0), bootstrap(0), spcont(NULL)
|
global_read_lock(0), bootstrap(0), spcont(NULL)
|
||||||
{
|
{
|
||||||
host= user= priv_user= db= ip= 0;
|
host= user= priv_user= db= ip= 0;
|
||||||
|
lex= &main_lex;
|
||||||
host_or_ip= "connecting host";
|
host_or_ip= "connecting host";
|
||||||
locked=some_tables_deleted=no_errors=password= 0;
|
locked=some_tables_deleted=no_errors=password= 0;
|
||||||
query_start_used= 0;
|
query_start_used= 0;
|
||||||
|
@ -455,7 +455,7 @@ int yylex(void *arg, void *yythd)
|
|||||||
int tokval, result_state;
|
int tokval, result_state;
|
||||||
uint length;
|
uint length;
|
||||||
enum my_lex_states state;
|
enum my_lex_states state;
|
||||||
LEX *lex= (((THD *)yythd)->lex);
|
LEX *lex= ((THD *)yythd)->lex;
|
||||||
YYSTYPE *yylval=(YYSTYPE*) arg;
|
YYSTYPE *yylval=(YYSTYPE*) arg;
|
||||||
CHARSET_INFO *cs= ((THD *) yythd)->charset();
|
CHARSET_INFO *cs= ((THD *) yythd)->charset();
|
||||||
uchar *state_map= cs->state_map;
|
uchar *state_map= cs->state_map;
|
||||||
|
@ -2649,7 +2649,7 @@ mysql_execute_command(THD *thd)
|
|||||||
}
|
}
|
||||||
case SQLCOM_DELETE_MULTI:
|
case SQLCOM_DELETE_MULTI:
|
||||||
{
|
{
|
||||||
TABLE_LIST *aux_tables=(TABLE_LIST *)thd->lex->auxilliary_table_list.first;
|
TABLE_LIST *aux_tables= (TABLE_LIST *)thd->lex->auxilliary_table_list.first;
|
||||||
TABLE_LIST *auxi;
|
TABLE_LIST *auxi;
|
||||||
uint table_count=0;
|
uint table_count=0;
|
||||||
multi_delete *result;
|
multi_delete *result;
|
||||||
@ -3957,7 +3957,7 @@ void
|
|||||||
mysql_init_query(THD *thd, bool lexonly)
|
mysql_init_query(THD *thd, bool lexonly)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("mysql_init_query");
|
DBUG_ENTER("mysql_init_query");
|
||||||
LEX *lex=thd->lex;
|
LEX *lex= thd->lex;
|
||||||
lex->unit.init_query();
|
lex->unit.init_query();
|
||||||
lex->unit.init_select();
|
lex->unit.init_select();
|
||||||
lex->unit.thd= thd;
|
lex->unit.thd= thd;
|
||||||
|
@ -641,7 +641,7 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
|||||||
SELECT_LEX *select_lex)
|
SELECT_LEX *select_lex)
|
||||||
{
|
{
|
||||||
THD *thd= stmt->thd;
|
THD *thd= stmt->thd;
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= &thd->main_lex;
|
||||||
select_result *result= thd->lex->result;
|
select_result *result= thd->lex->result;
|
||||||
DBUG_ENTER("mysql_test_select_fields");
|
DBUG_ENTER("mysql_test_select_fields");
|
||||||
|
|
||||||
@ -703,7 +703,7 @@ static bool mysql_test_select_fields(PREP_STMT *stmt, TABLE_LIST *tables,
|
|||||||
static bool send_prepare_results(PREP_STMT *stmt)
|
static bool send_prepare_results(PREP_STMT *stmt)
|
||||||
{
|
{
|
||||||
THD *thd= stmt->thd;
|
THD *thd= stmt->thd;
|
||||||
LEX *lex= thd->lex;
|
LEX *lex= &thd->main_lex;
|
||||||
enum enum_sql_command sql_command= thd->lex->sql_command;
|
enum enum_sql_command sql_command= thd->lex->sql_command;
|
||||||
DBUG_ENTER("send_prepare_results");
|
DBUG_ENTER("send_prepare_results");
|
||||||
DBUG_PRINT("enter",("command: %d, param_count: %ld",
|
DBUG_PRINT("enter",("command: %d, param_count: %ld",
|
||||||
@ -812,7 +812,7 @@ static bool init_param_items(PREP_STMT *stmt)
|
|||||||
Item_param **to;
|
Item_param **to;
|
||||||
uint32 length= thd->query_length;
|
uint32 length= thd->query_length;
|
||||||
|
|
||||||
stmt->lex= *thd->lex;
|
stmt->lex= thd->main_lex;
|
||||||
|
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
@ -972,8 +972,8 @@ void mysql_stmt_execute(THD *thd, char *packet)
|
|||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
LEX *thd_lex= thd->lex;
|
LEX thd_lex= thd->main_lex;
|
||||||
thd->lex= &stmt->lex;
|
thd->main_lex= stmt->lex;
|
||||||
|
|
||||||
for (sl= stmt->lex.all_selects_list;
|
for (sl= stmt->lex.all_selects_list;
|
||||||
sl;
|
sl;
|
||||||
@ -1012,7 +1012,7 @@ void mysql_stmt_execute(THD *thd, char *packet)
|
|||||||
if (!(specialflag & SPECIAL_NO_PRIOR))
|
if (!(specialflag & SPECIAL_NO_PRIOR))
|
||||||
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
my_pthread_setprio(pthread_self(), WAIT_PRIOR);
|
||||||
|
|
||||||
thd->lex= thd_lex;
|
thd->main_lex= thd_lex;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,7 +679,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
|
|||||||
bit to 0 for the other thread
|
bit to 0 for the other thread
|
||||||
*/
|
*/
|
||||||
if (thd->lex->slave_thd_opt)
|
if (thd->lex->slave_thd_opt)
|
||||||
thread_mask &= thd->lex->slave_thd_opt;
|
thread_mask&= thd->lex->slave_thd_opt;
|
||||||
if (thread_mask) //some threads are stopped, start them
|
if (thread_mask) //some threads are stopped, start them
|
||||||
{
|
{
|
||||||
if (init_master_info(mi,master_info_file,relay_log_info_file, 0))
|
if (init_master_info(mi,master_info_file,relay_log_info_file, 0))
|
||||||
@ -700,7 +700,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
|
|||||||
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_MASTER_POS;
|
mi->rli.until_condition= RELAY_LOG_INFO::UNTIL_MASTER_POS;
|
||||||
mi->rli.until_log_pos= thd->lex->mi.pos;
|
mi->rli.until_log_pos= thd->lex->mi.pos;
|
||||||
/*
|
/*
|
||||||
We don't check thd->lex.mi.log_file_name for NULL here
|
We don't check thd->lex->mi.log_file_name for NULL here
|
||||||
since it is checked in sql_yacc.yy
|
since it is checked in sql_yacc.yy
|
||||||
*/
|
*/
|
||||||
strmake(mi->rli.until_log_name, thd->lex->mi.log_file_name,
|
strmake(mi->rli.until_log_name, thd->lex->mi.log_file_name,
|
||||||
@ -975,7 +975,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
thd->proc_info = "Changing master";
|
thd->proc_info = "Changing master";
|
||||||
LEX_MASTER_INFO* lex_mi = &thd->lex->mi;
|
LEX_MASTER_INFO* lex_mi= &thd->lex->mi;
|
||||||
// TODO: see if needs re-write
|
// TODO: see if needs re-write
|
||||||
if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
|
if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
|
||||||
{
|
{
|
||||||
@ -1204,7 +1204,7 @@ int show_binlog_events(THD* thd)
|
|||||||
|
|
||||||
if (mysql_bin_log.is_open())
|
if (mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
LEX_MASTER_INFO *lex_mi = &thd->lex->mi;
|
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
|
||||||
ha_rows event_count, limit_start, limit_end;
|
ha_rows event_count, limit_start, limit_end;
|
||||||
my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
|
my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
|
||||||
char search_file_name[FN_REFLEN], *name;
|
char search_file_name[FN_REFLEN], *name;
|
||||||
@ -1213,8 +1213,8 @@ int show_binlog_events(THD* thd)
|
|||||||
LOG_INFO linfo;
|
LOG_INFO linfo;
|
||||||
Log_event* ev;
|
Log_event* ev;
|
||||||
|
|
||||||
limit_start = thd->lex->current_select->offset_limit;
|
limit_start= thd->lex->current_select->offset_limit;
|
||||||
limit_end = thd->lex->current_select->select_limit + limit_start;
|
limit_end= thd->lex->current_select->select_limit + limit_start;
|
||||||
|
|
||||||
name= search_file_name;
|
name= search_file_name;
|
||||||
if (log_file_name)
|
if (log_file_name)
|
||||||
|
@ -3551,7 +3551,7 @@ static void
|
|||||||
make_join_readinfo(JOIN *join, uint options)
|
make_join_readinfo(JOIN *join, uint options)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
SELECT_LEX *select_lex = &(join->thd->lex->select_lex);
|
SELECT_LEX *select_lex= &join->thd->lex->select_lex;
|
||||||
DBUG_ENTER("make_join_readinfo");
|
DBUG_ENTER("make_join_readinfo");
|
||||||
|
|
||||||
for (i=join->const_tables ; i < join->tables ; i++)
|
for (i=join->const_tables ; i < join->tables ; i++)
|
||||||
@ -8957,7 +8957,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
|
|||||||
List<Item> field_list;
|
List<Item> field_list;
|
||||||
List<Item> item_list;
|
List<Item> item_list;
|
||||||
THD *thd=join->thd;
|
THD *thd=join->thd;
|
||||||
SELECT_LEX *select_lex = &(join->thd->lex->select_lex);
|
SELECT_LEX *select_lex= &join->thd->lex->select_lex;
|
||||||
select_result *result=join->result;
|
select_result *result=join->result;
|
||||||
Item *item_null= new Item_null();
|
Item *item_null= new Item_null();
|
||||||
CHARSET_INFO *cs= &my_charset_latin1;
|
CHARSET_INFO *cs= &my_charset_latin1;
|
||||||
|
@ -1237,7 +1237,7 @@ static int prepare_for_restore(THD* thd, TABLE_LIST* table,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char* backup_dir = thd->lex->backup_dir;
|
char* backup_dir= thd->lex->backup_dir;
|
||||||
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
|
char src_path[FN_REFLEN], dst_path[FN_REFLEN];
|
||||||
char* table_name = table->real_name;
|
char* table_name = table->real_name;
|
||||||
char* db = thd->db ? thd->db : table->db;
|
char* db = thd->db ? thd->db : table->db;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
#define MYSQL_YACC
|
#define MYSQL_YACC
|
||||||
#define YYINITDEPTH 100
|
#define YYINITDEPTH 100
|
||||||
#define YYMAXDEPTH 3200 /* Because of 64K stack */
|
#define YYMAXDEPTH 3200 /* Because of 64K stack */
|
||||||
#define Lex ((YYTHD->lex))
|
#define Lex (YYTHD->lex)
|
||||||
#define Select Lex->current_select
|
#define Select Lex->current_select
|
||||||
#include "mysql_priv.h"
|
#include "mysql_priv.h"
|
||||||
#include "slave.h"
|
#include "slave.h"
|
||||||
@ -800,7 +800,7 @@ query:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thd->lex->sql_command = SQLCOM_EMPTY_QUERY;
|
thd->lex->sql_command= SQLCOM_EMPTY_QUERY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
| verb_clause END_OF_INPUT {};
|
| verb_clause END_OF_INPUT {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user