Drizzled Public API Documentation

pars0pars.h File Reference
#include "univ.i"
#include "que0types.h"
#include "usr0types.h"
#include "pars0types.h"
#include "row0types.h"
#include "trx0types.h"
#include "ut0vec.h"

Go to the source code of this file.

Classes

struct  pars_info_struct
 
struct  pars_user_func_struct
 
struct  pars_bound_lit_struct
 
struct  pars_bound_id_struct
 
struct  pars_res_word_struct
 
struct  func_node_struct
 
struct  order_node_struct
 
struct  proc_node_struct
 
struct  elsif_node_struct
 
struct  if_node_struct
 
struct  while_node_struct
 
struct  for_node_struct
 
struct  exit_node_struct
 
struct  return_node_struct
 
struct  assign_node_struct
 
struct  col_assign_node_struct
 

Macros

#define pars0pars_h
 
#define PARS_INPUT   0
 
#define PARS_OUTPUT   1
 
#define PARS_NOT_PARAM   2
 
#define PARS_FUNC_ARITH   1
 
#define PARS_FUNC_LOGICAL   2
 
#define PARS_FUNC_CMP   3
 
#define PARS_FUNC_PREDEFINED   4
 
#define PARS_FUNC_AGGREGATE   5
 
#define PARS_FUNC_OTHER   6
 

Typedefs

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

Functions

int yyparse (void)
 
UNIV_INTERN que_tpars_sql (pars_info_t *info, const char *str)
 
UNIV_INTERN void pars_get_lex_chars (char *buf, int *result, int max_size)
 
UNIV_INTERN void yyerror (const char *s)
 
UNIV_INTERN sym_node_tpars_variable_declaration (sym_node_t *node, pars_res_word_t *type)
 
UNIV_INTERN func_node_tpars_func (que_node_t *res_word, que_node_t *arg)
 
UNIV_INTERN func_node_tpars_op (int func, que_node_t *arg1, que_node_t *arg2)
 
UNIV_INTERN order_node_tpars_order_by (sym_node_t *column, pars_res_word_t *asc)
 
UNIV_INTERN sel_node_tpars_select_list (que_node_t *select_list, sym_node_t *into_list)
 
UNIV_INTERN que_node_t * pars_cursor_declaration (sym_node_t *sym_node, sel_node_t *select_node)
 
UNIV_INTERN que_node_t * pars_function_declaration (sym_node_t *sym_node)
 
UNIV_INTERN 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)
 
UNIV_INTERN col_assign_node_tpars_column_assignment (sym_node_t *column, que_node_t *exp)
 
UNIV_INTERN upd_node_tpars_update_statement_start (ibool is_delete, sym_node_t *table_sym, col_assign_node_t *col_assign_list)
 
UNIV_INTERN upd_node_tpars_update_statement (upd_node_t *node, sym_node_t *cursor_sym, que_node_t *search_cond)
 
UNIV_INTERN ins_node_tpars_insert_statement (sym_node_t *table_sym, que_node_t *values_list, sel_node_t *select)
 
UNIV_INTERN sym_node_tpars_parameter_declaration (sym_node_t *node, ulint param_type, pars_res_word_t *type)
 
UNIV_INTERN elsif_node_tpars_elsif_element (que_node_t *cond, que_node_t *stat_list)
 
UNIV_INTERN if_node_tpars_if_statement (que_node_t *cond, que_node_t *stat_list, que_node_t *else_part)
 
UNIV_INTERN 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)
 
UNIV_INTERN while_node_tpars_while_statement (que_node_t *cond, que_node_t *stat_list)
 
UNIV_INTERN exit_node_tpars_exit_statement (void)
 
UNIV_INTERN return_node_tpars_return_statement (void)
 
UNIV_INTERN func_node_tpars_procedure_call (que_node_t *res_word, que_node_t *args)
 
UNIV_INTERN assign_node_tpars_assignment_statement (sym_node_t *var, que_node_t *val)
 
UNIV_INTERN fetch_node_tpars_fetch_statement (sym_node_t *cursor, sym_node_t *into_list, sym_node_t *user_func)
 
UNIV_INTERN open_node_tpars_open_statement (ulint type, sym_node_t *cursor)
 
