35
64
const LEX_STRING null_lex_str= {NULL, 0};
39
The following data is based on the latin1 character set, and is only
40
used when comparing keywords
43
static unsigned char to_upper_lex[]=
45
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
46
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
47
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
49
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
50
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
51
96, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
52
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,123,124,125,126,127,
53
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
54
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
55
160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
56
176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
57
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
58
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
59
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
60
208,209,210,211,212,213,214,247,216,217,218,219,220,221,222,255
64
Names of the index hints (for error messages). Keep in sync with
68
const char * index_hint_type_name[] =
75
inline int lex_casecmp(const char *s, const char *t, uint32_t len)
78
to_upper_lex[(unsigned char) *s++] == to_upper_lex[(unsigned char) *t++]) ;
88
for (i=0 ; i < array_elements(symbols) ; i++)
89
symbols[i].length=(unsigned char) strlen(symbols[i].name);
90
for (i=0 ; i < array_elements(sql_functions) ; i++)
91
sql_functions[i].length=(unsigned char) strlen(sql_functions[i].name);
98
{ // Call this when daemon ends
104
st_parsing_options::reset()
106
allows_variable= true;
107
allows_select_into= true;
108
allows_select_procedure= true;
109
allows_derived= true;
112
66
Lex_input_stream::Lex_input_stream(Session *session,
113
67
const char* buffer,
114
68
unsigned int length)
302
232
lex->select_lex.master= &lex->unit;
303
233
lex->select_lex.prev= &lex->unit.slave;
304
234
lex->select_lex.link_next= lex->select_lex.slave= lex->select_lex.next= 0;
305
lex->select_lex.link_prev= (st_select_lex_node**)&(lex->all_selects_list);
235
lex->select_lex.link_prev= (Select_Lex_Node**)&(lex->all_selects_list);
306
236
lex->select_lex.options= 0;
307
237
lex->select_lex.init_order();
308
238
lex->select_lex.group_list.empty();
309
239
lex->describe= 0;
310
lex->subqueries= false;
311
240
lex->derived_tables= 0;
312
241
lex->lock_option= TL_READ;
313
242
lex->leaf_tables_insert= 0;
314
lex->parsing_options.reset();
315
lex->empty_field_list_on_rset= 0;
316
243
lex->select_lex.select_number= 1;
318
245
lex->select_lex.in_sum_expr=0;
319
lex->select_lex.ftfunc_list_alloc.empty();
320
lex->select_lex.ftfunc_list= &lex->select_lex.ftfunc_list_alloc;
321
246
lex->select_lex.group_list.empty();
322
247
lex->select_lex.order_list.empty();
323
248
lex->sql_command= SQLCOM_END;
324
249
lex->duplicates= DUP_ERROR;
326
lex->proc_list.first= 0;
327
251
lex->escape_used= false;
328
252
lex->query_tables= 0;
329
253
lex->reset_query_tables_list(false);
330
254
lex->expr_allows_subselect= true;
331
255
lex->use_only_table_context= false;
332
lex->parse_vcol_expr= false;
334
257
lex->name.str= 0;
335
258
lex->name.length= 0;
336
259
lex->nest_level=0 ;
337
260
lex->allow_sum_func= 0;
338
261
lex->in_sum_func= NULL;
340
ok, there must be a better solution for this, long-term
341
I tried "memset" in the sql_yacc.yy code, but that for
342
some reason made the values zero, even if they were set
344
lex->server_options.server_name= 0;
345
lex->server_options.server_name_length= 0;
346
lex->server_options.host= 0;
347
lex->server_options.db= 0;
348
lex->server_options.username= 0;
349
lex->server_options.password= 0;
350
lex->server_options.scheme= 0;
351
lex->server_options.owner= 0;
352
lex->server_options.port= -1;
354
263
lex->is_lex_started= true;
264
lex->statement= NULL;
358
267
void lex_end(LEX *lex)
523
412
str= lip->get_tok_start();
524
413
end= lip->get_ptr();
525
414
/* Extract the text from the token */
528
417
assert(end >= str);
530
if (!(start= (char*) lip->m_session->alloc((uint) (end-str)+1)))
531
return (char*) ""; // Sql_alloc has set error flag
419
if (!(start= (char*) lip->m_session->alloc((uint32_t) (end-str)+1)))
420
return (char*) ""; // Sql_alloc has set error flag
533
422
lip->m_cpp_text_start= lip->get_cpp_tok_start() + pre_skip;
534
423
lip->m_cpp_text_end= lip->get_cpp_ptr() - post_skip;
538
lip->yytoklen=(uint) (end-str);
539
memcpy(start,str,lip->yytoklen);
540
start[lip->yytoklen]=0;
427
lip->yytoklen= (uint32_t) (end-str);
428
memcpy(start, str, lip->yytoklen);
429
start[lip->yytoklen]= 0;
546
for (to=start ; str != end ; str++)
551
(l = my_ismbchar(cs, str, end))) {
558
if (*str == '\\' && str+1 != end)
574
*to++= 0; // Ascii null
576
case 'Z': // ^Z must be escaped on Win32
581
*to++= '\\'; // remember prefix for wildcard
435
for (to= start; str != end; str++)
439
int l= my_ismbchar(cs, str, end);
448
if (*str == '\\' && (str + 1) != end)
464
*to++= 0; // Ascii null
466
case 'Z': // ^Z must be escaped on Win32
471
*to++= '\\'; // remember prefix for wildcard
588
else if (*str == sep)
589
*to++= *str++; // Two ' or "
594
lip->yytoklen=(uint) (to-start);
478
else if (*str == sep)
479
*to++= *str++; // Two ' or "
484
lip->yytoklen= (uint32_t) (to - start);
888
771
for (; state_map[c] == MY_LEX_SKIP ; c= lip->yyGet()) {};
890
773
if (start == lip->get_ptr() && c == '.' && ident_map[(uint8_t)lip->yyPeek()])
891
lip->next_state=MY_LEX_IDENT_SEP;
774
lip->next_state=MY_LEX_IDENT_SEP;
893
776
{ // '(' must follow directly if function
895
if ((tokval = find_keyword(lip, length, c == '(')))
897
lip->next_state= MY_LEX_START; // Allow signed numbers
898
return(tokval); // Was keyword
778
if ((tokval = find_keyword(lip, length, c == '(')))
780
lip->next_state= MY_LEX_START; // Allow signed numbers
781
return(tokval); // Was keyword
900
783
lip->yySkip(); // next state does a unget
902
785
yylval->lex_str=get_token(lip, 0, length);
905
Note: "SELECT _bla AS 'alias'"
906
_bla should be considered as a IDENT if charset haven't been found.
907
So we don't use MYF(MY_WME) with get_charset_by_csname to avoid
911
if (yylval->lex_str.str[0] == '_')
913
const CHARSET_INFO * const cs= get_charset_by_csname(yylval->lex_str.str + 1,
914
MY_CS_PRIMARY, MYF(0));
918
lip->m_underscore_cs= cs;
920
lip->body_utf8_append(lip->m_cpp_text_start,
921
lip->get_cpp_tok_start() + length);
922
return(UNDERSCORE_CHARSET);
926
787
lip->body_utf8_append(lip->m_cpp_text_start);
928
lip->body_utf8_append_literal(session, &yylval->lex_str, cs,
929
lip->m_cpp_text_end);
789
lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
931
791
return(result_state); // IDENT or IDENT_QUOTED
975
835
while (my_isdigit(cs, (c = lip->yyGet()))) ;
976
836
if (!ident_map[c])
977
837
{ // Can't be identifier
978
state=MY_LEX_INT_OR_REAL;
838
state=MY_LEX_INT_OR_REAL;
981
841
if (c == 'e' || c == 'E')
983
// The following test is written this way to allow numbers of type 1e1
843
// The following test is written this way to allow numbers of type 1e1
984
844
if (my_isdigit(cs,lip->yyPeek()) ||
985
845
(c=(lip->yyGet())) == '+' || c == '-')
987
847
if (my_isdigit(cs,lip->yyPeek())) // Number must have digit after sign
990
850
while (my_isdigit(cs,lip->yyGet())) ;
991
851
yylval->lex_str=get_token(lip, 0, lip->yyLength());
998
858
case MY_LEX_IDENT_START: // We come here after '.'
999
859
result_state= IDENT;
1000
#if defined(USE_MB) && defined(USE_MB_IDENT)
1003
result_state= IDENT_QUOTED;
862
result_state= IDENT_QUOTED;
1004
863
while (ident_map[c=lip->yyGet()])
1006
865
if (my_mbcharlen(cs, c) > 1)
1009
if ((l = my_ismbchar(cs,
1011
lip->get_end_of_query())) == 0)
867
int l= my_ismbchar(cs, lip->get_ptr() -1, lip->get_end_of_query());
1013
870
lip->skip_binary(l-1);
1020
876
for (result_state=0; ident_map[c= lip->yyGet()]; result_state|= c) {};
1021
877
/* If there were non-ASCII characters, mark that we must convert */
1022
878
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
1024
880
if (c == '.' && ident_map[(uint8_t)lip->yyPeek()])
1025
lip->next_state=MY_LEX_IDENT_SEP;// Next is '.'
881
lip->next_state=MY_LEX_IDENT_SEP;// Next is '.'
1027
883
yylval->lex_str= get_token(lip, 0, lip->yyLength());
1029
885
lip->body_utf8_append(lip->m_cpp_text_start);
1031
lip->body_utf8_append_literal(session, &yylval->lex_str, cs,
1032
lip->m_cpp_text_end);
887
lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
1034
889
return(result_state);
1039
894
char quote_char= c; // Used char
1040
895
while ((c=lip->yyGet()))
1043
if ((var_length= my_mbcharlen(cs, c)) == 1)
1045
if (c == quote_char)
1047
if (lip->yyPeek() != quote_char)
1055
else if (var_length < 1)
898
if ((var_length= my_mbcharlen(cs, c)) == 1)
902
if (lip->yyPeek() != quote_char)
909
else if (var_length < 1)
1057
911
lip->skip_binary(var_length-1);
1060
913
if (double_quotes)
1061
yylval->lex_str=get_quoted_token(lip, 1,
1062
lip->yyLength() - double_quotes -1,
914
yylval->lex_str=get_quoted_token(lip, 1, lip->yyLength() - double_quotes -1, quote_char);
1065
916
yylval->lex_str=get_token(lip, 1, lip->yyLength() -1);
1066
917
if (c == quote_char)
1067
918
lip->yySkip(); // Skip end `
1068
919
lip->next_state= MY_LEX_START;
1070
920
lip->body_utf8_append(lip->m_cpp_text_start);
1072
lip->body_utf8_append_literal(session, &yylval->lex_str, cs,
1073
lip->m_cpp_text_end);
921
lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
1075
922
return(IDENT_QUOTED);
1077
924
case MY_LEX_INT_OR_REAL: // Complete int or incomplete real
1079
926
{ // Found complete integer number.
1080
927
yylval->lex_str=get_token(lip, 0, lip->yyLength());
1081
return int_token(yylval->lex_str.str,yylval->lex_str.length);
928
return int_token(yylval->lex_str.str,yylval->lex_str.length);
1084
931
case MY_LEX_REAL: // Incomplete real number
1221
1064
The special comment format is very strict:
1222
'/' '*' '!', followed by exactly
1223
1 digit (major), 2 digits (minor), then 2 digits (dot).
1065
'/' '*' '!', followed by digits ended by a non-digit.
1066
There must be at least 5 digits for it to count
1228
char version_str[6];
1229
version_str[0]= lip->yyPeekn(0);
1230
version_str[1]= lip->yyPeekn(1);
1231
version_str[2]= lip->yyPeekn(2);
1232
version_str[3]= lip->yyPeekn(3);
1233
version_str[4]= lip->yyPeekn(4);
1235
if ( my_isdigit(cs, version_str[0])
1236
&& my_isdigit(cs, version_str[1])
1237
&& my_isdigit(cs, version_str[2])
1238
&& my_isdigit(cs, version_str[3])
1239
&& my_isdigit(cs, version_str[4])
1243
version=strtol(version_str, NULL, 10);
1068
const int MAX_VERSION_SIZE= 16;
1069
char version_str[MAX_VERSION_SIZE];
1074
version_str[pos]= lip->yyPeekn(pos);
1076
} while ((pos < MAX_VERSION_SIZE-1) && isdigit(version_str[pos-1]));
1077
version_str[pos]= 0;
1079
/* To keep some semblance of compatibility, we impose a 5 digit floor */
1083
version=strtoll(version_str, NULL, 10);
1245
1085
/* Accept 'M' 'm' 'm' 'd' 'd' */
1086
lip->yySkipn(pos-1);
1248
1088
if (version <= DRIZZLE_VERSION_ID)
1410
1242
result_state= result_state & 0x80 ? IDENT_QUOTED : IDENT;
1413
lip->next_state=MY_LEX_IDENT_SEP;
1245
lip->next_state=MY_LEX_IDENT_SEP;
1414
1246
length= lip->yyLength();
1415
1247
if (length == 0)
1416
1248
return(ABORT_SYM); // Names must be nonempty.
1417
1249
if ((tokval= find_keyword(lip, length,0)))
1419
1251
lip->yyUnget(); // Put back 'c'
1420
return(tokval); // Was keyword
1252
return(tokval); // Was keyword
1422
1254
yylval->lex_str=get_token(lip, 0, length);
1424
1256
lip->body_utf8_append(lip->m_cpp_text_start);
1426
lip->body_utf8_append_literal(session, &yylval->lex_str, cs,
1427
lip->m_cpp_text_end);
1258
lip->body_utf8_append_literal(&yylval->lex_str, lip->m_cpp_text_end);
1429
1260
return(result_state);
1436
Construct a copy of this object to be used for mysql_alter_table
1437
and mysql_create_table.
1439
Historically, these two functions modify their Alter_info
1440
arguments. This behaviour breaks re-execution of prepared
1441
statements and stored procedures and is compensated by always
1442
supplying a copy of Alter_info to these functions.
1444
@return You need to use check the error in Session for out
1445
of memory condition after calling this function.
1448
Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
1449
:drop_list(rhs.drop_list, mem_root),
1450
alter_list(rhs.alter_list, mem_root),
1451
key_list(rhs.key_list, mem_root),
1452
create_list(rhs.create_list, mem_root),
1454
keys_onoff(rhs.keys_onoff),
1455
tablespace_op(rhs.tablespace_op),
1456
no_parts(rhs.no_parts),
1457
build_method(rhs.build_method),
1458
datetime_field(rhs.datetime_field),
1459
error_if_not_empty(rhs.error_if_not_empty)
1462
Make deep copies of used objects.
1463
This is not a fully deep copy - clone() implementations
1464
of Alter_drop, Alter_column, Key, foreign_key, Key_part_spec
1465
do not copy string constants. At the same length the only
1466
reason we make a copy currently is that ALTER/CREATE TABLE
1467
code changes input Alter_info definitions, but string
1468
constants never change.
1470
list_copy_and_replace_each_value(drop_list, mem_root);
1471
list_copy_and_replace_each_value(alter_list, mem_root);
1472
list_copy_and_replace_each_value(key_list, mem_root);
1473
list_copy_and_replace_each_value(create_list, mem_root);
1477
1265
void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str)
1813
bool st_select_lex_node::set_braces(bool value __attribute__((unused)))
1815
bool st_select_lex_node::inc_in_sum_expr() { return 1; }
1816
uint32_t st_select_lex_node::get_in_sum_expr() { return 0; }
1817
TableList* st_select_lex_node::get_table_list() { return 0; }
1818
List<Item>* st_select_lex_node::get_item_list() { return 0; }
1819
TableList *st_select_lex_node::add_table_to_list (Session *session __attribute__((unused)),
1820
Table_ident *table __attribute__((unused)),
1821
LEX_STRING *alias __attribute__((unused)),
1822
uint32_t table_join_options __attribute__((unused)),
1823
thr_lock_type flags __attribute__((unused)),
1824
List<Index_hint> *hints __attribute__((unused)),
1825
LEX_STRING *option __attribute__((unused)))
1584
bool Select_Lex_Node::set_braces(bool)
1587
bool Select_Lex_Node::inc_in_sum_expr()
1590
uint32_t Select_Lex_Node::get_in_sum_expr()
1593
TableList* Select_Lex_Node::get_table_list()
1596
List<Item>* Select_Lex_Node::get_item_list()
1599
TableList *Select_Lex_Node::add_table_to_list (Session *, Table_ident *, LEX_STRING *, uint32_t,
1600
thr_lock_type, List<Index_hint> *, LEX_STRING *)
1829
uint32_t st_select_lex_node::get_table_join_options()
1605
uint32_t Select_Lex_Node::get_table_join_options()
1835
1611
prohibit using LIMIT clause
1837
bool st_select_lex::test_limit()
1613
bool Select_Lex::test_limit()
1839
1615
if (select_limit != 0)
1841
1617
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
1842
1618
"LIMIT & IN/ALL/ANY/SOME subquery");
1849
st_select_lex_unit* st_select_lex_unit::master_unit()
1855
st_select_lex* st_select_lex_unit::outer_select()
1857
return (st_select_lex*) master;
1861
bool st_select_lex::add_order_to_list(Session *session, Item *item, bool asc)
1624
Select_Lex_Unit* Select_Lex_Unit::master_unit()
1629
Select_Lex* Select_Lex_Unit::outer_select()
1631
return (Select_Lex*) master;
1634
bool Select_Lex::add_order_to_list(Session *session, Item *item, bool asc)
1863
1636
return add_to_list(session, order_list, item, asc);
1867
bool st_select_lex::add_item_to_list(Session *session __attribute__((unused)),
1639
bool Select_Lex::add_item_to_list(Session *, Item *item)
1870
1641
return(item_list.push_back(item));
1874
bool st_select_lex::add_group_to_list(Session *session, Item *item, bool asc)
1644
bool Select_Lex::add_group_to_list(Session *session, Item *item, bool asc)
1876
1646
return add_to_list(session, group_list, item, asc);
1880
st_select_lex_unit* st_select_lex::master_unit()
1882
return (st_select_lex_unit*) master;
1886
st_select_lex* st_select_lex::outer_select()
1888
return (st_select_lex*) master->get_master();
1892
bool st_select_lex::set_braces(bool value)
1649
Select_Lex_Unit* Select_Lex::master_unit()
1651
return (Select_Lex_Unit*) master;
1654
Select_Lex* Select_Lex::outer_select()
1656
return (Select_Lex*) master->get_master();
1659
bool Select_Lex::set_braces(bool value)
1899
bool st_select_lex::inc_in_sum_expr()
1665
bool Select_Lex::inc_in_sum_expr()
1906
uint32_t st_select_lex::get_in_sum_expr()
1671
uint32_t Select_Lex::get_in_sum_expr()
1908
1673
return in_sum_expr;
1912
TableList* st_select_lex::get_table_list()
1676
TableList* Select_Lex::get_table_list()
1914
1678
return (TableList*) table_list.first;
1917
List<Item>* st_select_lex::get_item_list()
1681
List<Item>* Select_Lex::get_item_list()
1919
1683
return &item_list;
1922
uint32_t st_select_lex::get_table_join_options()
1686
uint32_t Select_Lex::get_table_join_options()
1924
1688
return table_join_options;
1928
bool st_select_lex::setup_ref_array(Session *session, uint32_t order_group_num)
1691
bool Select_Lex::setup_ref_array(Session *session, uint32_t order_group_num)
1930
1693
if (ref_pointer_array)
1933
1696
return (ref_pointer_array=
1934
1697
(Item **)session->alloc(sizeof(Item*) * (n_child_sum_items +
2130
1856
statement parsing. On should use lex_start() function to prepare LEX
2135
1860
:result(0), yacc_yyss(0), yacc_yyvs(0),
2136
1861
sql_command(SQLCOM_END), option_type(OPT_DEFAULT), is_lex_started(0)
2139
my_init_dynamic_array2(&plugins, sizeof(plugin_ref),
2140
plugins_static_buffer,
2141
INITIAL_LEX_PLUGIN_LIST_SIZE,
2142
INITIAL_LEX_PLUGIN_LIST_SIZE);
2143
1863
reset_query_tables_list(true);
2148
Check whether the merging algorithm can be used on this VIEW
2151
st_lex::can_be_merged()
2154
We can apply merge algorithm if it is single SELECT view with
2155
subqueries only in WHERE clause (we do not count SELECTs of underlying
2156
views, and second level subqueries) and we have not grpouping, ordering,
2157
HAVING clause, aggregate functions, DISTINCT clause, LIMIT clause and
2158
several underlying tables.
2161
false - only temporary table algorithm can be used
2162
true - merge algorithm can be used
2165
bool st_lex::can_be_merged()
2167
// TODO: do not forget implement case when select_lex.table_list.elements==0
2169
/* find non VIEW subqueries/unions */
2170
bool selects_allow_merge= select_lex.next_select() == 0;
2171
if (selects_allow_merge)
2173
for (SELECT_LEX_UNIT *tmp_unit= select_lex.first_inner_unit();
2175
tmp_unit= tmp_unit->next_unit())
2177
if (tmp_unit->first_select()->parent_lex == this &&
2178
(tmp_unit->item == 0 ||
2179
(tmp_unit->item->place() != IN_WHERE &&
2180
tmp_unit->item->place() != IN_ON)))
2182
selects_allow_merge= 0;
2188
return (selects_allow_merge &&
2189
select_lex.group_list.elements == 0 &&
2190
select_lex.having == 0 &&
2191
select_lex.with_sum_func == 0 &&
2192
select_lex.table_list.elements >= 1 &&
2193
!(select_lex.options & SELECT_DISTINCT) &&
2194
select_lex.select_limit == 0);
2199
check if command can use VIEW with MERGE algorithm (for top VIEWs)
2202
st_lex::can_use_merged()
2205
Only listed here commands can use merge algorithm in top level
2206
SELECT_LEX (for subqueries will be used merge algorithm if
2207
st_lex::can_not_use_merged() is not true).
2210
false - command can't use merged VIEWs
2211
true - VIEWs with MERGE algorithms can be used
2214
bool st_lex::can_use_merged()
2216
switch (sql_command)
2219
case SQLCOM_CREATE_TABLE:
2221
case SQLCOM_UPDATE_MULTI:
2223
case SQLCOM_DELETE_MULTI:
2225
case SQLCOM_INSERT_SELECT:
2226
case SQLCOM_REPLACE:
2227
case SQLCOM_REPLACE_SELECT:
2236
Check if command can't use merged views in any part of command
2239
st_lex::can_not_use_merged()
2242
Temporary table algorithm will be used on all SELECT levels for queries
2243
listed here (see also st_lex::can_use_merged()).
2246
false - command can't use merged VIEWs
2247
true - VIEWs with MERGE algorithms can be used
2250
bool st_lex::can_not_use_merged()
2252
switch (sql_command)
2255
SQLCOM_SHOW_FIELDS is necessary to make
2256
information schema tables working correctly with views.
2257
see get_schema_tables_result function
2259
case SQLCOM_SHOW_FIELDS:
2536
Save current state of Query_tables_list for this LEX, and prepare it
2537
for processing of new statemnt.
2540
reset_n_backup_query_tables_list()
2541
backup Pointer to Query_tables_list instance to be used for backup
2544
void st_lex::reset_n_backup_query_tables_list(Query_tables_list *backup __attribute__((unused)))
2550
Restore state of Query_tables_list for this LEX from backup.
2553
restore_backup_query_tables_list()
2554
backup Pointer to Query_tables_list instance used for backup
2557
void st_lex::restore_backup_query_tables_list(Query_tables_list *backup __attribute__((unused)))
2563
Checks for usage of routines and/or tables in a parsed statement
2566
st_lex:table_or_sp_used()
2569
false No routines and tables used
2570
true Either or both routines and tables are used.
2573
bool st_lex::table_or_sp_used()
2575
if (sroutines.records || query_tables)
2583
Do end-of-prepare fixup for list of tables and their merge-VIEWed tables
2586
fix_prepare_info_in_table_list()
2587
session Thread handle
2588
tbl List of tables to process
2591
Perform end-end-of prepare fixup for list of tables, if any of the tables
2592
is a merge-algorithm VIEW, recursively fix up its underlying tables as
2597
static void fix_prepare_info_in_table_list(Session *session, TableList *tbl)
2599
for (; tbl; tbl= tbl->next_local)
2603
tbl->prep_on_expr= tbl->on_expr;
2604
tbl->on_expr= tbl->on_expr->copy_andor_structure(session);
2606
fix_prepare_info_in_table_list(session, tbl->merge_underlying_list);
2612
There are st_select_lex::add_table_to_list &
2613
st_select_lex::set_lock_for_tables are in sql_parse.cc
2615
st_select_lex::print is in sql_select.cc
2617
st_select_lex_unit::prepare, st_select_lex_unit::exec,
2618
st_select_lex_unit::cleanup, st_select_lex_unit::reinit_exec_mechanism,
2619
st_select_lex_unit::change_result
2119
There are Select_Lex::add_table_to_list &
2120
Select_Lex::set_lock_for_tables are in sql_parse.cc
2122
Select_Lex::print is in sql_select.cc
2124
Select_Lex_Unit::prepare, Select_Lex_Unit::exec,
2125
Select_Lex_Unit::cleanup, Select_Lex_Unit::reinit_exec_mechanism,
2126
Select_Lex_Unit::change_result
2620
2127
are in sql_union.cc