MySQL 8.0.39
Source Code Documentation
pars0pars.h File Reference

SQL parser. More...

#include "pars0types.h"
#include "que0types.h"
#include "row0mysql.h"
#include "row0types.h"
#include "trx0types.h"
#include "univ.i"
#include "usr0types.h"
#include "ut0vec.h"
#include "pars0pars.ic"

Go to the source code of this file.

Classes

struct  pars_info_t
 Extra information supplied for pars_sql(). More...
 
struct  pars_user_func_t
 User-supplied function and argument. More...
 
struct  pars_bound_lit_t
 Bound literal. More...
 
struct  pars_bound_id_t
 Bound identifier. More...
 
struct  pars_res_word_t
 Struct used to denote a reserved word in a parsing tree. More...
 
struct  func_node_t
 A predefined function or operator node in a parsing tree; this construct is also used for some non-functions like the assignment ':='. More...
 
struct  order_node_t
 An order-by node in a select. More...
 
struct  proc_node_t
 Procedure definition node. More...
 
struct  elsif_node_t
 elsif-element node More...
 
struct  if_node_t
 if-statement node More...
 
struct  while_node_t
 while-statement node More...
 
struct  for_node_t
 for-loop-statement node More...
 
struct  exit_node_t
 exit statement node More...
 
struct  return_node_t
 return-statement node More...
 
struct  assign_node_t
 Assignment statement node. More...
 
struct  col_assign_node_t
 Column assignment node. More...
 

Macros

#define PARS_INPUT   0
 
#define PARS_OUTPUT   1
 
#define PARS_NOT_PARAM   2
 
#define PARS_FUNC_ARITH   1
 Classes of functions. More...
 
#define PARS_FUNC_LOGICAL   2
 AND, OR, NOT. More...
 
#define PARS_FUNC_CMP   3
 comparison operators More...
 
#define PARS_FUNC_PREDEFINED   4
 TO_NUMBER, SUBSTR, ... More...
 
#define PARS_FUNC_AGGREGATE   5
 COUNT, DISTINCT, SUM. More...
 
#define PARS_FUNC_OTHER    6
 these are not real functions, \ e.g., := More...
 

Typedefs

typedef bool(* pars_user_func_cb_t) (void *arg, void *user_arg)
 Type of the user functions. More...
 

Functions

int yyparse (void)
 
void pars_init ()
 Initialize for the internal parser. More...
 
void pars_close ()
 Clean up the internal parser. More...
 
que_tpars_sql (pars_info_t *info, const char *str)
 Parses an SQL string returning the query graph. More...
 
int pars_get_lex_chars (char *buf, size_t max_size)
 Retrieves characters to the lexical analyzer. More...
 
void yyerror (const char *s)
 Called by yyparse on error. More...
 
sym_node_tpars_variable_declaration (sym_node_t *node, pars_res_word_t *type)
 Parses a variable declaration. More...
 
func_node_tpars_func (que_node_t *res_word, que_node_t *arg)
 Parses a function expression. More...
 
int pars_like_rebind (sym_node_t *node, const byte *ptr, ulint len)
 
func_node_tpars_op (int func, que_node_t *arg1, que_node_t *arg2)
 Parses an operator expression. More...
 
order_node_tpars_order_by (sym_node_t *column, pars_res_word_t *asc)
 Parses an ORDER BY clause. More...
 
sel_node_tpars_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. More...
 
que_node_tpars_cursor_declaration (sym_node_t *sym_node, sel_node_t *select_node)
 Parses a cursor declaration. More...
 
que_node_tpars_function_declaration (sym_node_t *sym_node)
 Parses a function declaration. More...
 
sel_node_tpars_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. More...
 
col_assign_node_tpars_column_assignment (sym_node_t *column, que_node_t *exp)
 Parses a column assignment in an update. More...
 
upd_node_tpars_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. More...
 
upd_node_tpars_update_statement (upd_node_t *node, sym_node_t *cursor_sym, que_node_t *search_cond)
 Parses an update or delete statement. More...
 
ins_node_tpars_insert_statement (sym_node_t *table_sym, que_node_t *values_list, sel_node_t *select)
 Parses an insert statement. More...
 
sym_node_tpars_parameter_declaration (sym_node_t *node, ulint param_type, pars_res_word_t *type)
 Parses a procedure parameter declaration. More...
 