UNIV_INTERN row_printf_node_tpars_row_printf_statement (sel_node_t *sel_node)
 
UNIV_INTERN commit_node_tpars_commit_statement (void)
 
UNIV_INTERN roll_node_tpars_rollback_statement (void)
 
UNIV_INTERN 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)
 
UNIV_INTERN tab_node_tpars_create_table (sym_node_t *table_sym, sym_node_t *column_defs, void *not_fit_in_memory)
 
UNIV_INTERN 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)
 
UNIV_INTERN que_fork_tpars_procedure_definition (sym_node_t *sym_node, sym_node_t *param_list, que_node_t *stat_list)
 
UNIV_INTERN que_fork_tpars_stored_procedure_call (sym_node_t *sym_node)
 
UNIV_INTERN que_thr_tpars_complete_graph_for_exec (que_node_t *node, trx_t *trx, mem_heap_t *heap)
 
UNIV_INTERN pars_info_tpars_info_create (void)
 
UNIV_INTERN void pars_info_free (pars_info_t *info)
 
UNIV_INTERN void pars_info_add_literal (pars_info_t *info, const char *name, const void *address, ulint length, ulint type, ulint prtype)
 
UNIV_INTERN void pars_info_add_str_literal (pars_info_t *info, const char *name, const char *str)
 
UNIV_INTERN void pars_info_add_int4_literal (pars_info_t *info, const char *name, lint val)
 
UNIV_INTERN void pars_info_add_ull_literal (pars_info_t *info, const char *name, ib_uint64_t val)
 
UNIV_INTERN void pars_info_add_function (pars_info_t *info, const char *name, pars_user_func_cb_t func, void *arg)
 
UNIV_INTERN void pars_info_add_id (pars_info_t *info, const char *name, const char *id)
 
UNIV_INTERN pars_user_func_tpars_info_get_user_func (pars_info_t *info, const char *name)
 
UNIV_INTERN pars_bound_lit_tpars_info_get_bound_lit (pars_info_t *info, const char *name)
 
UNIV_INTERN pars_bound_id_tpars_info_get_bound_id (pars_info_t *info, const char *name)
 
UNIV_INTERN void pars_lexer_close (void)
 

Variables

int yydebug
 
sym_tab_tpars_sym_tab_global
 
pars_res_word_t pars_to_char_token
 
pars_res_word_t pars_to_number_token
 
pars_res_word_t pars_to_binary_token
 
pars_res_word_t pars_binary_to_number_token
 
pars_res_word_t pars_substr_token
 
pars_res_word_t pars_replstr_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_sysdate_token
 
pars_res_word_t pars_printf_token
 
pars_res_word_t pars_assert_token
 
pars_res_word_t pars_rnd_token
 
pars_res_word_t pars_rnd_str_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_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
 

Detailed Description

SQL parser

Created 11/19/1996 Heikki Tuuri

Definition in file pars0pars.h.

Macro Definition Documentation

#define PARS_FUNC_AGGREGATE   5

COUNT, DISTINCT, SUM

Definition at line 746 of file pars0pars.h.

#define PARS_FUNC_ARITH   1

Classes of functions +, -, *, /

Definition at line 742 of file pars0pars.h.

#define PARS_FUNC_CMP   3

comparison operators

Definition at line 744 of file pars0pars.h.

#define PARS_FUNC_LOGICAL   2

AND, OR, NOT

Definition at line 743 of file pars0pars.h.

#define PARS_FUNC_OTHER   6

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

Definition at line 747 of file pars0pars.h.

#define PARS_FUNC_PREDEFINED   4

TO_NUMBER, SUBSTR, ...

Definition at line 745 of file pars0pars.h.

Typedef Documentation

typedef void*(* 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.

Definition at line 42 of file pars0pars.h.

Function Documentation

UNIV_INTERN 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

Parses an assignment statement.

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

Definition at line 1404 of file pars0pars.cc.

References assign_node_struct::common, dtype_get_mtype(), sym_tab_struct::heap, mem_heap_alloc(), pars_assignment_statement(), que_node_get_val(), que_common_struct::type, ut_a, assign_node_struct::val, and assign_node_struct::var.

Referenced by pars_assignment_statement().

UNIV_INTERN 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

Parses a column assignment in an update.

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

Definition at line 863 of file pars0pars.cc.

References col_assign_node_struct::col, col_assign_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), pars_column_assignment(), que_common_struct::type, and col_assign_node_struct::val.

