1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
#ifndef DRIZZLE_SERVER_SQL_LEX_H
21
#define DRIZZLE_SERVER_SQL_LEX_H
1
/* Copyright (C) 2000-2006 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
24
17
@defgroup Semantic_Analysis Semantic Analysis
29
20
/* YACC and LEX Definitions */
31
22
/* These may not be declared yet */
33
24
class sql_exchange;
26
class st_alter_tablespace;
38
30
The following hack is needed because mysql_yacc.cc does not define
39
31
YYSTYPE before including this file
78
70
SQLCOM_CHANGE_DB, SQLCOM_CREATE_DB, SQLCOM_DROP_DB, SQLCOM_ALTER_DB,
79
71
SQLCOM_REPAIR, SQLCOM_REPLACE, SQLCOM_REPLACE_SELECT,
80
72
SQLCOM_OPTIMIZE, SQLCOM_CHECK,
81
SQLCOM_ASSIGN_TO_KEYCACHE,
73
SQLCOM_ASSIGN_TO_KEYCACHE, SQLCOM_PRELOAD_KEYS,
82
74
SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
83
75
SQLCOM_ROLLBACK, SQLCOM_ROLLBACK_TO_SAVEPOINT,
84
76
SQLCOM_COMMIT, SQLCOM_SAVEPOINT, SQLCOM_RELEASE_SAVEPOINT,
91
83
SQLCOM_SHOW_BINLOG_EVENTS,
92
84
SQLCOM_SHOW_WARNS, SQLCOM_EMPTY_QUERY, SQLCOM_SHOW_ERRORS,
86
SQLCOM_ALTER_TABLESPACE,
94
87
SQLCOM_BINLOG_BASE64_EVENT,
95
88
SQLCOM_SHOW_PLUGINS,
89
SQLCOM_ALTER_DB_UPGRADE,
97
91
When a command is added here, be sure it's also added in mysqld.cc
98
92
in "struct show_var_st status_vars[]= {" ...
105
99
#define DESCRIBE_NORMAL 1
106
100
#define DESCRIBE_EXTENDED 2
108
#ifdef DRIZZLE_SERVER
104
enum enum_sp_data_access
106
SP_DEFAULT_ACCESS= 0,
113
const LEX_STRING sp_data_access_name[]=
115
{ C_STRING_WITH_LEN("") },
116
{ C_STRING_WITH_LEN("CONTAINS SQL") },
117
{ C_STRING_WITH_LEN("NO SQL") },
118
{ C_STRING_WITH_LEN("READS SQL DATA") },
119
{ C_STRING_WITH_LEN("MODIFIES SQL DATA") }
110
122
#define DERIVED_NONE 0
111
123
#define DERIVED_SUBQUERY 1
127
DROP_DEFAULT, // mode is not specified
128
DROP_CASCADE, // CASCADE option
129
DROP_RESTRICT // RESTRICT option
113
132
typedef List<Item> List_item;
115
134
/* SERVERS CACHE CHANGES */
116
135
typedef struct st_lex_server_options
119
uint32_t server_name_length;
120
char *server_name, *host, *db, *username, *password, *scheme, *owner;
138
uint server_name_length;
139
char *server_name, *host, *db, *username, *password, *scheme, *socket, *owner;
121
140
} LEX_SERVER_OPTIONS;
123
142
typedef struct st_lex_master_info
125
144
char *host, *user, *password, *log_file_name;
126
uint32_t port, connect_retry;
145
uint port, connect_retry;
127
146
float heartbeat_period;
131
150
Enum is used for making it possible to detect if the user
132
151
changed variable or if it should be left at old value
160
179
Keep in sync with index_hint_type.
162
181
extern const char * index_hint_type_name[];
163
typedef unsigned char index_clause_map;
182
typedef uchar index_clause_map;
166
185
Bits in index_clause_map : one for each possible FOR clause in
188
207
LEX_STRING key_name;
190
209
Index_hint (enum index_hint_type type_arg, index_clause_map clause_arg,
191
char *str, uint32_t length) :
210
char *str, uint length) :
192
211
type(type_arg), clause(clause_arg)
194
213
key_name.str= str;
346
365
return sql_alloc(size);
348
367
static void *operator new(size_t size, MEM_ROOT *mem_root)
349
{ return (void*) alloc_root(mem_root, (uint32_t) size); }
350
static void operator delete(void *ptr __attribute__((unused)),
351
size_t size __attribute__((unused)))
352
{ TRASH(ptr, size); }
353
static void operator delete(void *ptr __attribute__((unused)),
354
MEM_ROOT *mem_root __attribute__((unused)))
368
{ return (void*) alloc_root(mem_root, (uint) size); }
369
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
370
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
356
371
st_select_lex_node(): linkage(UNSPECIFIED_TYPE) {}
357
372
virtual ~st_select_lex_node() {}
358
373
inline st_select_lex_node* get_master() { return master; }
371
386
virtual bool set_braces(bool value);
372
387
virtual bool inc_in_sum_expr();
373
virtual uint32_t get_in_sum_expr();
374
virtual TableList* get_table_list();
388
virtual uint get_in_sum_expr();
389
virtual TABLE_LIST* get_table_list();
375
390
virtual List<Item>* get_item_list();
376
virtual uint32_t get_table_join_options();
377
virtual TableList *add_table_to_list(THD *thd, Table_ident *table,
379
uint32_t table_options,
380
thr_lock_type flags= TL_UNLOCK,
381
List<Index_hint> *hints= 0,
391
virtual ulong get_table_join_options();
392
virtual TABLE_LIST *add_table_to_list(THD *thd, Table_ident *table,
395
thr_lock_type flags= TL_UNLOCK,
396
List<Index_hint> *hints= 0,
382
397
LEX_STRING *option= 0);
383
virtual void set_lock_for_tables(thr_lock_type lock_type __attribute__((unused)))
398
virtual void set_lock_for_tables(thr_lock_type lock_type) {}
386
400
friend class st_select_lex_unit;
387
401
friend bool mysql_new_select(struct st_lex *lex, bool move_down);
400
414
class select_union;
401
415
class st_select_lex_unit: public st_select_lex_node {
403
TableList result_table_list;
417
TABLE_LIST result_table_list;
404
418
select_union *union_result;
405
Table *table; /* temporary table using for appending UNION results */
419
TABLE *table; /* temporary table using for appending UNION results */
407
421
select_result *result;
408
uint64_t found_rows_for_union;
422
ulonglong found_rows_for_union;
409
423
bool saved_error;
455
469
st_select_lex* outer_select();
456
470
st_select_lex* first_select()
458
return reinterpret_cast<st_select_lex*>(slave);
472
return my_reinterpret_cast(st_select_lex*)(slave);
460
474
st_select_lex_unit* next_unit()
462
return reinterpret_cast<st_select_lex_unit*>(next);
476
return my_reinterpret_cast(st_select_lex_unit*)(next);
464
478
st_select_lex* return_after_parsing() { return return_to; }
465
479
void exclude_level();
466
480
void exclude_tree();
468
482
/* UNION methods */
469
bool prepare(THD *thd, select_result *result, uint32_t additional_options);
483
bool prepare(THD *thd, select_result *result, ulong additional_options);
472
486
inline void unclean() { cleaned= 0; }
499
513
Name_resolution_context context;
501
515
Item *where, *having; /* WHERE & HAVING clauses */
516
Item *prep_where; /* saved WHERE clause for prepared statement processing */
517
Item *prep_having;/* saved HAVING clause for prepared statement processing */
502
518
/* Saved values of the WHERE and HAVING clauses*/
503
519
Item::cond_result cond_value, having_value;
504
520
/* point on lex in which it was created, used in view subquery detection */
505
521
st_lex *parent_lex;
506
522
enum olap_type olap;
507
/* FROM clause - points to the beginning of the TableList::next_local list. */
523
/* FROM clause - points to the beginning of the TABLE_LIST::next_local list. */
508
524
SQL_LIST table_list;
509
525
SQL_LIST group_list; /* GROUP BY clause. */
510
526
List<Item> item_list; /* list of fields & expressions */
517
533
List<Item_real_func> *ftfunc_list;
518
534
List<Item_real_func> ftfunc_list_alloc;
519
535
JOIN *join; /* after JOIN::prepare it is pointer to corresponding JOIN */
520
List<TableList> top_join_list; /* join list of the top level */
521
List<TableList> *join_list; /* list for the currently parsed join */
522
TableList *embedding; /* table embedding to the above list */
523
List<TableList> sj_nests;
536
List<TABLE_LIST> top_join_list; /* join list of the top level */
537
List<TABLE_LIST> *join_list; /* list for the currently parsed join */
538
TABLE_LIST *embedding; /* table embedding to the above list */
539
List<TABLE_LIST> sj_nests;
525
541
Beginning of the list of leaves in a FROM clause, where the leaves
526
542
inlcude all base tables including view tables. The tables are connected
527
by TableList::next_leaf, so leaf_tables points to the left-most leaf.
543
by TABLE_LIST::next_leaf, so leaf_tables points to the left-most leaf.
529
TableList *leaf_tables;
545
TABLE_LIST *leaf_tables;
530
546
const char *type; /* type of select for EXPLAIN */
532
548
SQL_LIST order_list; /* ORDER clause */
540
556
bigger then can be number of entries that will be added to all item
541
557
list during split_sum_func
543
uint32_t select_n_having_items;
544
uint32_t cond_count; /* number of arguments of and/or/xor in where/having/on */
545
uint32_t between_count; /* number of between predicates in where/having/on */
546
uint32_t max_equal_elems; /* maximal number of elements in multiple equalities */
559
uint select_n_having_items;
560
uint cond_count; /* number of arguments of and/or/xor in where/having/on */
561
uint between_count; /* number of between predicates in where/having/on */
562
uint max_equal_elems; /* maximal number of elements in multiple equalities */
548
564
Number of fields used in select list or where clause of current select
549
565
and all inner subselects.
551
uint32_t select_n_where_fields;
567
uint select_n_where_fields;
552
568
enum_parsing_place parsing_place; /* where we are parsing expression */
553
569
bool with_sum_func; /* sum function indicator */
558
574
bool conds_processed_with_permanent_arena;
560
uint32_t table_join_options;
561
uint32_t in_sum_expr;
562
uint32_t select_number; /* number of select (used for EXPLAIN) */
576
ulong table_join_options;
578
uint select_number; /* number of select (used for EXPLAIN) */
563
579
int nest_level; /* nesting level of select */
564
580
Item_sum *inner_sum_func_list; /* list of sum func in nested selects */
565
uint32_t with_wild; /* item list contain '*' */
581
uint with_wild; /* item list contain '*' */
566
582
bool braces; /* SELECT ... UNION (SELECT ... ) <- this braces */
567
/* true when having fix field called in processing of this SELECT */
583
/* TRUE when having fix field called in processing of this SELECT */
568
584
bool having_fix_field;
569
585
/* List of references to fields referenced from inner selects */
570
586
List<Item_outer_ref> inner_refs_list;
571
587
/* Number of Item_sum-derived objects in this SELECT */
572
uint32_t n_sum_items;
573
589
/* Number of Item_sum-derived objects in children and descendant SELECTs */
574
uint32_t n_child_sum_items;
590
uint n_child_sum_items;
576
592
/* explicit LIMIT clause was used */
577
593
bool explicit_limit;
580
596
query processing end even if we use temporary table
582
598
bool subquery_in_having;
583
/* true <=> this SELECT is correlated w.r.t. some ancestor select */
599
/* TRUE <=> this SELECT is correlated w.r.t. some ancestor select */
584
600
bool is_correlated;
602
This variable is required to ensure proper work of subqueries and
603
stored procedures. Generally, one should use the states of
604
Query_arena to determine if it's a statement prepare or first
605
execution of a stored procedure. However, in case when there was an
606
error during the first execution of a stored procedure, the SP body
607
is not expelled from the SP cache. Therefore, a deeply nested
608
subquery might be left unoptimized. So we need this per-subquery
609
variable to inidicate the optimization/execution state of every
610
subquery. Prepared statements work OK in that regard, as in
611
case of an error during prepare the PS is not created.
613
bool first_execution;
614
bool first_cond_optimization;
615
/* do not wrap view fields with Item_ref */
616
bool no_wrap_view_item;
585
617
/* exclude this select from check of unique_table() */
586
618
bool exclude_from_table_unique_test;
587
619
/* List of fields that aren't under an aggregate function */
594
626
This is a copy of the original JOIN USING list that comes from
595
627
the parser. The parser :
596
1. Sets the natural_join of the second TableList in the join
628
1. Sets the natural_join of the second TABLE_LIST in the join
597
629
and the st_select_lex::prev_join_using.
598
2. Makes a parent TableList and sets its is_natural_join/
630
2. Makes a parent TABLE_LIST and sets its is_natural_join/
599
631
join_using_fields members.
600
3. Uses the wrapper TableList as a table in the upper level.
632
3. Uses the wrapper TABLE_LIST as a table in the upper level.
601
633
We cannot assign directly to join_using_fields in the parser because
602
at stage (1.) the parent TableList is not constructed yet and
634
at stage (1.) the parent TABLE_LIST is not constructed yet and
603
635
the assignment will override the JOIN USING fields of the lower level
604
636
joins on the right.
613
645
1 - aggregate functions are used in this select,
614
646
defined as SUM_FUNC_USED.
616
uint8_t full_group_by_flag;
648
uint8 full_group_by_flag;
617
649
void init_query();
618
650
void init_select();
619
651
st_select_lex_unit* master_unit();
641
673
bool set_braces(bool value);
642
674
bool inc_in_sum_expr();
643
uint32_t get_in_sum_expr();
675
uint get_in_sum_expr();
645
677
bool add_item_to_list(THD *thd, Item *item);
646
678
bool add_group_to_list(THD *thd, Item *item, bool asc);
647
679
bool add_order_to_list(THD *thd, Item *item, bool asc);
648
TableList* add_table_to_list(THD *thd, Table_ident *table,
680
TABLE_LIST* add_table_to_list(THD *thd, Table_ident *table,
649
681
LEX_STRING *alias,
650
uint32_t table_options,
651
683
thr_lock_type flags= TL_UNLOCK,
652
684
List<Index_hint> *hints= 0,
653
685
LEX_STRING *option= 0);
654
TableList* get_table_list();
686
TABLE_LIST* get_table_list();
655
687
bool init_nested_join(THD *thd);
656
TableList *end_nested_join(THD *thd);
657
TableList *nest_last_join(THD *thd);
658
void add_joined_table(TableList *table);
659
TableList *convert_right_join();
688
TABLE_LIST *end_nested_join(THD *thd);
689
TABLE_LIST *nest_last_join(THD *thd);
690
void add_joined_table(TABLE_LIST *table);
691
TABLE_LIST *convert_right_join();
660
692
List<Item>* get_item_list();
661
uint32_t get_table_join_options();
693
ulong get_table_join_options();
662
694
void set_lock_for_tables(thr_lock_type lock_type);
663
695
inline void init_order()
665
697
order_list.elements= 0;
666
698
order_list.first= 0;
667
order_list.next= (unsigned char**) &order_list.first;
699
order_list.next= (uchar**) &order_list.first;
670
702
This method created for reiniting LEX in mysql_admin_table() and can be
685
bool setup_ref_array(THD *thd, uint32_t order_group_num);
717
bool setup_ref_array(THD *thd, uint order_group_num);
686
718
void print(THD *thd, String *str, enum_query_type query_type);
687
719
static void print_order(String *str,
689
721
enum_query_type query_type);
690
722
void print_limit(THD *thd, String *str, enum_query_type query_type);
691
723
void fix_prepare_information(THD *thd, Item **conds, Item **having_conds);
706
738
Add a index hint to the tagged list of hints. The type and clause of the
707
739
hint will be the current ones (set by set_index_hint())
709
bool add_index_hint (THD *thd, char *str, uint32_t length);
741
bool add_index_hint (THD *thd, char *str, uint length);
711
743
/* make a list to hold index hints */
712
744
void alloc_index_hints (THD *thd);
770
802
List<Alter_column> alter_list;
771
803
List<Key> key_list;
772
804
List<Create_field> create_list;
774
806
enum enum_enable_or_disable keys_onoff;
775
807
enum tablespace_op_type tablespace_op;
777
809
enum ha_build_method build_method;
778
810
Create_field *datetime_field;
779
811
bool error_if_not_empty;
832
864
/* Global list of all tables used by this statement */
833
TableList *query_tables;
865
TABLE_LIST *query_tables;
834
866
/* Pointer to next_global member of last element in the previous list. */
835
TableList **query_tables_last;
867
TABLE_LIST **query_tables_last;
837
869
If non-0 then indicates that query requires prelocking and points to
838
870
next_global member of last own element in query table list (i.e. last
839
871
table which was not added to it as part of preparation to prelocking).
840
872
0 - indicates that this query does not need prelocking.
842
TableList **query_tables_own_last;
874
TABLE_LIST **query_tables_own_last;
844
876
Set of stored routines called by statement.
845
877
(Note that we use lazy-initialization for this hash).
856
888
in which it was right after query parsing.
858
890
SQL_LIST sroutines_list;
859
unsigned char **sroutines_list_own_last;
860
uint32_t sroutines_list_own_elements;
891
uchar **sroutines_list_own_last;
892
uint sroutines_list_own_elements;
863
895
These constructor and destructor serve for creation/destruction
879
911
If you are using this function, you must ensure that the table
880
912
object, in particular table->db member, is initialized.
882
void add_to_query_tables(TableList *table)
914
void add_to_query_tables(TABLE_LIST *table)
884
916
*(table->prev_global= query_tables_last)= table;
885
917
query_tables_last= &table->next_global;
887
919
/* Return pointer to first not-own table in query-tables or 0 */
888
TableList* first_not_own_table()
920
TABLE_LIST* first_not_own_table()
890
922
return ( query_tables_own_last ? *query_tables_own_last : 0);
1209
1241
/** Get the length of the current token, in the raw buffer. */
1213
1245
The assumption is that the lexical analyser is always 1 character ahead,
1214
1246
which the -1 account for.
1216
assert(m_ptr > m_tok_start);
1217
return (uint32_t) ((m_ptr - m_tok_start) - 1);
1248
DBUG_ASSERT(m_ptr > m_tok_start);
1249
return (uint) ((m_ptr - m_tok_start) - 1);
1220
1252
/** Get the utf8-body string. */
1234
1266
void body_utf8_append(const char *ptr, const char *end_ptr);
1235
1267
void body_utf8_append_literal(THD *thd,
1236
1268
const LEX_STRING *txt,
1237
const CHARSET_INFO * const txt_cs,
1269
CHARSET_INFO *txt_cs,
1238
1270
const char *end_ptr);
1240
1272
/** Current thread. */
1243
1275
/** Current line number. */
1246
1278
/** Length of the last token parsed. */
1249
1281
/** Interface with bison, value of the last token parsed. */
1250
1282
LEX_YYSTYPE yylval;
1328
1360
const char *found_semicolon;
1330
1362
/** Token character bitmaps, to detect 7bit strings. */
1331
unsigned char tok_bitmap;
1333
1365
/** SQL_MODE = IGNORE_SPACE. */
1334
1366
bool ignore_space;
1369
TRUE if we're parsing a prepared statement: in this mode
1370
we should allow placeholders and disallow multi-statements.
1372
bool stmt_prepare_mode;
1336
1374
/** State of the lexical analyser for comments. */
1337
1375
enum_comment_state in_comment;
1375
1413
char *length,*dec,*change;
1376
1414
LEX_STRING name;
1377
1415
char *help_arg;
1416
LEX_STRING backup_dir; /* For RESTORE/BACKUP */
1378
1417
char* to_log; /* For PURGE MASTER LOGS TO */
1379
1418
char* x509_subject,*x509_issuer,*ssl_cipher;
1383
1422
Item *default_value, *on_update_value;
1384
1423
LEX_STRING comment, ident;
1386
unsigned char* yacc_yyss, *yacc_yyvs;
1425
uchar* yacc_yyss, *yacc_yyvs;
1389
1428
/* maintain a list of used plugins for this LEX */
1390
1429
DYNAMIC_ARRAY plugins;
1391
1430
plugin_ref plugins_static_buffer[INITIAL_LEX_PLUGIN_LIST_SIZE];
1393
const CHARSET_INFO *charset;
1432
CHARSET_INFO *charset;
1394
1433
bool text_string_is_7bit;
1395
1434
/* store original leaf_tables for INSERT SELECT and PS/SP */
1396
TableList *leaf_tables_insert;
1435
TABLE_LIST *leaf_tables_insert;
1398
1437
List<Key_part_spec> col_list;
1399
1438
List<Key_part_spec> ref_list;
1400
1439
List<String> interval_list;
1440
List<LEX_USER> users_list;
1401
1441
List<LEX_COLUMN> columns;
1402
1442
List<Item> *insert_list,field_list,value_list,update_list;
1403
1443
List<List_item> many_values;
1404
1444
List<set_var_base> var_list;
1405
1445
List<Item_param> param_list;
1446
List<LEX_STRING> view_list; // view list (list of field names in view)
1407
1448
A stack of name resolution contexts for the query. This stack is used
1408
1449
at parse time to set local name resolution contexts for various parts
1428
1469
KEY_CREATE_INFO key_create_info;
1429
1470
LEX_MASTER_INFO mi; // used by CHANGE MASTER
1430
1471
LEX_SERVER_OPTIONS server_options;
1433
1475
This variable is used in post-parse stage to declare that sum-functions,
1434
1476
or functions which have sense only if GROUP BY is present, are allowed.
1456
1498
enum ha_rkey_function ha_rkey_mode;
1457
1499
enum xa_option_words xa_opt;
1458
bool lock_transactional; /* For LOCK Table ... IN ... MODE */
1500
bool lock_transactional; /* For LOCK TABLE ... IN ... MODE */
1460
1502
enum enum_var_type option_type;
1503
enum enum_drop_mode drop_mode;
1462
uint32_t profile_query_id;
1463
uint32_t profile_options;
1505
uint profile_query_id;
1506
uint profile_options;
1507
enum ha_storage_media storage_type;
1464
1508
enum column_format_type column_format;
1465
uint32_t which_columns;
1466
1510
enum Foreign_key::fk_match_opt fk_match_option;
1467
1511
enum Foreign_key::fk_option fk_update_opt;
1468
1512
enum Foreign_key::fk_option fk_delete_opt;
1469
uint32_t slave_thd_opt, start_transaction_opt;
1513
uint slave_thd_opt, start_transaction_opt;
1470
1514
int nest_level;
1472
1516
In LEX representing update which were transformed to multi-update
1473
1517
stores total number of tables. For LEX representing multi-delete
1474
1518
holds number of tables from which we will delete records.
1476
uint32_t table_count;
1479
1523
A flag that indicates what kinds of derived tables are present in the
1480
1524
query (0 if no derived tables, otherwise DERIVED_SUBQUERY).
1482
uint8_t derived_tables;
1526
uint8 derived_tables;
1483
1527
bool drop_if_exists, drop_temporary, local_file, one_shot_set;
1484
1528
bool autocommit;
1529
bool verbose, no_write_to_binlog;
1487
1531
bool tx_chain, tx_release;
1533
Special JOIN::prepare mode: changing of query is prohibited.
1534
When creating a view, we need to just check its syntax omitting
1535
any optimizations: afterwards definition of the view will be
1536
reconstructed by means of ::print() methods and written to
1537
to an .frm file. We need this definition to stay untouched.
1539
bool view_prepare_mode;
1488
1540
bool subqueries, ignore;
1489
1541
st_parsing_options parsing_options;
1490
1542
Alter_info alter_info;
1509
1561
(see Item_field::fix_fields()).
1511
1563
bool use_only_table_context;
1566
Reference to a struct that contains information in various commands
1567
to add/create/drop/change table spaces.
1569
st_alter_tablespace *alter_tablespace_info;
1513
1571
bool escape_used;
1514
1572
bool is_lex_started; /* If lex_start() did run. For debugging. */
1522
1580
delete_dynamic(&plugins);
1525
TableList *unlink_first_table(bool *link_to_local);
1526
void link_first_table_back(TableList *first, bool link_to_local);
1583
TABLE_LIST *unlink_first_table(bool *link_to_local);
1584
void link_first_table_back(TABLE_LIST *first, bool link_to_local);
1527
1585
void first_lists_tables_same();
1529
1587
bool can_be_merged();
1531
1589
bool can_not_use_merged();
1532
1590
bool only_view_structure();
1533
1591
bool need_correct_ident();
1592
uint8 get_effective_with_check(TABLE_LIST *view);
1594
Is this update command where 'WHITH CHECK OPTION' clause is important
1597
st_lex::which_check_option_applicable()
1600
TRUE have to take 'WHITH CHECK OPTION' clause into account
1601
FALSE 'WHITH CHECK OPTION' clause do not need
1603
inline bool which_check_option_applicable()
1605
switch (sql_command) {
1607
case SQLCOM_UPDATE_MULTI:
1609
case SQLCOM_INSERT_SELECT:
1610
case SQLCOM_REPLACE:
1611
case SQLCOM_REPLACE_SELECT:
1535
1619
void cleanup_after_one_table_open();
1564
1648
@brief check if the statement is a single-level join
1565
1649
@return result of the check
1566
@retval true The statement doesn't contain subqueries, unions and
1650
@retval TRUE The statement doesn't contain subqueries, unions and
1567
1651
stored procedure calls.
1568
@retval false There are subqueries, UNIONs or stored procedure calls.
1652
@retval FALSE There are subqueries, UNIONs or stored procedure calls.
1570
1654
bool is_single_level_stmt()
1592
1676
static void *operator new(size_t size, MEM_ROOT *mem_root) throw()
1594
return (void*) alloc_root(mem_root, (uint32_t) size);
1678
return (void*) alloc_root(mem_root, (uint) size);
1596
static void operator delete(void *ptr __attribute__((unused)),
1597
size_t size __attribute__((unused)))
1680
static void operator delete(void *ptr,size_t size)
1598
1681
{ TRASH(ptr, size); }
1599
static void operator delete(void *ptr __attribute__((unused)),
1600
MEM_ROOT *mem_root __attribute__((unused)))
1682
static void operator delete(void *ptr, MEM_ROOT *mem_root)
1601
1683
{ /* Never called */ }
1605
1687
extern void lex_free(void);
1606
1688
extern void lex_start(THD *thd);
1607
1689
extern void lex_end(LEX *lex);
1690
extern int MYSQLlex(void *arg, void *yythd);
1609
extern void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str);
1692
extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str);
1611
1694
extern bool is_lex_native_function(const LEX_STRING *name);