MySQL 8.0.40
Source Code Documentation
pars0sym.h File Reference

SQL parser symbol table. More...

#include "dict0types.h"
#include "pars0types.h"
#include "que0types.h"
#include "row0types.h"
#include "univ.i"
#include "usr0types.h"

Go to the source code of this file.

Classes

struct  sym_node_t
 Symbol table node. More...
 
struct  sym_tab_t
 Symbol table. More...
 

Macros

#define SYM_CLUST_FIELD_NO   0
 Index of sym_node_t::field_nos corresponding to the clustered index. More...
 
#define SYM_SEC_FIELD_NO   1
 Index of sym_node_t::field_nos corresponding to a secondary index. More...
 

Enumerations

enum  sym_tab_entry {
  SYM_UNSET , SYM_VAR = 91 , SYM_IMPLICIT_VAR , SYM_LIT ,
  SYM_TABLE_REF_COUNTED , SYM_TABLE , SYM_COLUMN , SYM_CURSOR ,
  SYM_PROCEDURE_NAME , SYM_INDEX , SYM_FUNCTION
}
 Types of a symbol table node. More...
 

Functions

sym_tab_tsym_tab_create (mem_heap_t *heap)
 Creates a symbol table for a single stored procedure or query. More...
 
void sym_tab_free_private (sym_tab_t *sym_tab)
 Frees the memory allocated dynamically AFTER parsing phase for variables etc. More...
 
sym_node_tsym_tab_add_int_lit (sym_tab_t *sym_tab, ulint val)
 Adds an integer literal to a symbol table. More...
 
sym_node_tsym_tab_add_str_lit (sym_tab_t *sym_tab, const byte *str, ulint len)
 Adds an string literal to a symbol table. More...
 
sym_node_tsym_tab_add_bound_lit (sym_tab_t *sym_tab, const char *name, ulint *lit_type)
 Add a bound literal to a symbol table. More...
 
sym_node_tsym_tab_rebind_lit (sym_node_t *node, const void *address, ulint length)
 
sym_node_tsym_tab_add_null_lit (sym_tab_t *sym_tab)
 Adds an SQL null literal to a symbol table. More...
 
sym_node_tsym_tab_add_id (sym_tab_t *sym_tab, byte *name, ulint len)
 Adds an identifier to a symbol table. More...
 
sym_node_tsym_tab_add_bound_id (sym_tab_t *sym_tab, const char *name)
 Add a bound identifier to a symbol table. More...
 

Detailed Description

SQL parser symbol table.

Created 12/15/1997 Heikki Tuuri

Macro Definition Documentation

◆ SYM_CLUST_FIELD_NO

#define SYM_CLUST_FIELD_NO   0

Index of sym_node_t::field_nos corresponding to the clustered index.

◆ SYM_SEC_FIELD_NO

#define SYM_SEC_FIELD_NO   1

Index of sym_node_t::field_nos corresponding to a secondary index.

Enumeration Type Documentation

◆ sym_tab_entry

Types of a symbol table node.

Enumerator
SYM_UNSET 

Unset entry.

SYM_VAR 

declared parameter or local variable of a procedure

SYM_IMPLICIT_VAR 

storage for a intermediate result of a calculation

SYM_LIT 

literal

SYM_TABLE_REF_COUNTED 

database table name, ref counted.

Must be closed explicitly.

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

Function Documentation

◆ sym_tab_add_bound_id()

sym_node_t * sym_tab_add_bound_id ( sym_tab_t sym_tab,
const char *  name 
)

Add a bound identifier to a symbol table.

Returns
symbol table node in: name of bound id
symbol table node
Parameters
sym_tabin: symbol table
namein: name of bound id

◆ sym_tab_add_bound_lit()

sym_node_t * sym_tab_add_bound_lit ( sym_tab_t sym_tab,
const char *  name,
ulint lit_type 
)

Add a bound literal to a symbol table.

Returns
symbol table node out: type of literal (PARS_*_LIT)
symbol table node
Parameters
sym_tabin: symbol table
namein: name of bound literal
lit_typeout: type of literal (PARS_*_LIT)

◆ sym_tab_add_id()

sym_node_t * sym_tab_add_id ( sym_tab_t sym_tab,
byte name,
ulint  len 
)

Adds an identifier to a symbol table.

Returns
symbol table node in: identifier length
symbol table node
Parameters
sym_tabin: symbol table
namein: identifier name
lenin: identifier length

◆ sym_tab_add_int_lit()

sym_node_t * sym_tab_add_int_lit ( sym_tab_t sym_tab,
ulint  val 
)

Adds an integer literal to a symbol table.

Returns
symbol table node in: integer value
symbol table node
Parameters
sym_tabin: symbol table
valin: integer value

◆ sym_tab_add_null_lit()

sym_node_t * sym_tab_add_null_lit ( sym_tab_t sym_tab)

Adds an SQL null literal to a symbol table.

Returns
symbol table node in: symbol table
symbol table node
Parameters
sym_tabin: symbol table

◆ sym_tab_add_str_lit()

sym_node_t * sym_tab_add_str_lit ( sym_tab_t sym_tab,
const byte str,
ulint  len 
)

Adds an string literal to a symbol table.

Returns
symbol table node in: string length

Adds an string literal to a symbol table.

Returns
symbol table node
Parameters
sym_tabin: symbol table
strin: string with no quotes around it
lenin: string length

◆ sym_tab_create()

sym_tab_t * sym_tab_create ( mem_heap_t heap)

Creates a symbol table for a single stored procedure or query.

Returns
own: symbol table in: memory heap where to create
own: symbol table
Parameters
heapin: memory heap where to create

◆ sym_tab_free_private()

void sym_tab_free_private ( sym_tab_t sym_tab)

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. in, own: symbol table

in the symbol table. Does not free the mem heap where the table was originally created. Frees also SQL explicit cursor definitions.

Parameters
sym_tabin, own: symbol table

◆ sym_tab_rebind_lit()

sym_node_t * sym_tab_rebind_lit ( sym_node_t node,
const void *  address,
ulint  length 
)