Referenced by pars_column_assignment().

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

Parses a column definition at a table creation.

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

Definition at line 1577 of file pars0pars.cc.

References eval_node_get_int_val(), pars_column_def(), and que_node_get_val().

Referenced by pars_column_def().

UNIV_INTERN commit_node_t* pars_commit_statement ( void  )

Parses a commit statement.

Returns
own: commit node struct

Definition at line 1555 of file pars0pars.cc.

References commit_node_create(), sym_tab_struct::heap, and pars_commit_statement().

Referenced by pars_commit_statement().

UNIV_INTERN que_thr_t* pars_complete_graph_for_exec ( que_node_t *  node,
trx_t trx,
mem_heap_t heap 
)

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.

Returns
query thread node to run in: memory heap from which allocated

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.

Returns
query thread node to run
Parameters
nodein: root node for an incomplete query graph
trxin: transaction handle
heapin: memory heap from which allocated

Definition at line 1909 of file pars0pars.cc.

References que_thr_struct::child, trx_struct::graph, pars_complete_graph_for_exec(), que_fork_create(), que_node_set_parent(), que_thr_create(), and que_fork_struct::trx.

Referenced by pars_complete_graph_for_exec(), row_create_index_for_mysql(), row_create_table_for_mysql(), row_get_prebuilt_update_vector(), row_merge_lock_table(), row_prebuild_sel_graph(), and trx_general_rollback_for_mysql().

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

Returns
index create subgraph in: list of column names

Parses an index creation operation.

Returns
index create subgraph
Parameters
unique_defin: not NULL if a unique index
clustered_defin: not NULL if a clustered index
index_symin: index name node in the symbol table
table_symin: table name node in the symbol table
column_listin: list of column names

Definition at line 1670 of file pars0pars.cc.

References DICT_CLUSTERED, DICT_UNIQUE, sym_tab_struct::heap, sym_node_struct::name, pars_create_index(), que_node_get_next(), que_node_list_get_len(), sym_node_struct::resolved, SYM_COLUMN, SYM_TABLE, and sym_node_struct::token_type.

Referenced by pars_create_index().

UNIV_INTERN tab_node_t* pars_create_table ( sym_node_t table_sym,
sym_node_t column_defs,
void *   
)

Parses a table creation operation.

Returns
table create subgraph in: a 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

Parses a table creation operation.

Returns
table create subgraph
Parameters
table_symin: table name node in the symbol table
column_defsin: list of column names

Definition at line 1608 of file pars0pars.cc.

References sym_tab_struct::heap, dict_table_struct::heap, dtype_struct::len, dtype_struct::mtype, sym_node_struct::name, pars_create_table(), dtype_struct::prtype, que_node_get_next(), que_node_get_val(), que_node_list_get_len(), sym_node_struct::resolved, SYM_COLUMN, SYM_TABLE, and sym_node_struct::token_type.

Referenced by pars_create_table().

UNIV_INTERN 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

Parses a cursor declaration.

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

Definition at line 798 of file pars0pars.cc.

References sym_node_struct::cursor_def, sel_node_struct::explicit_cursor, pars_cursor_declaration(), sym_node_struct::resolved, SEL_NODE_CLOSED, sel_node_struct::state, SYM_CURSOR, and sym_node_struct::token_type.

Referenced by pars_cursor_declaration().

UNIV_INTERN 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

Parses an elsif element.

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

Definition at line 1232 of file pars0pars.cc.

References elsif_node_struct::common, elsif_node_struct::cond, sym_tab_struct::heap, mem_heap_alloc(), pars_elsif_element(), elsif_node_struct::stat_list, and que_common_struct::type.

Referenced by pars_elsif_element().

UNIV_INTERN exit_node_t* pars_exit_statement ( void  )

Parses an exit statement.

Returns
exit statement node

Definition at line 1371 of file pars0pars.cc.

