MySQL  8.0.22
Source Code Documentation
pars0pars.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1996, 2020, Oracle and/or its affiliates.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License, version 2.0, as published by the
7 Free Software Foundation.
8 
9 This program is also distributed with certain software (including but not
10 limited to OpenSSL) that is licensed under separate terms, as designated in a
11 particular file or component or in included license documentation. The authors
12 of MySQL hereby grant you an additional permission to link the program and
13 your derivative works with the separately licensed software that they have
14 included with MySQL.
15 
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19 for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 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
46 and varies in type, while 'user_arg' is a user-supplied argument. The
47 meaning of the return type also varies. See the individual use cases, e.g.
48 the FETCH statement, for details on them. */
49 typedef ibool (*pars_user_func_cb_t)(void *arg, void *user_arg);
50 
51 /** If the following is set TRUE, the parser will emit debugging
52 information */
53 extern int yydebug;
54 
55 /* Global variable used while parsing a single procedure or query : the code is
56 NOT re-entrant */
58 
59 /** Mutex to protect the sql parser */
60 extern ib_mutex_t pars_mutex;
61 
84 
85 extern ulint pars_star_denoter;
86 
87 /* Procedure parameter types */
88 #define PARS_INPUT 0
89 #define PARS_OUTPUT 1
90 #define PARS_NOT_PARAM 2
91 
92 int yyparse(void);
93 
94 /** Initialize for the internal parser */
95 void pars_init();
96 
97 /** Clean up the internal parser */
98 void pars_close();
99 
100 /** Parses an SQL string returning the query graph.
101  @return own: the query graph */
102 que_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 */
110 int pars_get_lex_chars(char *buf, size_t max_size);
111 
112 /** Called by yyparse on error. */
113 void 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 /*************************************************************************
126 Rebind a LIKE search string. NOTE: We ignore any '%' characters embedded
127 within the search string.
128 @return own: function node in a query tree */
129 int 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 */
134 func_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  ibool 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 */
247 open_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 */
258 sym_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 */
283 tab_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  @return index create subgraph */
290  pars_res_word_t *unique_def, /*!< in: not NULL if a unique index */
291  pars_res_word_t *clustered_def, /*!< in: not NULL if a clustered index */
292  sym_node_t *index_sym, /*!< in: index name node in the symbol
293  table */
294  sym_node_t *table_sym, /*!< in: table name node in the symbol
295  table */
296  sym_node_t *column_list); /*!< in: list of column names */
297 /** Parses a procedure definition.
298  @return query fork node */
300  sym_node_t *sym_node, /*!< in: procedure id node in the symbol
301  table */
302  sym_node_t *param_list, /*!< in: parameter declaration list */
303  que_node_t *stat_list); /*!< in: statement list */
304 
305 /** Completes a query graph by adding query thread and fork nodes
306 above it and prepares the graph for running. The fork created is of
307 type QUE_FORK_MYSQL_INTERFACE.
308 @param[in] node root node for an incomplete query
309  graph, or NULL for dummy graph
310 @param[in] trx transaction handle
311 @param[in] heap memory heap from which allocated
312 @param[in] prebuilt row prebuilt structure
313 @return query thread node to run */
315  mem_heap_t *heap,
316  row_prebuilt_t *prebuilt)
317  MY_ATTRIBUTE((warn_unused_result));
318 
319 /** Create parser info struct.
320  @return own: info struct */
322 
323 /** Free info struct and everything it contains. */
324 void pars_info_free(pars_info_t *info); /*!< in, own: info struct */
325 
326 /** Add bound literal.
327 @param[in] info Info struct
328 @param[in] name Name
329 @param[in] address Address
330 @param[in] length Length of data
331 @param[in] type Type, e.g. data_fixbinary
332 @param[in] prtype Precise type, e.g. data_unsigned */
333 void pars_info_add_literal(pars_info_t *info, const char *name,
334  const void *address, ulint length, ulint type,
335  ulint prtype);
336 
337 /** Equivalent to pars_info_add_literal(info, name, str, strlen(str),
338  DATA_VARCHAR, DATA_ENGLISH).
339 @param[in] info Info struct
340 @param[in] name Name
341 @param[in] str String */
343  const char *str);
344 
345 /********************************************************************
346 If the literal value already exists then it rebinds otherwise it
347 creates a new entry.*/
348 void pars_info_bind_literal(pars_info_t *info, /* in: info struct */
349  const char *name, /* in: name */
350  const void *address, /* in: address */
351  ulint length, /* in: length of data */
352  ulint type, /* in: type, e.g. DATA_FIXBINARY */
353  ulint prtype); /* in: precise type, e.g. */
354 
355 /** If the literal value already exists then it rebinds otherwise it
356 creates a new entry.
357 @param[in] info Info struct
358 @param[in] name Name
359 @param[in] str String
360 @param[in] str_len String length */
362  const byte *str, ulint str_len);
363 
364 /** If the literal value already exists then it rebinds otherwise it creates a
365 new entry.
366 @param[in] info Info struct
367 @param[in] name Name
368 @param[in] val Value */
370  const ib_uint32_t *val);
371 
372 /** If the literal value already exists then it rebinds otherwise it creates a
373 new entry.
374 @param[in] info Info struct
375 @param[in] name Name
376 @param[in] val Value */
378  const ib_uint64_t *val);
379 
380 /** Add user function.
381 @param[in] info Info struct
382 @param[in] name Function name
383 @param[in] func Function address
384 @param[in] arg User-supplied argument */
385 void pars_info_bind_function(pars_info_t *info, const char *name,
386  pars_user_func_cb_t func, void *arg);
387 
388 /** Add bound id.
389 @param[in] info info struct
390 @param[in] copy_name copy name if TRUE
391 @param[in] name name
392 @param[in] id id */
393 void pars_info_bind_id(pars_info_t *info, ibool copy_name, const char *name,
394  const char *id);
395 
396 /** Equivalent to:
397 
398  char buf[4];
399  mach_write_to_4(buf, val);
400  pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);
401 
402  except that the buffer is dynamically allocated from the info struct's
403  heap. */
404 void pars_info_add_int4_literal(pars_info_t *info, /*!< in: info struct */
405  const char *name, /*!< in: name */
406  lint val); /*!< in: value */
407 
408 /** Equivalent to:
409 
410  char buf[8];
411  mach_write_to_8(buf, val);
412  pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0);
413 
414  except that the buffer is dynamically allocated from the info struct's
415  heap. */
416 void pars_info_add_ull_literal(pars_info_t *info, /*!< in: info struct */
417  const char *name, /*!< in: name */
418  ib_uint64_t val); /*!< in: value */
419 
420 /** If the literal value already exists then it rebinds otherwise it
421  creates a new entry.
422 @param[in] info Info struct
423 @param[in] name Name
424 @param[in] val Value */
426  const ib_uint64_t *val);
427 
428 /** Add bound id.
429 @param[in] info info struct
430 @param[in] name name
431 @param[in] id id */
432 void pars_info_add_id(pars_info_t *info, const char *name, const char *id);
433 
434 /** Get bound literal with the given name.
435  @return bound literal, or NULL if not found */
437  pars_info_t *info, /*!< in: info struct */
438  const char *name); /*!< in: bound literal name to find */
439 
440 /** Get bound identifier with the given name.
441 @param[in] info info struct
442 @param[in] name bound id name to find
443 @return bound id, or NULL if not found */
445 
446 /** Release any resources used by the lexer. */
447 void pars_lexer_close(void);
448 
449 /** Extra information supplied for pars_sql(). */
450 struct pars_info_t {
451  mem_heap_t *heap; /*!< our own memory heap */
452 
453  ib_vector_t *funcs; /*!< user functions, or NUll
454  (pars_user_func_t*) */
455  ib_vector_t *bound_lits; /*!< bound literals, or NULL
456  (pars_bound_lit_t*) */
457  ib_vector_t *bound_ids; /*!< bound ids, or NULL
458  (pars_bound_id_t*) */
459 
460  ibool graph_owns_us; /*!< if TRUE (which is the default),
461  que_graph_free() will free us */
462 };
463 
464 /** User-supplied function and argument. */
466  const char *name; /*!< function name */
467  pars_user_func_cb_t func; /*!< function address */
468  void *arg; /*!< user-supplied argument */
469 };
470 
471 /** Bound literal. */
473  const char *name; /*!< name */
474  const void *address; /*!< address */
475  ulint length; /*!< length of data */
476  ulint type; /*!< type, e.g. DATA_FIXBINARY */
477  ulint prtype; /*!< precise type, e.g. DATA_UNSIGNED */
478  sym_node_t *node; /*!< symbol node */
479 };
480 
481 /** Bound identifier. */
483  const char *name; /*!< name */
484  const char *id; /*!< identifier */
485 };
486 
487 /** Struct used to denote a reserved word in a parsing tree */
489  int code; /*!< the token code for the reserved word from
490  pars0grm.h */
491 };
492 
493 /** A predefined function or operator node in a parsing tree; this construct
494 is also used for some non-functions like the assignment ':=' */
495 struct func_node_t {
496  que_common_t common; /*!< type: QUE_NODE_FUNC */
497  int func; /*!< token code of the function name */
498  ulint fclass; /*!< class of the function */
499  que_node_t *args; /*!< argument(s) of the function */
500  UT_LIST_NODE_T(func_node_t) cond_list;
501  /*!< list of comparison conditions; defined
502  only for comparison operator nodes except,
503  presently, for OPT_SCROLL_TYPE ones */
504  UT_LIST_NODE_T(func_node_t) func_node_list;
505  /*!< list of function nodes in a parsed
506  query graph */
507 };
508 
509 /** An order-by node in a select */
510 struct order_node_t {
511  que_common_t common; /*!< type: QUE_NODE_ORDER */
512  sym_node_t *column; /*!< order-by column */
513  ibool asc; /*!< TRUE if ascending, FALSE if descending */
514 };
515 
516 /** Procedure definition node */
517 struct proc_node_t {
518  que_common_t common; /*!< type: QUE_NODE_PROC */
519  sym_node_t *proc_id; /*!< procedure name symbol in the symbol
520  table of this same procedure */
521  sym_node_t *param_list; /*!< input and output parameters */
522  que_node_t *stat_list; /*!< statement list */
523  sym_tab_t *sym_tab; /*!< symbol table of this procedure */
524 };
525 
526 /** elsif-element node */
527 struct elsif_node_t {
528  que_common_t common; /*!< type: QUE_NODE_ELSIF */
529  que_node_t *cond; /*!< if condition */
530  que_node_t *stat_list; /*!< statement list */
531 };
532 
533 /** if-statement node */
534 struct if_node_t {
535  que_common_t common; /*!< type: QUE_NODE_IF */
536  que_node_t *cond; /*!< if condition */
537  que_node_t *stat_list; /*!< statement list */
538  que_node_t *else_part; /*!< else-part statement list */
539  elsif_node_t *elsif_list; /*!< elsif element list */
540 };
541 
542 /** while-statement node */
543 struct while_node_t {
544  que_common_t common; /*!< type: QUE_NODE_WHILE */
545  que_node_t *cond; /*!< while condition */
546  que_node_t *stat_list; /*!< statement list */
547 };
548 
549 /** for-loop-statement node */
550 struct for_node_t {
551  que_common_t common; /*!< type: QUE_NODE_FOR */
552  sym_node_t *loop_var; /*!< loop variable: this is the
553  dereferenced symbol from the
554  variable declarations, not the
555  symbol occurrence in the for loop
556  definition */
557  que_node_t *loop_start_limit; /*!< initial value of loop variable */
558  que_node_t *loop_end_limit; /*!< end value of loop variable */
559  lint loop_end_value; /*!< evaluated value for the end value:
560  it is calculated only when the loop
561  is entered, and will not change within
562  the loop */
563  que_node_t *stat_list; /*!< statement list */
564 };
565 
566 /** exit statement node */
567 struct exit_node_t {
568  que_common_t common; /*!< type: QUE_NODE_EXIT */
569 };
570 
571 /** return-statement node */
573  que_common_t common; /*!< type: QUE_NODE_RETURN */
574 };
575 
576 /** Assignment statement node */
578  que_common_t common; /*!< type: QUE_NODE_ASSIGNMENT */
579  sym_node_t *var; /*!< variable to set */
580  que_node_t *val; /*!< value to assign */
581 };
582 
583 /** Column assignment node */
585  que_common_t common; /*!< type: QUE_NODE_COL_ASSIGN */
586  sym_node_t *col; /*!< column to set */
587  que_node_t *val; /*!< value to assign */
588 };
589 
590 /** Classes of functions */
591 /** @{ */
592 #define PARS_FUNC_ARITH 1 /*!< +, -, *, / */
593 #define PARS_FUNC_LOGICAL 2 /*!< AND, OR, NOT */
594 #define PARS_FUNC_CMP 3 /*!< comparison operators */
595 #define PARS_FUNC_PREDEFINED 4 /*!< TO_NUMBER, SUBSTR, ... */
596 #define PARS_FUNC_AGGREGATE 5 /*!< COUNT, DISTINCT, SUM */
597 #define PARS_FUNC_OTHER \
598  6 /*!< these are not real functions, \
599  e.g., := */
600 /** @} */
601 
602 #include "pars0pars.ic"
603 
604 #endif
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:1078
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:1819
pars_res_word_t pars_to_binary_token
Definition: pars0pars.cc:67
ulint prtype
precise type, e.g.
Definition: pars0pars.h:477
A vector of pointers to data items.
que_common_t common
type: QUE_NODE_FUNC
Definition: pars0pars.h:496
func_node_t * pars_func(que_node_t *res_word, que_node_t *arg)
Parses a function expression.
Definition: pars0pars.cc:253
elsif_node_t * elsif_list
elsif element list
Definition: pars0pars.h:539
lint loop_end_value
evaluated value for the end value: it is calculated only when the loop is entered, and will not change within the loop
Definition: pars0pars.h:559
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:2008
void pars_info_add_ull_literal(pars_info_t *info, const char *name, ib_uint64_t val)
Equivalent to:
Definition: pars0pars.cc:1971
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:796
while_node_t * pars_while_statement(que_node_t *cond, que_node_t *stat_list)
Parses a while-statement.
Definition: pars0pars.cc:1378
que_common_t common
type: QUE_NODE_PROC
Definition: pars0pars.h:518
exit statement node
Definition: pars0pars.h:567
while-statement node
Definition: pars0pars.h:543
pars_user_func_cb_t func
function address
Definition: pars0pars.h:467
exit_node_t * pars_exit_statement(void)
Parses an exit statement.
Definition: pars0pars.cc:1435
elsif-element node
Definition: pars0pars.h:527
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:1274
ulint type
type, e.g.
Definition: pars0pars.h:476
Definition: trx0trx.h:833
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:1159
assign_node_t * pars_assignment_statement(sym_node_t *var, que_node_t *val)
Parses an assignment statement.
Definition: pars0pars.cc:1459
void pars_info_add_int4_literal(pars_info_t *info, const char *name, lint val)
Equivalent to:
Definition: pars0pars.cc:1911
Symbol table node.
Definition: pars0sym.h:112
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:1484
order_node_t * pars_order_by(sym_node_t *column, pars_res_word_t *asc)
Parses an ORDER BY clause.
Definition: pars0pars.cc:421
return_node_t * pars_return_statement(void)
Parses a return-statement.
Definition: pars0pars.cc:1447
Symbol table.
Definition: pars0sym.h:200
sym_node_t * col
column to set
Definition: pars0pars.h:586
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:2072
que_node_t * pars_cursor_declaration(sym_node_t *sym_node, sel_node_t *select_node)
Parses a cursor declaration.
Definition: pars0pars.cc:928
A predefined function or operator node in a parsing tree; this construct is also used for some non-fu...
Definition: pars0pars.h:495
roll_node_t * pars_rollback_statement(void)
Parses a rollback statement.
Definition: pars0pars.cc:1565
Struct used to denote a reserved word in a parsing tree.
Definition: pars0pars.h:488
pars_res_word_t pars_close_token
Definition: pars0pars.cc:85
ib_vector_t * bound_ids
bound ids, or NULL (pars_bound_id_t*)
Definition: pars0pars.h:457
que_common_t common
type: QUE_NODE_ELSIF
Definition: pars0pars.h:528
que_common_t common
type: QUE_NODE_COL_ASSIGN
Definition: pars0pars.h:585
Definition: row0ins.h:169
Open or close cursor statement node.
Definition: row0sel.h:417
ibool graph_owns_us
if TRUE (which is the default), que_graph_free() will free us
Definition: pars0pars.h:460
pars_res_word_t pars_open_token
Definition: pars0pars.cc:84
Commit command node in a query graph.
Definition: trx0trx.h:1293
Definition: buf0block_hint.cc:29
void pars_info_bind_int4_literal(pars_info_t *info, const char *name, const ib_uint32_t *val)
If the literal value already exists then it rebinds otherwise it creates a new entry.
Definition: pars0pars.cc:1926
int pars_like_rebind(sym_node_t *node, const byte *ptr, ulint len)
Definition: pars0pars.cc:263
The info structure stored at the beginning of a heap block.
Definition: mem0mem.h:349
Rollback command node in a query graph.
Definition: trx0roll.h:155
que_node_t * cond
while condition
Definition: pars0pars.h:545
commit_node_t * pars_commit_statement(void)
Parses a commit statement.
Definition: pars0pars.cc:1559
Definition: que0que.h:310
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:1402
que_node_t * val
value to assign
Definition: pars0pars.h:580
que_node_t * cond
if condition
Definition: pars0pars.h:536
SQL parser global types.
que_node_t * else_part
else-part statement list
Definition: pars0pars.h:538
Query graph global types.
que_common_t common
type: QUE_NODE_IF
Definition: pars0pars.h:535
pars_info_t * pars_info_create(void)
Create parser info struct.
Definition: pars0pars.cc:1789
void * arg
user-supplied argument
Definition: pars0pars.h:468
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:1632
void pars_info_bind_ull_literal(pars_info_t *info, const char *name, const ib_uint64_t *val)
If the literal value already exists then it rebinds otherwise it creates a new entry.
Definition: pars0pars.cc:1987
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:980
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:1331
sym_tab_t * sym_tab
symbol table of this procedure
Definition: pars0pars.h:523
void pars_info_bind_int8_literal(pars_info_t *info, const char *name, const ib_uint64_t *val)
If the literal value already exists then it rebinds otherwise it creates a new entry.
Definition: pars0pars.cc:1947
que_node_t * stat_list
statement list
Definition: pars0pars.h:530
Definition: dict0crea.h:107
A struct for (sometimes lazily) prebuilt structures in an Innobase table handle used within MySQL; th...
Definition: row0mysql.h:550
int yyparse(void)
Definition: pars0grm.cc:1409
pars_res_word_t pars_asc_token
Definition: pars0pars.cc:82
pars_res_word_t pars_binary_token
Definition: pars0pars.cc:75
Column assignment node.
Definition: pars0pars.h:584
Extra information supplied for pars_sql().
Definition: pars0pars.h:450
int code
the token code for the reserved word from pars0grm.h
Definition: pars0pars.h:489
Interface between Innobase row operations and MySQL.
pars_res_word_t pars_desc_token
Definition: pars0pars.cc:83
pars_res_word_t pars_char_token
Definition: pars0pars.cc:79
ulint pars_star_denoter
Global variable used to denote the &#39;*&#39; in SELECT * FROM.
Definition: pars0pars.cc:91
que_common_t common
type: QUE_NODE_ORDER
Definition: pars0pars.h:511
sym_tab_t * pars_sym_tab_global
Definition: pars0pars.cc:62
ulint length
length of data
Definition: pars0pars.h:475
ib_vector_t * funcs
user functions, or NUll (pars_user_func_t*)
Definition: pars0pars.h:453
void pars_info_free(pars_info_t *info)
Free info struct and everything it contains.
Definition: pars0pars.cc:1807
que_common_t common
type: QUE_NODE_RETURN
Definition: pars0pars.h:573
pars_res_word_t pars_substr_token
Definition: pars0pars.cc:68
Row operation global types.
sym_node_t * pars_variable_declaration(sym_node_t *node, pars_res_word_t *type)
Parses a variable declaration.
Definition: pars0pars.cc:1257
Definition: que0que.h:251
open_node_t * pars_open_statement(ulint type, sym_node_t *cursor)
Parses an open or close cursor statement.
Definition: pars0pars.cc:1533
que_node_t * args
argument(s) of the function
Definition: pars0pars.h:499
void pars_lexer_close(void)
Release any resources used by the lexer.
que_node_t * stat_list
statement list
Definition: pars0pars.h:522
pars_res_word_t pars_concat_token
Definition: pars0pars.cc:69
Definition: ut0vec.h:229
void pars_info_add_id(pars_info_t *info, const char *name, const char *id)
Add bound id.
case opt name
Definition: sslopt-case.h:32
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:1610
que_node_t * stat_list
statement list
Definition: pars0pars.h:563
pars_res_word_t pars_blob_token
Definition: pars0pars.cc:76
ib_mutex_t pars_mutex
Mutex to protect the sql parser.
Definition: pars0pars.cc:94
const char * id
identifier
Definition: pars0pars.h:484
const char * name
function name
Definition: pars0pars.h:466
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:2066
Transaction system global type definitions.
que_node_t * loop_start_limit
initial value of loop variable
Definition: pars0pars.h:557
void que_node_t
Definition: que0types.h:40
upd_node_t * pars_update_statement_start(ibool is_delete, sym_node_t *table_sym, col_assign_node_t *col_assign_list)
Parses a delete or update statement start.
Definition: pars0pars.cc:960
que_node_t * pars_function_declaration(sym_node_t *sym_node)
Parses a function declaration.
Definition: pars0pars.cc:945
Definition: que0types.h:50
pars_res_word_t pars_bigint_token
Definition: pars0pars.cc:78
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:1571
void pars_close()
Clean up the internal parser.
Definition: pars0pars.cc:100
ibool(* pars_user_func_cb_t)(void *arg, void *user_arg)
Type of the user functions.
Definition: pars0pars.h:49
Select statement node.
Definition: row0sel.h:341
void yyerror(const char *s)
Called by yyparse on error.
Definition: pars0pars.cc:1701
void pars_info_bind_literal(pars_info_t *info, const char *name, const void *address, ulint length, ulint type, ulint prtype)
Definition: pars0pars.cc:1860
pars_res_word_t pars_distinct_token
Definition: pars0pars.cc:74
const char * name
name
Definition: pars0pars.h:483
void pars_info_bind_id(pars_info_t *info, ibool copy_name, const char *name, const char *id)
Add bound id.
Definition: pars0pars.cc:2037
Assignment statement node.
Definition: pars0pars.h:577
elsif_node_t * pars_elsif_element(que_node_t *cond, que_node_t *stat_list)
Parses an elsif element.
Definition: pars0pars.cc:1309
ib_vector_t * bound_lits
bound literals, or NULL (pars_bound_lit_t*)
Definition: pars0pars.h:455
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:850
pars_res_word_t pars_clustered_token
Definition: pars0pars.cc:88
const void * address
address
Definition: pars0pars.h:474
sym_node_t * node
symbol node
Definition: pars0pars.h:478
que_node_t * stat_list
statement list
Definition: pars0pars.h:537
que_common_t common
type: QUE_NODE_ASSIGNMENT
Definition: pars0pars.h:578
if-statement node
Definition: pars0pars.h:534
Definition: row0upd.h:683
pars_res_word_t pars_unique_token
Definition: pars0pars.cc:87
const char * name
name
Definition: pars0pars.h:473
Procedure definition node.
Definition: pars0pars.h:517
Users and sessions global types.
User-supplied function and argument.
Definition: pars0pars.h:465
int func
token code of the function name
Definition: pars0pars.h:497
que_node_t * val
value to assign
Definition: pars0pars.h:587
pars_res_word_t pars_sum_token
Definition: pars0pars.cc:73
que_node_t * cond
if condition
Definition: pars0pars.h:529
que_common_t common
type: QUE_NODE_FOR
Definition: pars0pars.h:551
func_node_t * pars_op(int func, que_node_t *arg1, que_node_t *arg2)
Parses an operator expression.
Definition: pars0pars.cc:394
pars_res_word_t pars_update_token
Definition: pars0pars.cc:81
return-statement node
Definition: pars0pars.h:572
for-loop-statement node
Definition: pars0pars.h:550
que_common_t common
type: QUE_NODE_EXIT
Definition: pars0pars.h:568
Bound literal.
Definition: pars0pars.h:472
ulint fclass
class of the function
Definition: pars0pars.h:498
Fetch statement node.
Definition: row0sel.h:393
Log info(cout, "NOTE")
sym_node_t * var
variable to set
Definition: pars0pars.h:579
int pars_get_lex_chars(char *buf, size_t max_size)
Retrieves characters to the lexical analyzer.
Definition: pars0pars.cc:1678
pars_res_word_t pars_instr_token
Definition: pars0pars.cc:70
int yydebug
If the following is set TRUE, the parser will emit debugging information.
unsigned char byte
Blob class.
Definition: common.h:159
sym_node_t * loop_var
loop variable: this is the dereferenced symbol from the variable declarations, not the symbol occurre...
Definition: pars0pars.h:552
pars_res_word_t pars_float_token
Definition: pars0pars.cc:80
pars_res_word_t pars_share_token
Definition: pars0pars.cc:86
que_common_t common
type: QUE_NODE_WHILE
Definition: pars0pars.h:544
Definition: dict0crea.h:143
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:1849
sym_node_t * column
order-by column
Definition: pars0pars.h:512
mem_heap_t * heap
our own memory heap
Definition: pars0pars.h:451
#define UT_LIST_NODE_T(TYPE)
Definition: innodb_utility.h:40
sym_node_t * param_list
input and output parameters
Definition: pars0pars.h:521
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:1618
que_node_t * stat_list
statement list
Definition: pars0pars.h:546
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
que_t * pars_sql(pars_info_t *info, const char *str)
Parses an SQL string returning the query graph.
Definition: pars0pars.cc:1711
An order-by node in a select.
Definition: pars0pars.h:510
que_node_t * loop_end_limit
end value of loop variable
Definition: pars0pars.h:558
Bound identifier.
Definition: pars0pars.h:482
ibool asc
TRUE if ascending, FALSE if descending.
Definition: pars0pars.h:513
pars_res_word_t pars_length_token
Definition: pars0pars.cc:71
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:1887
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:1765
void pars_init()
Initialize for the internal parser.
Definition: pars0pars.cc:97
sym_node_t * proc_id
procedure name symbol in the symbol table of this same procedure
Definition: pars0pars.h:519
pars_res_word_t pars_int_token
Definition: pars0pars.cc:77