elsif_node_tpars_elsif_element (que_node_t *cond, que_node_t *stat_list)
 Parses an elsif element. More...
 
if_node_tpars_if_statement (que_node_t *cond, que_node_t *stat_list, que_node_t *else_part)
 Parses an if-statement. More...
 
for_node_tpars_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. More...
 
while_node_tpars_while_statement (que_node_t *cond, que_node_t *stat_list)
 Parses a while-statement. More...
 
exit_node_tpars_exit_statement (void)
 Parses an exit statement. More...
 
return_node_tpars_return_statement (void)
 Parses a return-statement. More...
 
assign_node_tpars_assignment_statement (sym_node_t *var, que_node_t *val)
 Parses an assignment statement. More...
 
fetch_node_tpars_fetch_statement (sym_node_t *cursor, sym_node_t *into_list, sym_node_t *user_func)
 Parses a fetch statement. More...
 
open_node_tpars_open_statement (ulint type, sym_node_t *cursor)
 Parses an open or close cursor statement. More...
 
commit_node_tpars_commit_statement (void)
 Parses a commit statement. More...
 
roll_node_tpars_rollback_statement (void)
 Parses a rollback statement. More...
 
sym_node_tpars_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. More...
 
tab_node_tpars_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. More...
 
ind_node_tpars_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. More...
 
que_fork_tpars_procedure_definition (sym_node_t *sym_node, sym_node_t *param_list, que_node_t *stat_list)
 Parses a procedure definition. More...
 
que_thr_tpars_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 running. More...
 
pars_info_tpars_info_create (void)
 Create parser info struct. More...
 
void pars_info_free (pars_info_t *info)
 Free info struct and everything it contains. More...
 
void pars_info_add_literal (pars_info_t *info, const char *name, const void *address, ulint length, ulint type, ulint prtype)
 Add bound literal. More...
 
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). More...
 
void pars_info_bind_literal (pars_info_t *info, const char *name, const void *address, ulint length, ulint type, ulint prtype)
 
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. More...
 
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. More...
 
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. More...
 
void pars_info_bind_function (pars_info_t *info, const char *name, pars_user_func_cb_t func, void *arg)
 Add user function. More...
 
void pars_info_bind_id (pars_info_t *info, bool copy_name, const char *name, const char *id)
 Add bound id. More...
 
void pars_info_add_int4_literal (pars_info_t *info, const char *name, lint val)
 Equivalent to: More...
 
void pars_info_add_ull_literal (pars_info_t *info, const char *name, uint64_t val)
 Equivalent to: More...
 
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. More...
 
void pars_info_add_id (pars_info_t *info, const char *name, const char *id)
 Add bound id. More...
 
pars_bound_lit_tpars_info_get_bound_lit (pars_info_t *info, const char *name)
 Get bound literal with the given name. More...
 
pars_bound_id_tpars_info_get_bound_id (pars_info_t *info, const char *name)
 Get bound identifier with the given name. More...
 
void pars_lexer_close (void)
 Release any resources used by the lexer. More...
 

Variables

int yydebug
 If the following is set true, the parser will emit debugging information. More...
 
sym_tab_tpars_sym_tab_global
 
ib_mutex_t pars_mutex
 Mutex to protect the sql parser. More...
 
pars_res_word_t pars_to_binary_token
 
pars_res_word_t pars_substr_token
 
pars_res_word_t pars_concat_token
 
pars_res_word_t pars_length_token
 
pars_res_word_t pars_instr_token
 
pars_res_word_t pars_count_token
 
pars_res_word_t pars_sum_token
 
pars_res_word_t pars_distinct_token
 
pars_res_word_t pars_binary_token
 
pars_res_word_t pars_blob_token
 
pars_res_word_t pars_int_token
 
pars_res_word_t pars_bigint_token
 
pars_res_word_t pars_char_token
 
pars_res_word_t pars_float_token
 
pars_res_word_t pars_update_token
 
pars_res_word_t pars_asc_token
 
pars_res_word_t pars_desc_token
 
pars_res_word_t pars_open_token
 
pars_res_word_t pars_close_token
 
pars_res_word_t pars_share_token
 
pars_res_word_t pars_unique_token
 
pars_res_word_t pars_clustered_token
 
ulint pars_star_denoter
 Global variable used to denote the '*' in SELECT * FROM. More...
 

Detailed Description

SQL parser.

Created 11/19/1996 Heikki Tuuri

