summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/pars0sym.h
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2009-12-08 23:47:54 +0200
committerunknown <sanja@askmonty.org>2009-12-08 23:47:54 +0200
commit08e4635fbabb4a4bea3a9b44057a2cd9b12d580f (patch)
tree9de56c7859229fc3e173370d434fb24e1a367a1d /storage/xtradb/include/pars0sym.h
parente4e1ae0d13da399d53bd91df791b149f3eae796b (diff)
parent27f4f67bd2f35bf710f1a4e4ddde0e42738a195d (diff)
downloadmariadb-git-08e4635fbabb4a4bea3a9b44057a2cd9b12d580f.tar.gz
merge 5.1-> 5.2
Diffstat (limited to 'storage/xtradb/include/pars0sym.h')
-rw-r--r--storage/xtradb/include/pars0sym.h165
1 files changed, 85 insertions, 80 deletions
diff --git a/storage/xtradb/include/pars0sym.h b/storage/xtradb/include/pars0sym.h
index 69227a2917e..6d1a4b82414 100644
--- a/storage/xtradb/include/pars0sym.h
+++ b/storage/xtradb/include/pars0sym.h
@@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/******************************************************
+/**************************************************//**
+@file include/pars0sym.h
SQL parser symbol table
Created 12/15/1997 Heikki Tuuri
@@ -32,15 +33,15 @@ Created 12/15/1997 Heikki Tuuri
#include "pars0types.h"
#include "row0types.h"
-/**********************************************************************
-Creates a symbol table for a single stored procedure or query. */
+/******************************************************************//**
+Creates a symbol table for a single stored procedure or query.
+@return own: symbol table */
UNIV_INTERN
sym_tab_t*
sym_tab_create(
/*===========*/
- /* out, own: symbol table */
- mem_heap_t* heap); /* in: memory heap where to create */
-/**********************************************************************
+ mem_heap_t* heap); /*!< in: memory heap where to create */
+/******************************************************************//**
Frees the memory allocated dynamically AFTER parsing phase for variables
etc. in the symbol table. Does not free the mem heap where the table was
originally created. Frees also SQL explicit cursor definitions. */
@@ -48,71 +49,89 @@ UNIV_INTERN
void
sym_tab_free_private(
/*=================*/
- sym_tab_t* sym_tab); /* in, own: symbol table */
-/**********************************************************************
-Adds an integer literal to a symbol table. */
+ sym_tab_t* sym_tab); /*!< in, own: symbol table */
+/******************************************************************//**
+Adds an integer literal to a symbol table.
+@return symbol table node */
UNIV_INTERN
sym_node_t*
sym_tab_add_int_lit(
/*================*/
- /* out: symbol table node */
- sym_tab_t* sym_tab, /* in: symbol table */
- ulint val); /* in: integer value */
-/**********************************************************************
-Adds an string literal to a symbol table. */
+ sym_tab_t* sym_tab, /*!< in: symbol table */
+ ulint val); /*!< in: integer value */
+/******************************************************************//**
+Adds an string literal to a symbol table.
+@return symbol table node */
UNIV_INTERN
sym_node_t*
sym_tab_add_str_lit(
/*================*/
- /* out: symbol table node */
- sym_tab_t* sym_tab, /* in: symbol table */
- byte* str, /* in: string with no quotes around
+ sym_tab_t* sym_tab, /*!< in: symbol table */
+ byte* str, /*!< in: string with no quotes around
it */
- ulint len); /* in: string length */
-/**********************************************************************
-Add a bound literal to a symbol table. */
+ ulint len); /*!< in: string length */
+/******************************************************************//**
+Add a bound literal to a symbol table.
+@return symbol table node */
UNIV_INTERN
sym_node_t*
sym_tab_add_bound_lit(
/*==================*/
- /* out: symbol table node */
- sym_tab_t* sym_tab, /* in: symbol table */
- const char* name, /* in: name of bound literal */
- ulint* lit_type); /* out: type of literal (PARS_*_LIT) */
-/**********************************************************************
-Adds an SQL null literal to a symbol table. */
+ sym_tab_t* sym_tab, /*!< in: symbol table */
+ const char* name, /*!< in: name of bound literal */
+ ulint* lit_type); /*!< out: type of literal (PARS_*_LIT) */
+/******************************************************************//**
+Adds an SQL null literal to a symbol table.
+@return symbol table node */
UNIV_INTERN
sym_node_t*
sym_tab_add_null_lit(
/*=================*/
- /* out: symbol table node */
- sym_tab_t* sym_tab); /* in: symbol table */
-/**********************************************************************
-Adds an identifier to a symbol table. */
+ sym_tab_t* sym_tab); /*!< in: symbol table */
+/******************************************************************//**
+Adds an identifier to a symbol table.
+@return symbol table node */
UNIV_INTERN
sym_node_t*
sym_tab_add_id(
/*===========*/
- /* out: symbol table node */
- sym_tab_t* sym_tab, /* in: symbol table */
- byte* name, /* in: identifier name */
- ulint len); /* in: identifier length */
+ sym_tab_t* sym_tab, /*!< in: symbol table */
+ byte* name, /*!< in: identifier name */
+ ulint len); /*!< in: identifier length */
-/**********************************************************************
-Add a bound identifier to a symbol table. */
+/******************************************************************//**
+Add a bound identifier to a symbol table.
+@return symbol table node */
UNIV_INTERN
sym_node_t*
sym_tab_add_bound_id(
/*===========*/
- /* out: symbol table node */
- sym_tab_t* sym_tab, /* in: symbol table */
- const char* name); /* in: name of bound id */
+ sym_tab_t* sym_tab, /*!< in: symbol table */
+ const char* name); /*!< in: name of bound id */
+/** Index of sym_node_struct::field_nos corresponding to the clustered index */
#define SYM_CLUST_FIELD_NO 0
+/** Index of sym_node_struct::field_nos corresponding to a secondary index */
#define SYM_SEC_FIELD_NO 1
+/** Types of a symbol table node */
+enum sym_tab_entry {
+ SYM_VAR = 91, /*!< declared parameter or local
+ variable of a procedure */
+ SYM_IMPLICIT_VAR, /*!< storage for a intermediate result
+ of a calculation */
+ SYM_LIT, /*!< literal */
+ SYM_TABLE, /*!< database table name */
+ SYM_COLUMN, /*!< database table name */
+ SYM_CURSOR, /*!< named cursor */
+ SYM_PROCEDURE_NAME, /*!< stored procedure name */
+ SYM_INDEX, /*!< database index name */
+ SYM_FUNCTION /*!< user function name */
+};
+
+/** Symbol table node */
struct sym_node_struct{
- que_common_t common; /* node type:
+ que_common_t common; /*!< node type:
QUE_NODE_SYMBOL */
/* NOTE: if the data field in 'common.val' is not NULL and the symbol
table node is not for a temporary column, the memory for the value has
@@ -132,25 +151,25 @@ struct sym_node_struct{
TODO: It would be cleaner to make 'indirection' a boolean field and
always use 'alias' to refer to the primary node. */
- sym_node_t* indirection; /* pointer to
+ sym_node_t* indirection; /*!< pointer to
another symbol table
node which contains
the value for this
node, NULL otherwise */
- sym_node_t* alias; /* pointer to
+ sym_node_t* alias; /*!< pointer to
another symbol table
node for which this
node is an alias,
NULL otherwise */
- UT_LIST_NODE_T(sym_node_t) col_var_list; /* list of table
+ UT_LIST_NODE_T(sym_node_t) col_var_list; /*!< list of table
columns or a list of
input variables for an
explicit cursor */
- ibool copy_val; /* TRUE if a column
+ ibool copy_val; /*!< TRUE if a column
and its value should
be copied to dynamic
memory when fetched */
- ulint field_nos[2]; /* if a column, in
+ ulint field_nos[2]; /*!< if a column, in
the position
SYM_CLUST_FIELD_NO is
the field number in the
@@ -162,76 +181,62 @@ struct sym_node_struct{
use first; if not found
from the index, then
ULINT_UNDEFINED */
- ibool resolved; /* TRUE if the
+ ibool resolved; /*!< TRUE if the
meaning of a variable
or a column has been
resolved; for literals
this is always TRUE */
- ulint token_type; /* SYM_VAR, SYM_COLUMN,
- SYM_IMPLICIT_VAR,
- SYM_LIT, SYM_TABLE,
- SYM_CURSOR, ... */
- const char* name; /* name of an id */
- ulint name_len; /* id name length */
- dict_table_t* table; /* table definition
+ enum sym_tab_entry token_type; /*!< type of the
+ parsed token */
+ const char* name; /*!< name of an id */
+ ulint name_len; /*!< id name length */
+ dict_table_t* table; /*!< table definition
if a table id or a
column id */
- ulint col_no; /* column number if a
+ ulint col_no; /*!< column number if a
column */
- sel_buf_t* prefetch_buf; /* NULL, or a buffer
+ sel_buf_t* prefetch_buf; /*!< NULL, or a buffer
for cached column
values for prefetched
rows */
- sel_node_t* cursor_def; /* cursor definition
+ sel_node_t* cursor_def; /*!< cursor definition
select node if a
named cursor */
- ulint param_type; /* PARS_INPUT,
+ ulint param_type; /*!< PARS_INPUT,
PARS_OUTPUT, or
PARS_NOT_PARAM if not a
procedure parameter */
- sym_tab_t* sym_table; /* back pointer to
+ sym_tab_t* sym_table; /*!< back pointer to
the symbol table */
- UT_LIST_NODE_T(sym_node_t) sym_list; /* list of symbol
+ UT_LIST_NODE_T(sym_node_t) sym_list; /*!< list of symbol
nodes */
};
+/** Symbol table */
struct sym_tab_struct{
que_t* query_graph;
- /* query graph generated by the
+ /*!< query graph generated by the
parser */
const char* sql_string;
- /* SQL string to parse */
+ /*!< SQL string to parse */
size_t string_len;
- /* SQL string length */
+ /*!< SQL string length */
int next_char_pos;
- /* position of the next character in
+ /*!< position of the next character in
sql_string to give to the lexical
analyzer */
- pars_info_t* info; /* extra information, or NULL */
+ pars_info_t* info; /*!< extra information, or NULL */
sym_node_list_t sym_list;
- /* list of symbol nodes in the symbol
+ /*!< list of symbol nodes in the symbol
table */
UT_LIST_BASE_NODE_T(func_node_t)
func_node_list;
- /* list of function nodes in the
+ /*!< list of function nodes in the
parsed query graph */
- mem_heap_t* heap; /* memory heap from which we can
+ mem_heap_t* heap; /*!< memory heap from which we can
allocate space */
};
-/* Types of a symbol table entry */
-#define SYM_VAR 91 /* declared parameter or local
- variable of a procedure */
-#define SYM_IMPLICIT_VAR 92 /* storage for a intermediate result
- of a calculation */
-#define SYM_LIT 93 /* literal */
-#define SYM_TABLE 94 /* database table name */
-#define SYM_COLUMN 95 /* database table name */
-#define SYM_CURSOR 96 /* named cursor */
-#define SYM_PROCEDURE_NAME 97 /* stored procedure name */
-#define SYM_INDEX 98 /* database index name */
-#define SYM_FUNCTION 99 /* user function name */
-
#ifndef UNIV_NONINL
#include "pars0sym.ic"
#endif