MySQL 8.0.31
Source Code Documentation
pars0pars.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1996, 2022, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/** @file include/pars0pars.h
28 SQL parser
29
30 Created 11/19/1996 Heikki Tuuri
31 *******************************************************/
32
33#ifndef pars0pars_h
34#define pars0pars_h
35
36#include "pars0types.h"
37#include "que0types.h"
38#include "row0mysql.h"
39#include "row0types.h"
40#include "trx0types.h"
41#include "univ.i"
42#include "usr0types.h"
43#include "ut0vec.h"
44
45/** Type of the user functions. The first argument is always InnoDB-supplied
46and varies in type, while 'user_arg' is a user-supplied argument. The
47meaning of the return type also varies. See the individual use cases, e.g.
48the FETCH statement, for details on them. */
49typedef bool (*pars_user_func_cb_t)(void *arg, void *user_arg);
50
51/** If the following is set true, the parser will emit debugging
52information */
53extern int yydebug;
54
55/* Global variable used while parsing a single procedure or query : the code is
56NOT re-entrant */
58
59/** Mutex to protect the sql parser */
60extern ib_mutex_t pars_mutex;
61
84
86
87/* Procedure parameter types */
88#define PARS_INPUT 0
89#define PARS_OUTPUT 1
90#define PARS_NOT_PARAM 2
91
92int yyparse(void);
93
94/** Initialize for the internal parser */
95void pars_init();
96
97/** Clean up the internal parser */
98void pars_close();
99
100/** Parses an SQL string returning the query graph.
101 @return own: the query graph */
102que_t *pars_sql(pars_info_t *info, /*!< in: extra information, or NULL */
103 const char *str); /*!< in: SQL string */
104
105/** Retrieves characters to the lexical analyzer.
106@param[in,out] buf Buffer where to copy
107@param[in] max_size Maximum number of characters which fit in the buffer
108@return number of characters copied or 0 on EOF
109*/
110int pars_get_lex_chars(char *buf, size_t max_size);
111
112/** Called by yyparse on error. */
113void yyerror(const char *s); /*!< in: error message string */
114/** Parses a variable declaration.
115 @return own: symbol table node of type SYM_VAR */
117 sym_node_t *node, /*!< in: symbol table node allocated for the
118 id of the variable */
119 pars_res_word_t *type); /*!< in: pointer to a type token */
120/** Parses a function expression.
121 @return own: function node in a query tree */
123 que_node_t *res_word, /*!< in: function name reserved word */
124 que_node_t *arg); /*!< in: first argument in the argument list */
125/*************************************************************************
126Rebind a LIKE search string. NOTE: We ignore any '%' characters embedded
127within the search string.
128@return own: function node in a query tree */
129int pars_like_rebind(sym_node_t *node, /* in: The search string node.*/
130 const byte *ptr, /* in: literal to (re) bind */
131 ulint len); /* in: length of literal to (re) bind*/
132/** Parses an operator expression.
133 @return own: function node in a query tree */
134func_node_t *pars_op(int func, /*!< in: operator token code */
135 que_node_t *arg1, /*!< in: first argument */
136 que_node_t *arg2); /*!< in: second argument or NULL for an
137 unary operator */
138/** Parses an ORDER BY clause. Order by a single column only is supported.
139 @return own: order-by node in a query tree */
141 sym_node_t *column, /*!< in: column name */
142 pars_res_word_t *asc); /*!< in: &pars_asc_token or pars_desc_token */
143/** Parses a select list; creates a query graph node for the whole SELECT
144 statement.
145 @return own: select node in a query tree */
147 que_node_t *select_list, /*!< in: select list */
148 sym_node_t *into_list); /*!< in: variables list or NULL */
149/** Parses a cursor declaration.
150 @return sym_node */
152 sym_node_t *sym_node, /*!< in: cursor id node in the symbol
153 table */
154 sel_node_t *select_node); /*!< in: select node */
155/** Parses a function declaration.
156 @return sym_node */
158 sym_node_t *sym_node); /*!< in: function id node in the symbol
159 table */
160/** Parses a select statement.
161 @return own: select node in a query tree */
163 sel_node_t *select_node, /*!< in: select node already containing
164 the select list */
165 sym_node_t *table_list, /*!< in: table list */
166 que_node_t *search_cond, /*!< in: search condition or NULL */
167 pars_res_word_t *for_update, /*!< in: NULL or &pars_update_token */
168 pars_res_word_t *consistent_read, /*!< in: NULL or
169 &pars_consistent_token */
170 order_node_t *order_by); /*!< in: NULL or an order-by node */
171/** Parses a column assignment in an update.
172 @return column assignment node */
174 sym_node_t *column, /*!< in: column to assign */
175 que_node_t *exp); /*!< in: value to assign */
176/** Parses a delete or update statement start.
177 @return own: update node in a query tree */
179 bool is_delete, /*!< in: true if delete */
180 sym_node_t *table_sym, /*!< in: table name node */
181 col_assign_node_t *col_assign_list); /*!< in: column assignment list, NULL
182 if delete */
183/** Parses an update or delete statement.
184 @return own: update node in a query tree */
186 upd_node_t *node, /*!< in: update node */
187 sym_node_t *cursor_sym, /*!< in: pointer to a cursor entry in
188 the symbol table or NULL */
189 que_node_t *search_cond); /*!< in: search condition or NULL */
190/** Parses an insert statement.
191 @return own: update node in a query tree */
193 sym_node_t *table_sym, /*!< in: table name node */
194 que_node_t *values_list, /*!< in: value expression list or NULL */
195 sel_node_t *select); /*!< in: select condition or NULL */
196/** Parses a procedure parameter declaration.
197 @return own: symbol table node of type SYM_VAR */
199 sym_node_t *node, /*!< in: symbol table node allocated for the
200 id of the parameter */
201 ulint param_type,
202 /*!< in: PARS_INPUT or PARS_OUTPUT */
203 pars_res_word_t *type); /*!< in: pointer to a type token */
204/** Parses an elsif element.
205 @return elsif node */
207 que_node_t *cond, /*!< in: if-condition */
208 que_node_t *stat_list); /*!< in: statement list */
209/** Parses an if-statement.
210 @return if-statement node */
212 que_node_t *cond, /*!< in: if-condition */
213 que_node_t *stat_list, /*!< in: statement list */
214 que_node_t *else_part); /*!< in: else-part statement list */
215/** Parses a for-loop-statement.
216 @return for-statement node */
218 sym_node_t *loop_var, /*!< in: loop variable */
219 que_node_t *loop_start_limit, /*!< in: loop start expression */
220 que_node_t *loop_end_limit, /*!< in: loop end expression */
221 que_node_t *stat_list); /*!< in: statement list */
222/** Parses a while-statement.
223 @return while-statement node */
225 que_node_t *cond, /*!< in: while-condition */
226 que_node_t *stat_list); /*!< in: statement list */
227/** Parses an exit statement.
228 @return exit statement node */
230/** Parses a return-statement.
231 @return return-statement node */
233/** Parses an assignment statement.
234 @return assignment statement node */
236 sym_node_t *var, /*!< in: variable to assign */
237 que_node_t *val); /*!< in: value to assign */
238/** Parses a fetch statement. into_list or user_func (but not both) must be
239 non-NULL.
240 @return fetch statement node */
242 sym_node_t *cursor, /*!< in: cursor node */
243 sym_node_t *into_list, /*!< in: variables to set, or NULL */
244 sym_node_t *user_func); /*!< in: user function name, or NULL */
245/** Parses an open or close cursor statement.
246 @return fetch statement node */
247open_node_t *pars_open_statement(ulint type, /*!< in: ROW_SEL_OPEN_CURSOR
248 or ROW_SEL_CLOSE_CURSOR */
249 sym_node_t *cursor); /*!< in: cursor node */
250/** Parses a commit statement.
251 @return own: commit node struct */
253/** Parses a rollback statement.
254 @return own: rollback node struct */
256/** Parses a column definition at a table creation.
257 @return column sym table node */
258sym_node_t *pars_column_def(sym_node_t *sym_node, /*!< in: column node in the
259 symbol table */
260 pars_res_word_t *type, /*!< in: data type */
261 sym_node_t *len, /*!< in: length of column, or
262 NULL */
263 void *is_unsigned, /*!< in: if not NULL, column
264 is of type UNSIGNED. */
265 void *is_not_null); /*!< in: if not NULL, column
266 is of type NOT NULL. */
267
268/** Parses a table creation operation.
269@param[in] table_sym table name node in the symbol table
270@param[in] column_defs list of column names
271@param[in] not_fit_in_memory a non-NULL pointer means that this is a
272 table which in simulations should be
273 simulated as not fitting in memory;
274 thread is put to sleep to simulate disk
275 accesses; NOTE that this flag is not
276 stored to the data dictionary on disk,
277 and the database will forget about
278 non-NULL value if it has to reload the
279 table definition from disk
280@param[in] compact non-NULL if COMPACT table
281@param[in] block_size block size (can be NULL)
282@return table create subgraph */
283tab_node_t *pars_create_table(sym_node_t *table_sym, sym_node_t *column_defs,
284 sym_node_t *compact, sym_node_t *block_size,
285 void *not_fit_in_memory);
286
287/** Parses an index creation operation.
288@param[in] unique_def Not NULL if a unique index.
289@param[in] clustered_def Not NULL if a clustered index.
290@param[in] index_sym Index name node in the symbol table.
291@param[in] table_sym Table name node in the symbol table.
292@param[in] column_list List of column names.
293@return index create subgraph */
295 pars_res_word_t *clustered_def,
296 sym_node_t *index_sym, sym_node_t *table_sym,
297 sym_node_t *column_list);
298/** Parses a procedure definition.
299 @return query fork node */
301 sym_node_t *sym_node, /*!< in: procedure id node in the symbol
302 table */
303 sym_node_t *param_list, /*!< in: parameter declaration list */
304 que_node_t *stat_list); /*!< in: statement list */
305
306/** Completes a query graph by adding query thread and fork nodes
307above it and prepares the graph for running. The fork created is of
308type QUE_FORK_MYSQL_INTERFACE.
309@param[in] node root node for an incomplete query
310 graph, or NULL for dummy graph
311@param[in] trx transaction handle
312@param[in] heap memory heap from which allocated
313@param[in] prebuilt row prebuilt structure
314@return query thread node to run */
316 trx_t *trx,
317 mem_heap_t *heap,
318 row_prebuilt_t *prebuilt);
319
320/** Create parser info struct.
321 @return own: info struct */
323
324/** Free info struct and everything it contains. */
325void pars_info_free(pars_info_t *info); /*!< in, own: info struct */
326
327/** Add bound literal.
328@param[in] info Info struct
329@param[in] name Name
330@param[in] address Address
331@param[in] length Length of data
332@param[in] type Type, e.g. data_fixbinary
333@param[in] prtype Precise type, e.g. data_unsigned */
334void pars_info_add_literal(pars_info_t *info, const char *name,
335 const void *address, ulint length, ulint type,
336 ulint prtype);
337
338/** Equivalent to pars_info_add_literal(info, name, str, strlen(str),
339 DATA_VARCHAR, DATA_ENGLISH).
340@param[in] info Info struct
341@param[in] name Name
342@param[in] str String */
344 const char *str);
345
346/********************************************************************
347If the literal value already exists then it rebinds otherwise it
348creates a new entry.*/
349void pars_info_bind_literal(pars_info_t *info, /* in: info struct */
350 const char *name, /* in: name */
351 const void *address, /* in: address */
352 ulint length, /* in: length of data */
353 ulint type, /* in: type, e.g. DATA_FIXBINARY */
354 ulint prtype); /* in: precise type, e.g. */
355
356/** If the literal value already exists then it rebinds otherwise it
357creates a new entry.
358@param[in] info Info struct
359@param[in] name Name
360@param[in] str String
361@param[in] str_len String length */
363 const byte *str, ulint str_len);
364
365/** If the literal value already exists then it rebinds otherwise it creates a
366new entry.
367@param[in] info Info struct
368@param[in] name Name
369@param[in] val Value */
371 const uint32_t *val);
372
373/** If the literal value already exists then it rebinds otherwise it creates a
374new entry.
375@param[in] info Info struct
376@param[in] name Name
377@param[in] val Value */
379 const uint64_t *val);
380
381/** Add user function.
382@param[in] info Info struct
383@param[in] name Function name
384@param[in] func Function address
385@param[in] arg User-supplied argument */
387 pars_user_func_cb_t func, void *arg);
388
389/** Add bound id.
390@param[in] info info struct
391@param[in] copy_name copy name if true
392@param[in] name name
393@param[in] id id */
394void pars_info_bind_id(pars_info_t *info, bool copy_name, const char *name,
395 const char *id);
396
397/** Equivalent to:
398
399 char buf[4];
400 mach_write_to_4(buf, val);
401 pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
402
403 except that the buffer is dynamically allocated from the info struct's
404 heap. */
405void pars_info_add_int4_literal(pars_info_t *info, /*!< in: info struct */
406 const char *name, /*!< in: name */
407 lint val); /*!< in: value */
408
409/** Equivalent to:
410
411 char buf[8];
412 mach_write_to_8(buf, val);
413 pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0);
414
415 except that the buffer is dynamically allocated from the info struct's
416 heap. */
417void pars_info_add_ull_literal(pars_info_t *info, /*!< in: info struct */
418 const char *name, /*!< in: name */
419 uint64_t val); /*!< in: value */
420
421/** If the literal value already exists then it rebinds otherwise it
422 creates a new entry.
423@param[in] info Info struct
424@param[in] name Name
425@param[in] val Value */
427 const uint64_t *val);
428
429/** Add bound id.
430@param[in] info info struct
431@param[in] name name
432@param[in] id id */
433void pars_info_add_id(pars_info_t *info, const char *name, const char *id);
434
435/** Get bound literal with the given name.
436 @return bound literal, or NULL if not found */
438 pars_info_t *info, /*!< in: info struct */
439 const char *name); /*!< in: bound literal name to find */
440
441/** Get bound identifier with the given name.
442@param[in] info info struct
443@param[in] name bound id name to find
444@return bound id, or NULL if not found */
446
447/** Release any resources used by the lexer. */
449
450/** Extra information supplied for pars_sql(). */
452 mem_heap_t *heap; /*!< our own memory heap */
453
454 ib_vector_t *funcs; /*!< user functions, or NUll
455 (pars_user_func_t*) */
456 ib_vector_t *bound_lits; /*!< bound literals, or NULL
457 (pars_bound_lit_t*) */
458 ib_vector_t *bound_ids; /*!< bound ids, or NULL
459 (pars_bound_id_t*) */
460
461 bool graph_owns_us; /*!< if true (which is the default),
462 que_graph_free() will free us */
463};
464
465/** User-supplied function and argument. */
467 const char *name; /*!< function name */
468 pars_user_func_cb_t func; /*!< function address */
469 void *arg; /*!< user-supplied argument */
470};
471
472/** Bound literal. */
474 const char *name; /*!< name */
475 const void *address; /*!< address */
476 ulint length; /*!< length of data */
477 ulint type; /*!< type, e.g. DATA_FIXBINARY */
478 ulint prtype; /*!< precise type, e.g. DATA_UNSIGNED */
479 sym_node_t *node; /*!< symbol node */
480};
481
482/** Bound identifier. */
484 const char *name; /*!< name */
485 const char *id; /*!< identifier */
486};
487
488/** Struct used to denote a reserved word in a parsing tree */
490 int code; /*!< the token code for the reserved word from
491 pars0grm.h */
492};
493
494/** A predefined function or operator node in a parsing tree; this construct
495is also used for some non-functions like the assignment ':=' */
497 que_common_t common; /*!< type: QUE_NODE_FUNC */
498 int func; /*!< token code of the function name */
499 ulint fclass; /*!< class of the function */
500 que_node_t *args; /*!< argument(s) of the function */
502 /*!< list of comparison conditions; defined
503 only for comparison operator nodes except,
504 presently, for OPT_SCROLL_TYPE ones */
506 /*!< list of function nodes in a parsed
507 query graph */
508};
509
511
513
514/** An order-by node in a select */
516 que_common_t common; /*!< type: QUE_NODE_ORDER */
517 sym_node_t *column; /*!< order-by column */
518 bool asc; /*!< true if ascending, false if descending */
519};
520
521/** Procedure definition node */
523 que_common_t common; /*!< type: QUE_NODE_PROC */
524 sym_node_t *proc_id; /*!< procedure name symbol in the symbol
525 table of this same procedure */
526 sym_node_t *param_list; /*!< input and output parameters */
527 que_node_t *stat_list; /*!< statement list */
528 sym_tab_t *sym_tab; /*!< symbol table of this procedure */
529};
530
531/** elsif-element node */
533 que_common_t common; /*!< type: QUE_NODE_ELSIF */
534 que_node_t *cond; /*!< if condition */
535 que_node_t *stat_list; /*!< statement list */
536};
537
538/** if-statement node */
539struct if_node_t {
540 que_common_t common; /*!< type: QUE_NODE_IF */
541 que_node_t *cond; /*!< if condition */
542 que_node_t *stat_list; /*!< statement list */
543 que_node_t *else_part; /*!< else-part statement list */
544 elsif_node_t *elsif_list; /*!< elsif element list */
545};
546
547/** while-statement node */
549 que_common_t common; /*!< type: QUE_NODE_WHILE */
550 que_node_t *cond; /*!< while condition */
551 que_node_t *stat_list; /*!< statement list */
552};
553
554/** for-loop-statement node */
556 que_common_t common; /*!< type: QUE_NODE_FOR */
557 sym_node_t *loop_var; /*!< loop variable: this is the
558 dereferenced symbol from the
559 variable declarations, not the
560 symbol occurrence in the for loop
561 definition */
562 que_node_t *loop_start_limit; /*!< initial value of loop variable */
563 que_node_t *loop_end_limit; /*!< end value of loop variable */
564 lint loop_end_value; /*!< evaluated value for the end value:
565 it is calculated only when the loop
566 is entered, and will not change within
567 the loop */
568 que_node_t *stat_list; /*!< statement list */
569};
570
571/** exit statement node */
573 que_common_t common; /*!< type: QUE_NODE_EXIT */
574};
575
576/** return-statement node */
578 que_common_t common; /*!< type: QUE_NODE_RETURN */
579};
580
581/** Assignment statement node */
583 que_common_t common; /*!< type: QUE_NODE_ASSIGNMENT */
584 sym_node_t *var; /*!< variable to set */
585 que_node_t *val; /*!< value to assign */
586};
587
588/** Column assignment node */
590 que_common_t common; /*!< type: QUE_NODE_COL_ASSIGN */
591 sym_node_t *col; /*!< column to set */
592 que_node_t *val; /*!< value to assign */
593};
594
595/** Classes of functions */
596/** @{ */
597#define PARS_FUNC_ARITH 1 /*!< +, -, *, / */
598#define PARS_FUNC_LOGICAL 2 /*!< AND, OR, NOT */
599#define PARS_FUNC_CMP 3 /*!< comparison operators */
600#define PARS_FUNC_PREDEFINED 4 /*!< TO_NUMBER, SUBSTR, ... */
601#define PARS_FUNC_AGGREGATE 5 /*!< COUNT, DISTINCT, SUM */
602#define PARS_FUNC_OTHER \
603 6 /*!< these are not real functions, \
604 e.g., := */
605/** @} */
606
607#include "pars0pars.ic"
608
609#endif
Log info(cout, "NOTE")
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1063
Definition: buf0block_hint.cc:29
constexpr value_type is_unsigned
Definition: classic_protocol_constants.h:270
constexpr value_type for_update
Definition: classic_protocol_constants.h:213
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
pars_res_word_t pars_instr_token
Definition: pars0pars.cc:70
que_node_t * pars_cursor_declaration(sym_node_t *sym_node, sel_node_t *select_node)
Parses a cursor declaration.
Definition: pars0pars.cc:925
pars_bound_id_t * pars_info_get_bound_id(pars_info_t *info, const char *name)
Get bound identifier with the given name.
Definition: pars0pars.cc:2034
que_t * pars_sql(pars_info_t *info, const char *str)
Parses an SQL string returning the query graph.
Definition: pars0pars.cc:1684
sym_node_t * pars_parameter_declaration(sym_node_t *node, ulint param_type, pars_res_word_t *type)
Parses a procedure parameter declaration.
Definition: pars0pars.cc:1271
ulint pars_star_denoter
Global variable used to denote the '*' in SELECT * FROM.
Definition: pars0pars.cc:91
pars_res_word_t pars_sum_token
Definition: pars0pars.cc:73
void pars_info_free(pars_info_t *info)
Free info struct and everything it contains.
Definition: pars0pars.cc:1775
tab_node_t * pars_create_table(sym_node_t *table_sym, sym_node_t *column_defs, sym_node_t *compact, sym_node_t *block_size, void *not_fit_in_memory)
Parses a table creation operation.
Definition: pars0pars.cc:1592
roll_node_t * pars_rollback_statement(void)
Parses a rollback statement.
Definition: pars0pars.cc:1562
pars_res_word_t pars_length_token
Definition: pars0pars.cc:71
void pars_info_bind_int4_literal(pars_info_t *info, const char *name, const uint32_t *val)
If the literal value already exists then it rebinds otherwise it creates a new entry.
Definition: pars0pars.cc:1894
void pars_info_bind_ull_literal(pars_info_t *info, const char *name, const uint64_t *val)
If the literal value already exists then it rebinds otherwise it creates a new entry.
Definition: pars0pars.cc:1955
upd_node_t * pars_update_statement_start(bool is_delete, sym_node_t *table_sym, col_assign_node_t *col_assign_list)
Parses a delete or update statement start.
Definition: pars0pars.cc:957
void pars_info_bind_varchar_literal(pars_info_t *info, const char *name, const byte *str, ulint str_len)
If the literal value already exists then it rebinds otherwise it creates a new entry.
Definition: pars0pars.cc:1855
pars_res_word_t pars_share_token
Definition: pars0pars.cc:86
pars_res_word_t pars_int_token
Definition: pars0pars.cc:77
ins_node_t * pars_insert_statement(sym_node_t *table_sym, que_node_t *values_list, sel_node_t *select)
Parses an insert statement.
Definition: pars0pars.cc:1156
void pars_info_bind_id(pars_info_t *info, bool copy_name, const char *name, const char *id)
Add bound id.
Definition: pars0pars.cc:2005
order_node_t * pars_order_by(sym_node_t *column, pars_res_word_t *asc)
Parses an ORDER BY clause.
Definition: pars0pars.cc:418
for_node_t * pars_for_statement(sym_node_t *loop_var, que_node_t *loop_start_limit, que_node_t *loop_end_limit, que_node_t *stat_list)
Parses a for-loop-statement.
Definition: pars0pars.cc:1399
void pars_close()
Clean up the internal parser.
Definition: pars0pars.cc:100
void pars_info_bind_int8_literal(pars_info_t *info, const char *name, const uint64_t *val)
If the literal value already exists then it rebinds otherwise it creates a new entry.
Definition: pars0pars.cc:1915
bool(* pars_user_func_cb_t)(void *arg, void *user_arg)
Type of the user functions.
Definition: pars0pars.h:49
sel_node_t * pars_select_statement(sel_node_t *select_node, sym_node_t *table_list, que_node_t *search_cond, pars_res_word_t *for_update, pars_res_word_t *consistent_read, order_node_t *order_by)
Parses a select statement.
Definition: pars0pars.cc:847
func_node_t * pars_func(que_node_t *res_word, que_node_t *arg)
Parses a function expression.
Definition: pars0pars.cc:250
sel_node_t * pars_select_list(que_node_t *select_list, sym_node_t *into_list)
Parses a select list; creates a query graph node for the whole SELECT statement.
Definition: pars0pars.cc:793
sym_node_t * pars_column_def(sym_node_t *sym_node, pars_res_word_t *type, sym_node_t *len, void *is_unsigned, void *is_not_null)
Parses a column definition at a table creation.
Definition: pars0pars.cc:1568
func_node_t * pars_op(int func, que_node_t *arg1, que_node_t *arg2)
Parses an operator expression.
Definition: pars0pars.cc:391
void pars_info_add_id(pars_info_t *info, const char *name, const char *id)
Add bound id.
pars_info_t * pars_info_create(void)
Create parser info struct.
Definition: pars0pars.cc:1757
pars_res_word_t pars_float_token
Definition: pars0pars.cc:80
pars_res_word_t pars_desc_token
Definition: pars0pars.cc:83
void pars_info_add_ull_literal(pars_info_t *info, const char *name, uint64_t val)
Equivalent to:
Definition: pars0pars.cc:1939
pars_bound_lit_t * pars_info_get_bound_lit(pars_info_t *info, const char *name)
Get bound literal with the given name.
Definition: pars0pars.cc:2040
pars_res_word_t pars_blob_token
Definition: pars0pars.cc:76
pars_res_word_t pars_unique_token
Definition: pars0pars.cc:87
commit_node_t * pars_commit_statement(void)
Parses a commit statement.
Definition: pars0pars.cc:1556
pars_res_word_t pars_distinct_token
Definition: pars0pars.cc:74
col_assign_node_t * pars_column_assignment(sym_node_t *column, que_node_t *exp)
Parses a column assignment in an update.
Definition: pars0pars.cc:977
open_node_t * pars_open_statement(ulint type, sym_node_t *cursor)
Parses an open or close cursor statement.
Definition: pars0pars.cc:1530
fetch_node_t * pars_fetch_statement(sym_node_t *cursor, sym_node_t *into_list, sym_node_t *user_func)
Parses a fetch statement.
Definition: pars0pars.cc:1481
int yyparse(void)
Definition: pars0grm.cc:1409
if_node_t * pars_if_statement(que_node_t *cond, que_node_t *stat_list, que_node_t *else_part)
Parses an if-statement.
Definition: pars0pars.cc:1328
sym_node_t * pars_variable_declaration(sym_node_t *node, pars_res_word_t *type)
Parses a variable declaration.
Definition: pars0pars.cc:1254
ind_node_t * pars_create_index(pars_res_word_t *unique_def, pars_res_word_t *clustered_def, sym_node_t *index_sym, sym_node_t *table_sym, sym_node_t *column_list)
Parses an index creation operation.
Definition: pars0pars.cc:1597
pars_res_word_t pars_bigint_token
Definition: pars0pars.cc:78
ib_mutex_t pars_mutex
Mutex to protect the sql parser.
Definition: pars0pars.cc:94
pars_res_word_t pars_substr_token
Definition: pars0pars.cc:68
sym_tab_t * pars_sym_tab_global
Definition: pars0pars.cc:62
pars_res_word_t pars_binary_token
Definition: pars0pars.cc:75
que_node_t * pars_function_declaration(sym_node_t *sym_node)
Parses a function declaration.
Definition: pars0pars.cc:942
pars_res_word_t pars_concat_token
Definition: pars0pars.cc:69
int yydebug
If the following is set true, the parser will emit debugging information.
void pars_info_add_str_literal(pars_info_t *info, const char *name, const char *str)
Equivalent to pars_info_add_literal(info, name, str, strlen(str), DATA_VARCHAR, DATA_ENGLISH).
Definition: pars0pars.cc:1817
elsif_node_t * pars_elsif_element(que_node_t *cond, que_node_t *stat_list)
Parses an elsif element.
Definition: pars0pars.cc:1306
int pars_like_rebind(sym_node_t *node, const byte *ptr, ulint len)
Definition: pars0pars.cc:260
exit_node_t * pars_exit_statement(void)
Parses an exit statement.
Definition: pars0pars.cc:1432
return_node_t * pars_return_statement(void)
Parses a return-statement.
Definition: pars0pars.cc:1444
pars_res_word_t pars_count_token
Definition: pars0pars.cc:72
void pars_info_add_literal(pars_info_t *info, const char *name, const void *address, ulint length, ulint type, ulint prtype)
Add bound literal.
Definition: pars0pars.cc:1787
upd_node_t * pars_update_statement(upd_node_t *node, sym_node_t *cursor_sym, que_node_t *search_cond)
Parses an update or delete statement.
Definition: pars0pars.cc:1075
void pars_info_add_int4_literal(pars_info_t *info, const char *name, lint val)
Equivalent to:
Definition: pars0pars.cc:1879
void pars_info_bind_literal(pars_info_t *info, const char *name, const void *address, ulint length, ulint type, ulint prtype)
Definition: pars0pars.cc:1828
pars_res_word_t pars_asc_token
Definition: pars0pars.cc:82
pars_res_word_t pars_to_binary_token
Definition: pars0pars.cc:67
int pars_get_lex_chars(char *buf, size_t max_size)
Retrieves characters to the lexical analyzer.
Definition: pars0pars.cc:1650
pars_res_word_t pars_close_token
Definition: pars0pars.cc:85
void pars_info_bind_function(pars_info_t *info, const char *name, pars_user_func_cb_t func, void *arg)
Add user function.
Definition: pars0pars.cc:1976
while_node_t * pars_while_statement(que_node_t *cond, que_node_t *stat_list)
Parses a while-statement.
Definition: pars0pars.cc:1375
pars_res_word_t pars_char_token
Definition: pars0pars.cc:79
void pars_init()
Initialize for the internal parser.
Definition: pars0pars.cc:97
pars_res_word_t pars_update_token
Definition: pars0pars.cc:81
pars_res_word_t pars_clustered_token
Definition: pars0pars.cc:88
void yyerror(const char *s)
Called by yyparse on error.
Definition: pars0pars.cc:1673
assign_node_t * pars_assignment_statement(sym_node_t *var, que_node_t *val)
Parses an assignment statement.
Definition: pars0pars.cc:1456
que_fork_t * pars_procedure_definition(sym_node_t *sym_node, sym_node_t *param_list, que_node_t *stat_list)
Parses a procedure definition.
Definition: pars0pars.cc:1604
que_thr_t * pars_complete_graph_for_exec(que_node_t *node, trx_t *trx, mem_heap_t *heap, row_prebuilt_t *prebuilt)
Completes a query graph by adding query thread and fork nodes above it and prepares the graph for run...
Definition: pars0pars.cc:1733
void pars_lexer_close(void)
Release any resources used by the lexer.
pars_res_word_t pars_open_token
Definition: pars0pars.cc:84
SQL parser.
SQL parser global types.
Query graph global types.
void que_node_t
Definition: que0types.h:40
required string type
Definition: replication_group_member_actions.proto:33
Interface between Innobase row operations and MySQL.
Row operation global types.
static void copy_name(char(&to)[N], std::string_view from)
Definition: set_var.cc:599
case opt name
Definition: sslopt-case.h:32
Assignment statement node.
Definition: pars0pars.h:582
sym_node_t * var
variable to set
Definition: pars0pars.h:584
que_node_t * val
value to assign
Definition: pars0pars.h:585
que_common_t common
type: QUE_NODE_ASSIGNMENT
Definition: pars0pars.h:583
Column assignment node.
Definition: pars0pars.h:589
que_common_t common
type: QUE_NODE_COL_ASSIGN
Definition: pars0pars.h:590
que_node_t * val
value to assign
Definition: pars0pars.h:592
sym_node_t * col
column to set
Definition: pars0pars.h:591
Commit command node in a query graph.
Definition: trx0trx.h:1342
elsif-element node
Definition: pars0pars.h:532
que_node_t * stat_list
statement list
Definition: pars0pars.h:535
que_common_t common
type: QUE_NODE_ELSIF
Definition: pars0pars.h:533
que_node_t * cond
if condition
Definition: pars0pars.h:534
exit statement node
Definition: pars0pars.h:572
que_common_t common
type: QUE_NODE_EXIT
Definition: pars0pars.h:573
Fetch statement node.
Definition: row0sel.h:375
for-loop-statement node
Definition: pars0pars.h:555
sym_node_t * loop_var
loop variable: this is the dereferenced symbol from the variable declarations, not the symbol occurre...
Definition: pars0pars.h:557
que_node_t * loop_end_limit
end value of loop variable
Definition: pars0pars.h:563
que_node_t * stat_list
statement list
Definition: pars0pars.h:568
que_common_t common
type: QUE_NODE_FOR
Definition: pars0pars.h:556
que_node_t * loop_start_limit
initial value of loop variable
Definition: pars0pars.h:562
lint loop_end_value
evaluated value for the end value: it is calculated only when the loop is entered,...
Definition: pars0pars.h:564
A predefined function or operator node in a parsing tree; this construct is also used for some non-fu...
Definition: pars0pars.h:496
UT_LIST_NODE_T(func_node_t) func_node_list
list of function nodes in a parsed query graph
que_common_t common
type: QUE_NODE_FUNC
Definition: pars0pars.h:497
UT_LIST_NODE_T(func_node_t) cond_list
list of comparison conditions; defined only for comparison operator nodes except, presently,...
que_node_t * args
argument(s) of the function
Definition: pars0pars.h:500
ulint fclass
class of the function
Definition: pars0pars.h:499
int func
token code of the function name
Definition: pars0pars.h:498
Definition: ut0vec.h:212
if-statement node
Definition: pars0pars.h:539
elsif_node_t * elsif_list
elsif element list
Definition: pars0pars.h:544
que_common_t common
type: QUE_NODE_IF
Definition: pars0pars.h:540
que_node_t * stat_list
statement list
Definition: pars0pars.h:542
que_node_t * cond
if condition
Definition: pars0pars.h:541
que_node_t * else_part
else-part statement list
Definition: pars0pars.h:543
Definition: dict0crea.h:147
Definition: row0ins.h:161
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:299
Open or close cursor statement node.
Definition: row0sel.h:399
An order-by node in a select.
Definition: pars0pars.h:515
que_common_t common
type: QUE_NODE_ORDER
Definition: pars0pars.h:516
bool asc
true if ascending, false if descending
Definition: pars0pars.h:518
sym_node_t * column
order-by column
Definition: pars0pars.h:517
Bound identifier.
Definition: pars0pars.h:483
const char * id
identifier
Definition: pars0pars.h:485
const char * name
name
Definition: pars0pars.h:484
Bound literal.
Definition: pars0pars.h:473
const void * address
address
Definition: pars0pars.h:475
const char * name
name
Definition: pars0pars.h:474
ulint type
type, e.g.
Definition: pars0pars.h:477
sym_node_t * node
symbol node
Definition: pars0pars.h:479
ulint length
length of data
Definition: pars0pars.h:476
ulint prtype
precise type, e.g.
Definition: pars0pars.h:478
Extra information supplied for pars_sql().
Definition: pars0pars.h:451
ib_vector_t * funcs
user functions, or NUll (pars_user_func_t*)
Definition: pars0pars.h:454
ib_vector_t * bound_ids
bound ids, or NULL (pars_bound_id_t*)
Definition: pars0pars.h:458
bool graph_owns_us
if true (which is the default), que_graph_free() will free us
Definition: pars0pars.h:461
mem_heap_t * heap
our own memory heap
Definition: pars0pars.h:452
ib_vector_t * bound_lits
bound literals, or NULL (pars_bound_lit_t*)
Definition: pars0pars.h:456
Struct used to denote a reserved word in a parsing tree.
Definition: pars0pars.h:489
int code
the token code for the reserved word from pars0grm.h
Definition: pars0pars.h:490
User-supplied function and argument.
Definition: pars0pars.h:466
pars_user_func_cb_t func
function address
Definition: pars0pars.h:468
const char * name
function name
Definition: pars0pars.h:467
void * arg
user-supplied argument
Definition: pars0pars.h:469
Procedure definition node.
Definition: pars0pars.h:522
que_common_t common
type: QUE_NODE_PROC
Definition: pars0pars.h:523
sym_tab_t * sym_tab
symbol table of this procedure
Definition: pars0pars.h:528
que_node_t * stat_list
statement list
Definition: pars0pars.h:527
sym_node_t * proc_id
procedure name symbol in the symbol table of this same procedure
Definition: pars0pars.h:524
sym_node_t * param_list
input and output parameters
Definition: pars0pars.h:526
Definition: que0types.h:50
Definition: que0que.h:300
Definition: que0que.h:241
return-statement node
Definition: pars0pars.h:577
que_common_t common
type: QUE_NODE_RETURN
Definition: pars0pars.h:578
Rollback command node in a query graph.
Definition: trx0roll.h:153
A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; th...
Definition: row0mysql.h:514
Select statement node.
Definition: row0sel.h:328
Symbol table node.
Definition: pars0sym.h:112
Symbol table.
Definition: pars0sym.h:202
Definition: dict0crea.h:111
Definition: trx0trx.h:680
Definition: row0upd.h:700
while-statement node
Definition: pars0pars.h:548
que_common_t common
type: QUE_NODE_WHILE
Definition: pars0pars.h:549
que_node_t * stat_list
statement list
Definition: pars0pars.h:551
que_node_t * cond
while condition
Definition: pars0pars.h:550
Transaction system global type definitions.
Version control for database, common definitions, and include files.
unsigned long int ulint
Definition: univ.i:407
long int lint
Definition: univ.i:408
Users and sessions global types.
#define UT_LIST_NODE_GETTER_DEFINITION(t, m)
A helper for the UT_LIST_BASE_NODE_T_EXTERN which declares a node getter struct which extracts member...
Definition: ut0lst.h:269
A vector of pointers to data items.