Macro Definition Documentation

◆ PARS_FUNC_AGGREGATE

#define PARS_FUNC_AGGREGATE   5

COUNT, DISTINCT, SUM.

◆ PARS_FUNC_ARITH

#define PARS_FUNC_ARITH   1

Classes of functions.

+, -, *, /

◆ PARS_FUNC_CMP

#define PARS_FUNC_CMP   3

comparison operators

◆ PARS_FUNC_LOGICAL

#define PARS_FUNC_LOGICAL   2

AND, OR, NOT.

◆ PARS_FUNC_OTHER

#define PARS_FUNC_OTHER    6

these are not real functions, \ e.g., :=

◆ PARS_FUNC_PREDEFINED

#define PARS_FUNC_PREDEFINED   4

TO_NUMBER, SUBSTR, ...

◆ PARS_INPUT

#define PARS_INPUT   0

◆ PARS_NOT_PARAM

#define PARS_NOT_PARAM   2

◆ PARS_OUTPUT

#define PARS_OUTPUT   1

Typedef Documentation

◆ pars_user_func_cb_t

typedef bool(* pars_user_func_cb_t) (void *arg, void *user_arg)

Type of the user functions.

The first argument is always InnoDB-supplied and varies in type, while 'user_arg' is a user-supplied argument. The meaning of the return type also varies. See the individual use cases, e.g. the FETCH statement, for details on them.

Function Documentation

◆ pars_assignment_statement()

assign_node_t * pars_assignment_statement ( sym_node_t var,
que_node_t val 
)

Parses an assignment statement.

Returns
assignment statement node in: value to assign
assignment statement node
Parameters
varin: variable to assign
valin: value to assign

◆ pars_close()

void pars_close ( )

Clean up the internal parser.

◆ pars_column_assignment()

col_assign_node_t * pars_column_assignment ( sym_node_t column,
que_node_t exp 
)

Parses a column assignment in an update.

Returns
column assignment node in: value to assign
column assignment node
Parameters
columnin: column to assign
expin: value to assign

◆ pars_column_def()

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.

Returns
column sym table node in: if not NULL, column is of type NOT NULL.
column sym table node
Parameters
sym_nodein: column node in the symbol table
typein: data type
lenin: length of column, or NULL
is_unsignedin: if not NULL, column is of type UNSIGNED.
is_not_nullin: if not NULL, column is of type NOT NULL.

◆ pars_commit_statement()

commit_node_t * pars_commit_statement ( void  )

Parses a commit statement.

Returns
own: commit node struct

◆ pars_complete_graph_for_exec()

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 running.

The fork created is of type QUE_FORK_MYSQL_INTERFACE.

Parameters
[in]noderoot node for an incomplete query graph, or NULL for dummy graph
[in]trxtransaction handle
[in]heapmemory heap from which allocated
[in]prebuiltrow prebuilt structure
Returns
query thread node to run

◆ pars_create_index()

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.

Parameters
[in]unique_defNot NULL if a unique index.
[in]clustered_defNot NULL if a clustered index.
[in]index_symIndex name node in the symbol table.
[in]table_symTable name node in the symbol table.
[in]column_listList of column names.
Returns
index create subgraph

◆ pars_create_table()

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.

Parameters
[in]table_symtable name node in the symbol table
[in]column_defslist of column names
[in]not_fit_in_memorya non-NULL pointer means that this is a table which in simulations should be simulated as not fitting in memory; thread is put to sleep to simulate disk accesses; NOTE that this flag is not stored to the data dictionary on disk, and the database will forget about non-NULL value if it has to reload the table definition from disk
[in]compactnon-NULL if COMPACT table
[in]block_sizeblock size (can be NULL)
Returns
table create subgraph

◆ pars_cursor_declaration()

que_node_t * pars_cursor_declaration ( sym_node_t sym_node,
sel_node_t select_node 
)

Parses a cursor declaration.

Returns
sym_node in: select node
sym_node
Parameters
sym_nodein: cursor id node in the symbol table
select_nodein: select node

◆ pars_elsif_element()

elsif_node_t * pars_elsif_element ( que_node_t cond,
que_node_t stat_list 
)

Parses an elsif element.

Returns
elsif node in: statement list
elsif node
Parameters
condin: if-condition
stat_listin: statement list

◆ pars_exit_statement()

exit_node_t * pars_exit_statement ( void  )

Parses an exit statement.