References exit_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), pars_exit_statement(), and que_common_struct::type.

Referenced by pars_exit_statement().

UNIV_INTERN 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

Parses a fetch statement. 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

Definition at line 1452 of file pars0pars.cc.

References sym_node_struct::alias, fetch_node_struct::common, sym_node_struct::cursor_def, fetch_node_struct::cursor_def, fetch_node_struct::func, sym_tab_struct::heap, sym_tab_struct::info, fetch_node_struct::into_list, mem_heap_alloc(), sym_node_struct::name, pars_fetch_statement(), pars_info_get_user_func(), que_node_list_get_len(), sel_node_struct::select_list, SYM_CURSOR, sym_node_struct::token_type, que_common_struct::type, and ut_a.

Referenced by pars_fetch_statement().

UNIV_INTERN 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

Parses a for-loop-statement.

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

Definition at line 1335 of file pars0pars.cc.

References for_node_struct::common, sym_tab_struct::heap, sym_node_struct::indirection, for_node_struct::loop_end_limit, for_node_struct::loop_start_limit, for_node_struct::loop_var, mem_heap_alloc(), pars_for_statement(), for_node_struct::stat_list, que_common_struct::type, and ut_a.

Referenced by pars_for_statement().

UNIV_INTERN 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

Parses a function expression.

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

Definition at line 181 of file pars0pars.cc.

References pars_func().

Referenced by pars_func(), and pars_procedure_call().

UNIV_INTERN 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

Parses a function declaration.

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

Definition at line 819 of file pars0pars.cc.

References sym_tab_struct::info, sym_node_struct::name, pars_function_declaration(), pars_info_get_user_func(), sym_node_struct::resolved, SYM_FUNCTION, sym_node_struct::token_type, and ut_a.

Referenced by pars_function_declaration().

UNIV_INTERN void pars_get_lex_chars ( char *  buf,
int *  result,
int  max_size 
)

Retrieves characters to the lexical analyzer. in: maximum number of characters which fit in the buffer

Retrieves characters to the lexical analyzer.

Parameters
bufin/out: buffer where to copy
resultout: number of characters copied or EOF
max_sizein: maximum number of characters which fit in the buffer

Definition at line 1793 of file pars0pars.cc.

References sym_tab_struct::next_char_pos, pars_get_lex_chars(), sym_tab_struct::sql_string, sym_tab_struct::string_len, and ut_memcpy().

Referenced by pars_get_lex_chars().

UNIV_INTERN 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

Parses an if-statement.

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

Definition at line 1257 of file pars0pars.cc.

References if_node_struct::common, if_node_struct::cond, if_node_struct::else_part, if_node_struct::elsif_list, sym_tab_struct::heap, mem_heap_alloc(), pars_if_statement(), que_node_get_next(), que_node_get_type(), elsif_node_struct::stat_list, if_node_struct::stat_list, and que_common_struct::type.

Referenced by pars_if_statement().

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

Add user function. in: user-supplied argument

Add user function.

Parameters
infoin: info struct
namein: function name
funcin: function address
argin: user-supplied argument

Definition at line 2067 of file pars0pars.cc.

References pars_user_func_struct::arg, pars_user_func_struct::func, pars_info_struct::funcs, pars_info_struct::heap, ib_vector_create(), ib_vector_push(), mem_heap_alloc(), pars_user_func_struct::name, pars_info_add_function(), pars_info_get_user_func(), and ut_ad.

Referenced by pars_info_add_function().

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

Add bound id. in: id

Add bound id.

Parameters
infoin: info struct
namein: name
idin: id

Definition at line 2095 of file pars0pars.cc.

References pars_info_struct::bound_ids, pars_info_struct::heap, ib_vector_create(), ib_vector_push(), pars_bound_id_struct::id, mem_heap_alloc(), pars_bound_id_struct::name, pars_info_add_id(), pars_info_get_bound_id(), and ut_ad.

Referenced by pars_info_add_id().

UNIV_INTERN 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

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.

Parameters
infoin: info struct
namein: name
valin: value

Definition at line 2027 of file pars0pars.cc.

References pars_info_struct::heap, mach_write_to_4(), mem_heap_alloc(), pars_info_add_int4_literal(), and pars_info_add_literal().

