/** Type of the user functions. The first argument is always InnoDB-supplied andvariesintype,while'user_arg'isauser-suppliedargument.The meaningofthereturntypealsovaries.Seetheindividualusecases,e.g.
the FETCH statement, for details on them. */ typedef ibool (*pars_user_func_cb_t)(void* arg, void* user_arg);
/** If the following is set TRUE, the parser will emit debugging
information */ externint yydebug;
/* Global variable used while parsing a single procedure or query : the code is
NOT re-entrant */ extern sym_tab_t* pars_sym_tab_global;
/*************************************************************//**
Parses an SQL string returning the query graph.
@return own: the query graph */
que_t*
pars_sql( /*=====*/
pars_info_t* info, /*!< in: extra information, or NULL */ constchar* str); /*!< in: SQL string */ /*************************************************************//**
Retrieves characters to the lexical analyzer.
@return number of characters copied or0 on EOF */ int
pars_get_lex_chars( /*===============*/ char* buf, /*!< in/out: buffer where to copy */
size_t max_size); /*!< in: maximum number of characters which fit
in the buffer */ /*************************************************************//**
Called by yyparse on error. */ void
yyerror( /*====*/ constchar* s); /*!< in: error message string */ /*********************************************************************//**
Parses a variable declaration.
@return own: symbol table node of type SYM_VAR */
sym_node_t*
pars_variable_declaration( /*======================*/
sym_node_t* node, /*!< in: symbol table node allocated for the
id of the variable */
pars_res_word_t* type); /*!< in: pointer to a type token */ /*********************************************************************//**
Parses a function expression.
@return own: function node in a query tree */
func_node_t*
pars_func( /*======*/
que_node_t* res_word,/*!< in: function name reserved word */
que_node_t* arg); /*!< in: first argument in the argument list */ /************************************************************************* RebindaLIKEsearchstring.NOTE:Weignoreany'%'charactersembedded withinthesearchstring.
@return own: function node in a query tree */ int
pars_like_rebind( /*=============*/
sym_node_t* node, /* in: The search string node.*/ const byte* ptr, /* in: literal to (re) bind */
ulint len); /* in: length of literal to (re) bind*/ /*********************************************************************//**
Parses an operator expression.
@return own: function node in a query tree */
func_node_t*
pars_op( /*====*/ int func, /*!< in: operator token code */
que_node_t* arg1, /*!< in: first argument */
que_node_t* arg2); /*!< in: second argument or NULL for an unary
operator */ /*********************************************************************//**
Parses an ORDER BY clause. Order by a single column only is supported.
@return own: order-by node in a query tree */
order_node_t*
pars_order_by( /*==========*/
sym_node_t* column, /*!< in: column name */
pars_res_word_t* asc); /*!< in: &pars_asc_token or pars_desc_token */ /*********************************************************************//**
Parses a select list; creates a query graph node for the whole SELECT
statement.
@return own: select node in a query tree */
sel_node_t*
pars_select_list( /*=============*/
que_node_t* select_list, /*!< in: select list */
sym_node_t* into_list); /*!< in: variables list or NULL */ /*********************************************************************//**
Parses a cursor declaration.
@return sym_node */
que_node_t*
pars_cursor_declaration( /*====================*/
sym_node_t* sym_node, /*!< in: cursor id node in the symbol
table */
sel_node_t* select_node); /*!< in: select node */ /*********************************************************************//**
Parses a function declaration.
@return sym_node */
que_node_t*
pars_function_declaration( /*======================*/
sym_node_t* sym_node); /*!< in: function id node in the symbol
table */ /*********************************************************************//**
Parses a select statement.
@return own: select node in a query tree */
sel_node_t*
pars_select_statement( /*==================*/
sel_node_t* select_node, /*!< in: select node already containing
the select list */
sym_node_t* table_list, /*!< in: table list */
que_node_t* search_cond, /*!< in: search condition or NULL */
pars_res_word_t* for_update, /*!< in: NULL or &pars_update_token */
pars_res_word_t* consistent_read,/*!< in: NULL or
&pars_consistent_token */
order_node_t* order_by); /*!< in: NULL or an order-by node */ /*********************************************************************//**
Parses a column assignment in an update.
@return column assignment node */
col_assign_node_t*
pars_column_assignment( /*===================*/
sym_node_t* column, /*!< in: column to assign */
que_node_t* exp); /*!< in: value to assign */ /*********************************************************************//**
Parses a deleteor update statement start.
@return own: update node in a query tree */
upd_node_t*
pars_update_statement_start( /*========================*/
ibool is_delete, /*!< in: TRUE if delete */
sym_node_t* table_sym, /*!< in: table name node */
col_assign_node_t* col_assign_list);/*!< in: column assignment list, NULL
if delete */ /*********************************************************************//**
Parses an update ordelete statement.
@return own: update node in a query tree */
upd_node_t*
pars_update_statement( /*==================*/
upd_node_t* node, /*!< in: update node */
sym_node_t* cursor_sym, /*!< in: pointer to a cursor entry in
the symbol table or NULL */
que_node_t* search_cond); /*!< in: search condition or NULL */ /*********************************************************************//**
Parses an insert statement.
@return own: update node in a query tree */
ins_node_t*
pars_insert_statement( /*==================*/
sym_node_t* table_sym, /*!< in: table name node */
que_node_t* values_list, /*!< in: value expression list or NULL */
sel_node_t* select); /*!< in: select condition or NULL */ /*********************************************************************//**
Parses an elsif element.
@return elsif node */
elsif_node_t*
pars_elsif_element( /*===============*/
que_node_t* cond, /*!< in: if-condition */
que_node_t* stat_list); /*!< in: statement list */ /*********************************************************************//**
Parses an if-statement.
@returnif-statement node */
if_node_t*
pars_if_statement( /*==============*/
que_node_t* cond, /*!< in: if-condition */
que_node_t* stat_list, /*!< in: statement list */
que_node_t* else_part); /*!< in: else-part statement list */ /*********************************************************************//**
Parses a for-loop-statement.
@returnfor-statement node */
for_node_t*
pars_for_statement( /*===============*/
sym_node_t* loop_var, /*!< in: loop variable */
que_node_t* loop_start_limit,/*!< in: loop start expression */
que_node_t* loop_end_limit, /*!< in: loop end expression */
que_node_t* stat_list); /*!< in: statement list */ /*********************************************************************//**
Parses a while-statement.
@returnwhile-statement node */
while_node_t*
pars_while_statement( /*=================*/
que_node_t* cond, /*!< in: while-condition */
que_node_t* stat_list); /*!< in: statement list */ /*********************************************************************//**
Parses an exit statement.
@returnexit statement node */
exit_node_t*
pars_exit_statement(void); /*=====================*/ /*********************************************************************//**
Parses a return-statement.
@returnreturn-statement node */
return_node_t*
pars_return_statement(void); /*=======================*/ /*********************************************************************//**
Parses a procedure call.
@return function node */
func_node_t*
pars_procedure_call( /*================*/
que_node_t* res_word,/*!< in: procedure name reserved word */
que_node_t* args); /*!< in: argument list */ /*********************************************************************//**
Parses an assignment statement.
@return assignment statement node */
assign_node_t*
pars_assignment_statement( /*======================*/
sym_node_t* var, /*!< in: variable to assign */
que_node_t* val); /*!< in: value to assign */ /*********************************************************************//**
Parses a fetch statement. into_list or user_func (but not both) must be
non-NULL.
@return fetch statement node */
fetch_node_t*
pars_fetch_statement( /*=================*/
sym_node_t* cursor, /*!< in: cursor node */
sym_node_t* into_list, /*!< in: variables to set, or NULL */
sym_node_t* user_func); /*!< in: user function name, or NULL */ /*********************************************************************//**
Parses an open or close cursor statement.
@return fetch statement node */
open_node_t*
pars_open_statement( /*================*/
ulint type, /*!< in: ROW_SEL_OPEN_CURSOR
or ROW_SEL_CLOSE_CURSOR */
sym_node_t* cursor); /*!< in: cursor node */ /*********************************************************************//**
Parses a row_printf-statement.
@return row_printf-statement node */
row_printf_node_t*
pars_row_printf_statement( /*======================*/
sel_node_t* sel_node); /*!< in: select node */ /*********************************************************************//**
Parses a commit statement.
@return own: commit node struct */
commit_node_t*
pars_commit_statement(void); /*=======================*/ /*********************************************************************//**
Parses a rollback statement.
@return own: rollback node struct */
roll_node_t*
pars_rollback_statement(void); /*=========================*/ /*********************************************************************//**
Parses a column definition at a table creation.
@return column sym table node */
sym_node_t*
pars_column_def( /*============*/
sym_node_t* sym_node, /*!< in: column node in the
symbol table */
pars_res_word_t* type, /*!< in: data type */
sym_node_t* len, /*!< in: length of column, or
NULL */ void* is_not_null); /*!< in: if not NULL, column
is of type NOT NULL. */ /*********************************************************************//**
Parses a table creation operation.
@return table create subgraph */
tab_node_t*
pars_create_table( /*==============*/
sym_node_t* table_sym, /*!< in: table name node in the symbol
table */
sym_node_t* column_defs); /*!< in: list of column names */ /*********************************************************************//**
Parses an index creation operation.
@return index create subgraph */
ind_node_t*
pars_create_index( /*==============*/
pars_res_word_t* unique_def, /*!< in: not NULL if a unique index */
pars_res_word_t* clustered_def, /*!< in: not NULL if a clustered index */
sym_node_t* index_sym, /*!< in: index name node in the symbol
table */
sym_node_t* table_sym, /*!< in: table name node in the symbol
table */
sym_node_t* column_list); /*!< in: list of column names */ /*********************************************************************//**
Parses a procedure definition.
@return query fork node */
que_fork_t*
pars_procedure_definition( /*======================*/
sym_node_t* sym_node, /*!< in: procedure id node in the symbol
table */
que_node_t* stat_list); /*!< in: statement list */
/** Completes a query graph by adding query thread and fork nodes aboveitandpreparesthegraphforrunning. @param[in]noderootnodeforanincompletequery graph,orNULLfordummygraph @param[in]trxtransactionhandle @param[in]heapmemoryheapfromwhichallocated @param[in]prebuiltrowprebuiltstructure
@return query thread node to run */
que_thr_t*
pars_complete_graph_for_exec(
que_node_t* node,
trx_t* trx,
mem_heap_t* heap,
row_prebuilt_t* prebuilt)
MY_ATTRIBUTE((nonnull(2,3), warn_unused_result));
/****************************************************************//**
Create parser info struct.
@return own: info struct */
pars_info_t*
pars_info_create(void); /*==================*/
/****************************************************************//**
Add bound literal. */ void
pars_info_add_literal( /*==================*/
pars_info_t* info, /*!< in: info struct */ constchar* name, /*!< in: name */ constvoid* address, /*!< in: address */
ulint length, /*!< in: length of data */
ulint type, /*!< in: type, e.g. DATA_FIXBINARY */
ulint prtype); /*!< in: precise type, e.g.
DATA_UNSIGNED */
/****************************************************************//**
Equivalent to pars_info_add_literal(info, name, str, strlen(str),
DATA_VARCHAR, DATA_ENGLISH). */ void
pars_info_add_str_literal( /*======================*/
pars_info_t* info, /*!< in: info struct */ constchar* name, /*!< in: name */ constchar* str); /*!< in: string */ /******************************************************************** Iftheliteralvaluealreadyexiststhenitrebindsotherwiseit
creates a new entry.*/ void
pars_info_bind_literal( /*===================*/
pars_info_t* info, /* in: info struct */ constchar* name, /* in: name */ constvoid* address, /* in: address */
ulint length, /* in: length of data */
ulint type, /* in: type, e.g. DATA_FIXBINARY */
ulint prtype); /* in: precise type, e.g. */ /******************************************************************** Iftheliteralvaluealreadyexiststhenitrebindsotherwiseit
creates a new entry.*/ void
pars_info_bind_varchar_literal( /*===========================*/
pars_info_t* info, /*!< in: info struct */ constchar* name, /*!< in: name */ const byte* str, /*!< in: string */
ulint str_len); /*!< in: string length */ /****************************************************************//**
Equivalent to:
except that the buffer is dynamically allocated from the info struct's
heap. */ void
pars_info_add_int4_literal( /*=======================*/
pars_info_t* info, /*!< in: info struct */ constchar* name, /*!< in: name */
ulint val); /*!< in: value */
/****************************************************************//**
Equivalent to:
except that the buffer is dynamically allocated from the info struct's
heap. */ void
pars_info_add_ull_literal( /*======================*/
pars_info_t* info, /*!< in: info struct */ constchar* name, /*!< in: name */
ib_uint64_t val); /*!< in: value */
/****************************************************************//** If the literal value already exists then it rebinds otherwise it
creates a new entry. */ void
pars_info_bind_ull_literal( /*=======================*/
pars_info_t* info, /*!< in: info struct */ constchar* name, /*!< in: name */ const ib_uint64_t* val) /*!< in: value */
MY_ATTRIBUTE((nonnull));
/****************************************************************//**
Get bound literal with the given name.
@return bound literal, or NULL ifnot found */
pars_bound_lit_t*
pars_info_get_bound_lit( /*====================*/
pars_info_t* info, /*!< in: info struct */ constchar* name); /*!< in: bound literal name to find */
/****************************************************************//**
Get bound id with the given name.
@return bound id, or NULL ifnot found */
pars_bound_id_t*
pars_info_get_bound_id( /*===================*/
pars_info_t* info, /*!< in: info struct */ constchar* name); /*!< in: bound id name to find */
/******************************************************************//**
Release any resources used by the lexer. */ void
pars_lexer_close(void); /*==================*/
/** Extra information supplied for pars_sql(). */ struct pars_info_t {
mem_heap_t* heap; /*!< our own memory heap */
ib_vector_t* funcs; /*!< user functions, or NUll
(pars_user_func_t*) */
ib_vector_t* bound_lits; /*!< bound literals, or NULL
(pars_bound_lit_t*) */
ib_vector_t* bound_ids; /*!< bound ids, or NULL
(pars_bound_id_t*) */
};
/** Struct used to denote a reserved word in a parsing tree */ struct pars_res_word_t{ int code; /*!< the token code for the reserved word from
pars0grm.h */
};
/** A predefined function or operator node in a parsing tree; this construct
is also used for some non-functions like the assignment ':=' */ struct func_node_t{
que_common_t common; /*!< type: QUE_NODE_FUNC */ int func; /*!< token code of the function name */
ulint fclass; /*!< class of the function */
que_node_t* args; /*!< argument(s) of the function */
UT_LIST_NODE_T(func_node_t) cond_list; /*!< list of comparison conditions; defined onlyforcomparisonoperatornodesexcept,
presently, for OPT_SCROLL_TYPE ones */
UT_LIST_NODE_T(func_node_t) func_node_list; /*!< list of function nodes in a parsed
query graph */
};
/** An order-by node in a select */ struct order_node_t{
que_common_t common; /*!< type: QUE_NODE_ORDER */
sym_node_t* column; /*!< order-by column */
ibool asc; /*!< TRUE if ascending, FALSE if descending */
};
/** Procedure definition node */ struct proc_node_t{
que_common_t common; /*!< type: QUE_NODE_PROC */
sym_node_t* proc_id; /*!< procedure name symbol in the symbol
table of this same procedure */
que_node_t* stat_list; /*!< statement list */
sym_tab_t* sym_tab; /*!< symbol table of this procedure */
};
/** for-loop-statement node */ struct for_node_t{
que_common_t common; /*!< type: QUE_NODE_FOR */
sym_node_t* loop_var; /*!< loop variable: this is the dereferencedsymbolfromthe variabledeclarations,notthe symboloccurrenceintheforloop
definition */
que_node_t* loop_start_limit;/*!< initial value of loop variable */
que_node_t* loop_end_limit; /*!< end value of loop variable */
lint loop_end_value; /*!< evaluated value for the end value: itiscalculatedonlywhentheloop isentered,andwillnotchangewithin
the loop */
que_node_t* stat_list; /*!< statement list */
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.