Returns
exit statement node

◆ pars_fetch_statement()

fetch_node_t * pars_fetch_statement ( sym_node_t cursor,
sym_node_t into_list,
sym_node_t user_func 
)

Parses a fetch statement.

into_list or user_func (but not both) must be non-NULL.

Returns
fetch statement node in: user function name, or NULL

into_list or user_func (but not both) must be non-NULL.

Returns
fetch statement node
Parameters
cursorin: cursor node
into_listin: variables to set, or NULL
user_funcin: user function name, or NULL

◆ pars_for_statement()

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.

Returns
for-statement node in: statement list
for-statement node
Parameters
loop_varin: loop variable
loop_start_limitin: loop start expression
loop_end_limitin: loop end expression
stat_listin: statement list

◆ pars_func()

func_node_t * pars_func ( que_node_t res_word,
que_node_t arg 
)

Parses a function expression.

Returns
own: function node in a query tree in: first argument in the argument list
own: function node in a query tree
Parameters
res_wordin: function name reserved word
argin: first argument in the argument list

◆ pars_function_declaration()

que_node_t * pars_function_declaration ( sym_node_t sym_node)

Parses a function declaration.

Returns
sym_node in: function id node in the symbol table
sym_node
Parameters
sym_nodein: function id node in the symbol table

◆ pars_get_lex_chars()

int pars_get_lex_chars ( char *  buf,
size_t  max_size 
)

Retrieves characters to the lexical analyzer.

Parameters
[in,out]bufBuffer where to copy
[in]max_sizeMaximum number of characters which fit in the buffer
Returns
number of characters copied or 0 on EOF

◆ pars_if_statement()

if_node_t * pars_if_statement ( que_node_t cond,
que_node_t stat_list,
que_node_t else_part 
)

Parses an if-statement.

Returns
if-statement node in: else-part statement list
if-statement node
Parameters
condin: if-condition
stat_listin: statement list
else_partin: else-part statement list or elsif element list

◆ pars_info_add_id()

void pars_info_add_id ( pars_info_t info,
const char *  name,
const char *  id 
)

Add bound id.

Parameters
[in]infoinfo struct
[in]namename
[in]idid

◆ pars_info_add_int4_literal()

void pars_info_add_int4_literal ( pars_info_t info,
const char *  name,
lint  val 
)

Equivalent to:

char buf[4]; mach_write_to_4(buf, val); pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);

except that the buffer is dynamically allocated from the info struct's heap. in: value

char buf[4]; mach_write_to_4(buf, val); pars_info_add_literal(info, name, buf, 4, DATA_INT, 0);

except that the buffer is dynamically allocated from the info struct's heap.

Parameters
infoin: info struct
namein: name
valin: value

◆ pars_info_add_literal()

void pars_info_add_literal ( pars_info_t info,
const char *  name,
const void *  address,
ulint  length,
ulint  type,
ulint  prtype 
)

Add bound literal.

Parameters
[in]infoInfo struct
[in]nameName
[in]addressAddress
[in]lengthLength of data
[in]typeType, e.g. data_fixbinary
[in]prtypePrecise type, e.g. data_unsigned

◆ pars_info_add_str_literal()

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).

Parameters
[in]infoInfo struct
[in]nameName
[in]strString
Parameters
infoin: info struct
namein: name
strin: string

◆ pars_info_add_ull_literal()

void pars_info_add_ull_literal ( pars_info_t info,
const char *  name,
uint64_t  val 
)

Equivalent to:

char buf[8]; mach_write_to_8(buf, val); pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0);

except that the buffer is dynamically allocated from the info struct's heap. in: value

char buf[8]; mach_write_to_8(buf, val); pars_info_add_literal(info, name, buf, 8, DATA_FIXBINARY, 0);

except that the buffer is dynamically allocated from the info struct's heap.

Parameters
infoin: info struct
namein: name
valin: value

◆ pars_info_bind_function()

void pars_info_bind_function ( pars_info_t info,
const char *  name,
pars_user_func_cb_t  func,
void *  arg 
)

Add user function.

Parameters
[in]infoInfo struct
[in]nameFunction name
[in]funcFunction address
[in]argUser-supplied argument

◆ pars_info_bind_id()

void pars_info_bind_id ( pars_info_t info,
bool  copy_name,
const char *  name,
const char *  id 
)

Add bound id.