Referenced by pars_info_add_int4_literal(), and row_truncate_table_for_mysql().

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

Add bound literal. in: precise type, e.g. DATA_UNSIGNED

Add bound literal.

Parameters
infoin: info struct
namein: name
addressin: address
lengthin: length of data
typein: type, e.g. DATA_FIXBINARY
prtypein: precise type, e.g. DATA_UNSIGNED

Definition at line 1972 of file pars0pars.cc.

References pars_bound_lit_struct::address, pars_info_struct::bound_lits, pars_info_struct::heap, ib_vector_create(), ib_vector_push(), pars_bound_lit_struct::length, mem_heap_alloc(), pars_bound_lit_struct::name, pars_info_add_literal(), pars_info_get_bound_lit(), pars_bound_lit_struct::prtype, pars_bound_lit_struct::type, and ut_ad.

Referenced by pars_info_add_int4_literal(), pars_info_add_literal(), pars_info_add_str_literal(), and pars_info_add_ull_literal().

UNIV_INTERN 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). in: string

Equivalent to pars_info_add_literal(info, name, str, strlen(str), DATA_VARCHAR, DATA_ENGLISH).

Parameters
infoin: info struct
namein: name
strin: string

Definition at line 2006 of file pars0pars.cc.

References pars_info_add_literal(), and pars_info_add_str_literal().

Referenced by pars_info_add_str_literal(), row_discard_tablespace_for_mysql(), row_drop_table_for_mysql(), row_merge_rename_tables(), and row_rename_table_for_mysql().

UNIV_INTERN void pars_info_add_ull_literal ( pars_info_t info,
const char *  name,
ib_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

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.

Parameters
infoin: info struct
namein: name
valin: value

Definition at line 2050 of file pars0pars.cc.

References pars_info_struct::heap, mach_write_to_8(), mem_heap_alloc(), pars_info_add_literal(), and pars_info_add_ull_literal().

Referenced by pars_info_add_ull_literal(), row_discard_tablespace_for_mysql(), row_merge_drop_index(), row_merge_rename_indexes(), and row_truncate_table_for_mysql().

UNIV_INTERN void pars_info_free ( pars_info_t info)

Free info struct and everything it contains. in, own: info struct

Free info struct and everything it contains.

Parameters
infoin, own: info struct

Definition at line 1961 of file pars0pars.cc.

References pars_info_struct::heap, mem_heap_free, and pars_info_free().

Referenced by pars_info_free(), and que_graph_free().

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

Get bound id with the given name.

Returns
bound id, or NULL if not found in: bound id name to find

Get bound id with the given name.

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

Definition at line 2182 of file pars0pars.cc.

References pars_info_struct::bound_ids, ib_vector_get(), ib_vector_size(), pars_bound_id_struct::name, and pars_info_get_bound_id().

Referenced by pars_info_add_id(), pars_info_get_bound_id(), and sym_tab_add_bound_id().

UNIV_INTERN 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

Get bound literal with the given name.

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

Definition at line 2152 of file pars0pars.cc.

References pars_info_struct::bound_lits, ib_vector_get(), ib_vector_size(), pars_bound_lit_struct::name, and pars_info_get_bound_lit().

Referenced by pars_info_add_literal(), pars_info_get_bound_lit(), and sym_tab_add_bound_lit().

UNIV_INTERN pars_user_func_t* pars_info_get_user_func ( pars_info_t info,
const char *  name 
)

Get user function with the given name.

Returns
user func, or NULL if not found in: function name to find

Get user function with the given name.

Returns
user func, or NULL if not found
Parameters
infoin: info struct
namein: function name to find

Definition at line 2122 of file pars0pars.cc.

References pars_info_struct::funcs, ib_vector_get(), ib_vector_size(), pars_user_func_struct::name, and pars_info_get_user_func().

Referenced by pars_fetch_statement(), pars_function_declaration(), pars_info_add_function(), and pars_info_get_user_func().

UNIV_INTERN 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

Parses an insert statement.

Returns
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

Definition at line 1058 of file pars0pars.cc.

References sel_node_struct::common, dict_table_get_n_cols(), dict_table_get_n_user_cols(), dtuple_create(), sym_tab_struct::heap, ins_node_create(), ins_node_set_new_row(), que_common_struct::parent, pars_insert_statement(), que_node_list_get_len(), ins_node_struct::select, sel_node_struct::select_list, ins_node_struct::table, sym_node_struct::table, and ut_a.

Referenced by pars_insert_statement().

UNIV_INTERN void pars_lexer_close ( void  )

Release any resources used by the lexer.

Definition at line 2865 of file pars0lex.c.

References pars_lexer_close().

Referenced by innobase_shutdown_for_mysql(), and pars_lexer_close().

UNIV_INTERN 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

Parses an operator expression.

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

Definition at line 194 of file pars0pars.cc.

References pars_op(), and que_node_list_add_last().

Referenced by pars_op().

UNIV_INTERN 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

Parses an open or close cursor statement.

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

Definition at line 1503 of file pars0pars.cc.

References sym_node_struct::alias, open_node_struct::common, sym_node_struct::cursor_def, open_node_struct::cursor_def, sym_tab_struct::heap, mem_heap_alloc(), open_node_struct::op_type, pars_open_statement(), SYM_CURSOR, sym_node_struct::token_type, que_common_struct::type, and ut_a.

Referenced by pars_open_statement().

UNIV_INTERN 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

Parses an ORDER BY clause. 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

Definition at line 215 of file pars0pars.cc.

References order_node_struct::asc, order_node_struct::column, order_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), pars_order_by(), que_common_struct::type, and ut_a.

