summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-08-02 12:01:24 +0300
committerMichael Widenius <monty@askmonty.org>2010-08-02 12:01:24 +0300
commite0a6b02c5d0a311e7167295494786077009743d1 (patch)
tree72c934fe42261ad5de3139961e092f57e9d147df /sql/sql_lex.cc
parentd2f8b7d04503478ab6b6998194a2070891f0c2bb (diff)
parent6ad06b15222300e4eed4fe3972d1ad249c4c42a2 (diff)
downloadmariadb-git-e0a6b02c5d0a311e7167295494786077009743d1.tar.gz
Merge with MySQL 5.1.49
Fixed Bug#52005 'JOIN_TAB->dependent' may be incorrectly propageted for multilevel outer joins' in a better way (patch from Sergey Petrunya)
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc67
1 files changed, 29 insertions, 38 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index e03269ef6b6..1cedb0c41db 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -110,39 +110,31 @@ st_parsing_options::reset()
allows_derived= TRUE;
}
-Lex_input_stream::Lex_input_stream(THD *thd,
- const char* buffer,
- unsigned int length)
-: m_thd(thd),
- yylineno(1),
- yytoklen(0),
- yylval(NULL),
- m_ptr(buffer),
- m_tok_start(NULL),
- m_tok_end(NULL),
- m_end_of_query(buffer + length),
- m_tok_start_prev(NULL),
- m_buf(buffer),
- m_buf_length(length),
- m_echo(TRUE),
- m_cpp_tok_start(NULL),
- m_cpp_tok_start_prev(NULL),
- m_cpp_tok_end(NULL),
- m_body_utf8(NULL),
- m_cpp_utf8_processed_ptr(NULL),
- next_state(MY_LEX_START),
- found_semicolon(NULL),
- ignore_space(test(thd->variables.sql_mode & MODE_IGNORE_SPACE)),
- stmt_prepare_mode(FALSE),
- in_comment(NO_COMMENT),
- m_underscore_cs(NULL)
+
+bool Lex_input_stream::init(THD *thd, const char *buff, unsigned int length)
{
+ DBUG_EXECUTE_IF("bug42064_simulate_oom",
+ DBUG_SET("+d,simulate_out_of_memory"););
+
m_cpp_buf= (char*) thd->alloc(length + 1);
+
+ DBUG_EXECUTE_IF("bug42064_simulate_oom",
+ DBUG_SET("-d,bug42064_simulate_oom"););
+
+ if (m_cpp_buf == NULL)
+ return TRUE;
+
m_cpp_ptr= m_cpp_buf;
+ m_thd= thd;
+ m_ptr= buff;
+ m_end_of_query= buff + length;
+ m_buf= buff;
+ m_buf_length= length;
+ ignore_space= test(thd->variables.sql_mode & MODE_IGNORE_SPACE);
+
+ return FALSE;
}
-Lex_input_stream::~Lex_input_stream()
-{}
/**
The operation is called from the parser in order to
@@ -1651,7 +1643,7 @@ void st_select_lex::init_select()
linkage= UNSPECIFIED_TYPE;
order_list.elements= 0;
order_list.first= 0;
- order_list.next= (uchar**) &order_list.first;
+ order_list.next= &order_list.first;
/* Set limit and offset to default values */
select_limit= 0; /* denotes the default limit = HA_POS_ERROR */
offset_limit= 0; /* denotes the default offset = 0 */
@@ -1982,7 +1974,7 @@ uint st_select_lex::get_in_sum_expr()
TABLE_LIST* st_select_lex::get_table_list()
{
- return (TABLE_LIST*) table_list.first;
+ return table_list.first;
}
List<Item>* st_select_lex::get_item_list()
@@ -2039,9 +2031,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type)
if (fake_select_lex->order_list.elements)
{
str->append(STRING_WITH_LEN(" order by "));
- fake_select_lex->print_order(
- str,
- (ORDER *) fake_select_lex->order_list.first,
+ fake_select_lex->print_order(str,
+ fake_select_lex->order_list.first,
query_type);
}
fake_select_lex->print_limit(thd, str, query_type);
@@ -2686,7 +2677,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local)
{
select_lex.context.table_list=
select_lex.context.first_name_resolution_table= first->next_local;
- select_lex.table_list.first= (uchar*) (first->next_local);
+ select_lex.table_list.first= first->next_local;
select_lex.table_list.elements--; //safety
first->next_local= 0;
/*
@@ -2718,7 +2709,7 @@ TABLE_LIST *st_lex::unlink_first_table(bool *link_to_local)
void st_lex::first_lists_tables_same()
{
- TABLE_LIST *first_table= (TABLE_LIST*) select_lex.table_list.first;
+ TABLE_LIST *first_table= select_lex.table_list.first;
if (query_tables != first_table && first_table != 0)
{
TABLE_LIST *next;
@@ -2765,9 +2756,9 @@ void st_lex::link_first_table_back(TABLE_LIST *first,
if (link_to_local)
{
- first->next_local= (TABLE_LIST*) select_lex.table_list.first;
+ first->next_local= select_lex.table_list.first;
select_lex.context.table_list= first;
- select_lex.table_list.first= (uchar*) first;
+ select_lex.table_list.first= first;
select_lex.table_list.elements++; //safety
}
}
@@ -2933,7 +2924,7 @@ void st_select_lex::fix_prepare_information(THD *thd, Item **conds,
prep_having= *having_conds;
*having_conds= having= prep_having->copy_andor_structure(thd);
}
- fix_prepare_info_in_table_list(thd, (TABLE_LIST *)table_list.first);
+ fix_prepare_info_in_table_list(thd, table_list.first);
}
}