Parameters
[in]infoinfo struct
[in]copy_namecopy name if true
[in]namename
[in]idid

◆ pars_info_bind_int4_literal()

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.

Parameters
[in]infoInfo struct
[in]nameName
[in]valValue

◆ pars_info_bind_int8_literal()

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.

Parameters
[in]infoInfo struct
[in]nameName
[in]valValue

◆ pars_info_bind_literal()

void pars_info_bind_literal ( pars_info_t info,
const char *  name,
const void *  address,
ulint  length,
ulint  type,
ulint  prtype 
)

◆ pars_info_bind_ull_literal()

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.

Parameters
[in]infoInfo struct
[in]nameName
[in]valValue

◆ pars_info_bind_varchar_literal()

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.

Parameters
[in]infoInfo struct
[in]nameName
[in]strString
[in]str_lenString length

◆ pars_info_create()

pars_info_t * pars_info_create ( void  )

Create parser info struct.

Returns
own: info struct

◆ pars_info_free()

void pars_info_free ( pars_info_t info)

Free info struct and everything it contains.

in, own: info struct

Parameters
infoin, own: info struct

◆ pars_info_get_bound_id()

pars_bound_id_t * pars_info_get_bound_id ( pars_info_t info,
const char *  name 
)

Get bound identifier with the given name.

Parameters
[in]infoinfo struct
[in]namebound id name to find
Returns
bound id, or NULL if not found

◆ pars_info_get_bound_lit()

pars_bound_lit_t * pars_info_get_bound_lit ( pars_info_t info,
const char *  name 
)

Get bound literal with the given name.

Returns
bound literal, or NULL if not found in: bound literal name to find
bound literal, or NULL if not found
Parameters
infoin: info struct
namein: bound literal name to find

◆ pars_init()

void pars_init ( )

Initialize for the internal parser.

◆ pars_insert_statement()

ins_node_t * pars_insert_statement ( sym_node_t table_sym,
que_node_t values_list,
sel_node_t select 
)

Parses an insert statement.

Returns
own: update node in a query tree in: select condition or NULL
own: update node in a query tree
Parameters
table_symin: table name node
values_listin: value expression list or NULL
selectin: select condition or NULL

◆ pars_lexer_close()

void pars_lexer_close ( void  )

Release any resources used by the lexer.

◆ pars_like_rebind()

int pars_like_rebind ( sym_node_t node,
const byte ptr,
ulint  len 
)

◆ pars_op()

func_node_t * pars_op ( int  func,
que_node_t arg1,
que_node_t arg2 
)

Parses an operator expression.

Returns
own: function node in a query tree in: second argument or NULL for an unary operator
own: function node in a query tree
Parameters
funcin: operator token code
arg1in: first argument
arg2in: second argument or NULL for an unary operator

◆ pars_open_statement()

open_node_t * pars_open_statement ( ulint  type,
sym_node_t cursor 
)

Parses an open or close cursor statement.

Returns
fetch statement node in: cursor node
fetch statement node
Parameters
typein: ROW_SEL_OPEN_CURSOR or ROW_SEL_CLOSE_CURSOR
cursorin: cursor node

◆ pars_order_by()

order_node_t * pars_order_by ( sym_node_t column,
pars_res_word_t asc 
)

Parses an ORDER BY clause.

Order by a single column only is supported.

Returns
own: order-by node in a query tree in: &pars_asc_token or pars_desc_token

Order by a single column only is supported.

Returns
own: order-by node in a query tree
Parameters
columnin: column name
ascin: &pars_asc_token or pars_desc_token

◆ pars_parameter_declaration()

sym_node_t * pars_parameter_declaration ( sym_node_t node,
ulint  param_type,
pars_res_word_t type 
)

Parses a procedure parameter declaration.

Returns
own: symbol table node of type SYM_VAR in: pointer to a type token
own: symbol table node of type SYM_VAR
Parameters
nodein: symbol table node allocated for the id of the parameter
param_typein: PARS_INPUT or PARS_OUTPUT
typein: pointer to a type token

◆ pars_procedure_definition()

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.

Returns
query fork node in: statement list
query fork node
Parameters
sym_nodein: procedure id node in the symbol table
param_listin: parameter declaration list
stat_listin: statement list

◆ pars_return_statement()

return_node_t * pars_return_statement ( void  )

Parses a return-statement.

Returns
return-statement node

◆ pars_rollback_statement()