Referenced by pars_order_by().

UNIV_INTERN 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

Parses a procedure parameter declaration.

Returns
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

Definition at line 1189 of file pars0pars.cc.

References sym_node_struct::param_type, pars_parameter_declaration(), pars_variable_declaration(), and ut_a.

Referenced by pars_parameter_declaration().

UNIV_INTERN func_node_t* pars_procedure_call ( que_node_t *  res_word,
que_node_t *  args 
)

Parses a procedure call.

Returns
function node in: argument list

Parses a procedure call.

Returns
function node
Parameters
res_wordin: procedure name reserved word
argsin: argument list

Definition at line 1432 of file pars0pars.cc.

References pars_func(), and pars_procedure_call().

Referenced by pars_procedure_call().

UNIV_INTERN 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

Parses a procedure definition.

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

Definition at line 1727 of file pars0pars.cc.

References que_thr_struct::child, proc_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), proc_node_struct::param_list, que_common_struct::parent, pars_procedure_definition(), proc_node_struct::proc_id, que_fork_create(), que_thr_create(), sym_tab_struct::query_graph, sym_node_struct::resolved, proc_node_struct::stat_list, SYM_PROCEDURE_NAME, proc_node_struct::sym_tab, sym_node_struct::token_type, que_fork_struct::trx, and que_common_struct::type.

Referenced by pars_procedure_definition().

UNIV_INTERN return_node_t* pars_return_statement ( void  )

Parses a return-statement.

Returns
return-statement node

Definition at line 1387 of file pars0pars.cc.

References return_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), pars_return_statement(), and que_common_struct::type.

Referenced by pars_return_statement().

UNIV_INTERN roll_node_t* pars_rollback_statement ( void  )

Parses a rollback statement.

Returns
own: rollback node struct

Definition at line 1566 of file pars0pars.cc.

References sym_tab_struct::heap, pars_rollback_statement(), and roll_node_create().

Referenced by pars_rollback_statement().

UNIV_INTERN row_printf_node_t* pars_row_printf_statement ( sel_node_t sel_node)

Parses a row_printf-statement.

Returns
row_printf-statement node in: select node

Parses a row_printf-statement.

Returns
row_printf-statement node
Parameters
sel_nodein: select node

Definition at line 1533 of file pars0pars.cc.

References sel_node_struct::common, row_printf_node_struct::common, sym_tab_struct::heap, mem_heap_alloc(), que_common_struct::parent, pars_row_printf_statement(), row_printf_node_struct::sel_node, and que_common_struct::type.

Referenced by pars_row_printf_statement().

UNIV_INTERN 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

Parses a select list; creates a query graph node for the whole SELECT statement.

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