roll_node_t * pars_rollback_statement ( void  )

Parses a rollback statement.

Returns
own: rollback node struct

◆ pars_select_list()

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.

Returns
own: select node in a query tree in: variables list or NULL
own: select node in a query tree
Parameters
select_listin: select list
into_listin: variables list or NULL

◆ pars_select_statement()

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 lock_shared,
order_node_t order_by 
)

Parses a select statement.

Returns
own: select node in a query tree in: NULL or an order-by node
own: select node in a query tree
Parameters
select_nodein: select node already containing the select list
table_listin: table list
search_condin: search condition or NULL
for_updatein: NULL or &pars_update_token
lock_sharedin: NULL or &pars_share_token
order_byin: NULL or an order-by node

◆ pars_sql()

que_t * pars_sql ( pars_info_t info,
const char *  str 
)

Parses an SQL string returning the query graph.

Returns
own: the query graph in: SQL string
own: the query graph
Parameters
infoin: extra information, or NULL
strin: SQL string

◆ pars_update_statement()

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.

Returns
own: update node in a query tree in: search condition or NULL
own: update node in a query tree
Parameters
nodein: update node
cursor_symin: pointer to a cursor entry in the symbol table or NULL
search_condin: search condition or NULL

◆ pars_update_statement_start()

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.

Returns
own: update node in a query tree in: column assignment list, NULL if delete
own: update node in a query tree
Parameters
is_deletein: true if delete
table_symin: table name node
col_assign_listin: column assignment list, NULL if delete

◆ pars_variable_declaration()

sym_node_t * pars_variable_declaration ( sym_node_t node,
pars_res_word_t type 
)

Parses a variable declaration.

Returns
own: symbol table node of type SYM_VAR in: pointer to a type token
own: symbol table node of type SYM_VAR
Parameters
nodein: symbol table node allocated for the id of the variable
typein: pointer to a type token

◆ pars_while_statement()

while_node_t * pars_while_statement ( que_node_t cond,
que_node_t stat_list 
)

Parses a while-statement.

Returns
while-statement node in: statement list
while-statement node
Parameters
condin: while-condition
stat_listin: statement list

◆ yyerror()

void yyerror ( const char *  s)

Called by yyparse on error.

in: error message string

Parameters
sin: error message string

◆ yyparse()

int yyparse ( void  )

Variable Documentation

◆ pars_asc_token

pars_res_word_t pars_asc_token
extern

◆ pars_bigint_token

pars_res_word_t pars_bigint_token
extern

◆ pars_binary_token

pars_res_word_t pars_binary_token
extern

◆ pars_blob_token

pars_res_word_t pars_blob_token
extern

◆ pars_char_token

pars_res_word_t pars_char_token
extern

◆ pars_close_token

pars_res_word_t pars_close_token
extern

◆ pars_clustered_token

pars_res_word_t pars_clustered_token
extern

◆ pars_concat_token

pars_res_word_t pars_concat_token
extern

◆ pars_count_token

pars_res_word_t pars_count_token
extern

◆ pars_desc_token

pars_res_word_t pars_desc_token
extern

◆ pars_distinct_token

pars_res_word_t pars_distinct_token
extern

◆ pars_float_token

pars_res_word_t pars_float_token
extern

◆ pars_instr_token

pars_res_word_t pars_instr_token
extern

◆ pars_int_token

pars_res_word_t pars_int_token
extern

◆ pars_length_token

pars_res_word_t pars_length_token
extern

◆ pars_mutex

ib_mutex_t pars_mutex
extern

Mutex to protect the sql parser.

◆ pars_open_token

pars_res_word_t pars_open_token
extern

◆ pars_share_token

pars_res_word_t pars_share_token
extern

◆ pars_star_denoter

ulint pars_star_denoter
extern

Global variable used to denote the '*' in SELECT * FROM.

◆ pars_substr_token

pars_res_word_t pars_substr_token
extern

◆ pars_sum_token

pars_res_word_t pars_sum_token
extern

◆ pars_sym_tab_global

sym_tab_t* pars_sym_tab_global
extern

◆ pars_to_binary_token

pars_res_word_t pars_to_binary_token
extern

◆ pars_unique_token

pars_res_word_t pars_unique_token
extern

◆ pars_update_token

pars_res_word_t pars_update_token
extern

◆ yydebug

int yydebug
extern

If the following is set true, the parser will emit debugging information.