Definition at line 650 of file pars0pars.cc.

References sym_tab_struct::heap, sel_node_struct::into_list, pars_select_list(), sel_node_create(), and sel_node_struct::select_list.

Referenced by pars_select_list(), and pars_update_statement().

UNIV_INTERN 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

Parses a select statement.

Returns
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

Definition at line 715 of file pars0pars.cc.

References sel_node_struct::can_get_updated, order_node_struct::column, sel_node_struct::consistent_read, sel_node_struct::copy_variables, sel_node_struct::explicit_cursor, sel_node_struct::into_list, sel_node_struct::n_tables, opt_search_plan(), sel_node_struct::order_by, pars_select_statement(), pars_star_denoter, que_node_list_get_len(), sel_node_struct::read_view, sel_node_struct::row_lock_mode, sel_node_struct::search_cond, SEL_NODE_OPEN, sel_node_struct::select_list, sel_node_struct::set_x_locks, sel_node_struct::state, sel_node_struct::table_list, ut_a, and UT_LIST_INIT.

Referenced by pars_select_statement(), and pars_update_statement().

UNIV_INTERN 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

Parses an SQL string returning the query graph.

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

Definition at line 1858 of file pars0pars.cc.

References sym_tab_struct::info, que_fork_struct::info, mem_heap_create, mem_heap_dup(), dict_sys_struct::mutex, sym_tab_struct::next_char_pos, pars_sql(), sym_tab_struct::query_graph, sym_node_struct::resolved, sym_tab_struct::sql_string, sym_tab_struct::string_len, sym_tab_struct::sym_list, que_fork_struct::sym_tab, sym_tab_create(), ut_a, ut_ad, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.

Referenced by pars_sql(), and que_eval_sql().

UNIV_INTERN que_fork_t* pars_stored_procedure_call ( sym_node_t )

Parses a stored procedure call, when this is not within another stored procedure, that is, the client issues a procedure call directly. In MySQL/InnoDB, stored InnoDB procedures are invoked via the parsed procedure tree, not via InnoDB SQL, so this function is not used.

Returns
query graph in: stored procedure name

Parses a stored procedure call, when this is not within another stored procedure, that is, the client issues a procedure call directly. In MySQL/InnoDB, stored InnoDB procedures are invoked via the parsed procedure tree, not via InnoDB SQL, so this function is not used.

Returns
query graph

Definition at line 1777 of file pars0pars.cc.

References pars_stored_procedure_call(), and ut_error.

Referenced by pars_stored_procedure_call().

UNIV_INTERN upd_node_t* pars_update_statement ( upd_node_t node,
sym_node_t cursor_sym,
que_node_t *  search_cond 
)
UNIV_INTERN 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.

Returns
own: update node in a query tree in: column assignment list, NULL if delete

Parses a delete or update statement start.

Returns
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

Definition at line 839 of file pars0pars.cc.

References sym_tab_struct::heap, pars_update_statement_start(), and upd_node_create().

Referenced by pars_update_statement_start().

UNIV_INTERN 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

Parses a variable declaration.

Returns
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

Definition at line 1168 of file pars0pars.cc.

References sym_node_struct::param_type, pars_variable_declaration(), que_node_get_val(), sym_node_struct::resolved, SYM_VAR, and sym_node_struct::token_type.

Referenced by pars_parameter_declaration(), and pars_variable_declaration().

UNIV_INTERN 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

Parses a while-statement.

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

Definition at line 1308 of file pars0pars.cc.

References while_node_struct::common, while_node_struct::cond, sym_tab_struct::heap, mem_heap_alloc(), pars_while_statement(), while_node_struct::stat_list, and que_common_struct::type.

Referenced by pars_while_statement().

UNIV_INTERN void yyerror ( const char *  )

Called by yyparse on error. in: error message string

Called by yyparse on error.

Definition at line 1841 of file pars0pars.cc.

References ut_ad, and ut_error.

Variable Documentation

ulint pars_star_denoter

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

Definition at line 99 of file pars0pars.cc.

Referenced by pars_select_statement().

int yydebug
If the following is set TRUE, the parser will emit debugging

information

Definition at line 794 of file parser.cc.