Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e8b80a5a
Commit
e8b80a5a
authored
May 08, 2006
by
osku
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for bound ids in InnoDB's SQL parser.
parent
d35c4375
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
643 additions
and
488 deletions
+643
-488
include/pars0pars.h
include/pars0pars.h
+29
-0
include/pars0sym.h
include/pars0sym.h
+10
-0
include/pars0types.h
include/pars0types.h
+1
-0
pars/lexyy.c
pars/lexyy.c
+498
-488
pars/pars0lex.l
pars/pars0lex.l
+8
-0
pars/pars0pars.c
pars/pars0pars.c
+58
-0
pars/pars0sym.c
pars/pars0sym.c
+39
-0
No files found.
include/pars0pars.h
View file @
e8b80a5a
...
...
@@ -531,6 +531,16 @@ pars_info_add_function(
pars_user_func_cb_t
func
,
/* in: function address */
void
*
arg
);
/* in: user-supplied argument */
/********************************************************************
Add bound id. */
void
pars_info_add_id
(
/*=============*/
pars_info_t
*
info
,
/* in: info struct */
const
char
*
name
,
/* in: name */
const
char
*
id
);
/* in: id */
/********************************************************************
Get user function with the given name.*/
...
...
@@ -553,6 +563,17 @@ pars_info_get_bound_lit(
pars_info_t
*
info
,
/* in: info struct */
const
char
*
name
);
/* in: bound literal name to find */
/********************************************************************
Get bound id with the given name.*/
pars_bound_id_t
*
pars_info_get_bound_id
(
/*===================*/
/* out: bound id, or NULL if not
found */
pars_info_t
*
info
,
/* in: info struct */
const
char
*
name
);
/* in: bound id name to find */
/* Extra information supplied for pars_sql(). */
struct
pars_info_struct
{
...
...
@@ -562,6 +583,8 @@ struct pars_info_struct {
(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*) */
ibool
graph_owns_us
;
/* if TRUE (which is the default),
que_graph_free() will free us */
...
...
@@ -583,6 +606,12 @@ struct pars_bound_lit_struct {
ulint
prtype
;
/* precise type, e.g. DATA_UNSIGNED */
};
/* Bound id. */
struct
pars_bound_id_struct
{
const
char
*
name
;
/* name */
const
char
*
id
;
/* id */
};
/* Struct used to denote a reserved word in a parsing tree */
struct
pars_res_word_struct
{
int
code
;
/* the token code for the reserved word from
...
...
include/pars0sym.h
View file @
e8b80a5a
...
...
@@ -82,6 +82,16 @@ sym_tab_add_id(
byte
*
name
,
/* in: identifier name */
ulint
len
);
/* in: identifier length */
/**********************************************************************
Add a bound identifier to a symbol table. */
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 */
#define SYM_CLUST_FIELD_NO 0
#define SYM_SEC_FIELD_NO 1
...
...
include/pars0types.h
View file @
e8b80a5a
...
...
@@ -12,6 +12,7 @@ Created 1/11/1998 Heikki Tuuri
typedef
struct
pars_info_struct
pars_info_t
;
typedef
struct
pars_user_func_struct
pars_user_func_t
;
typedef
struct
pars_bound_lit_struct
pars_bound_lit_t
;
typedef
struct
pars_bound_id_struct
pars_bound_id_t
;
typedef
struct
sym_node_struct
sym_node_t
;
typedef
struct
sym_tab_struct
sym_tab_t
;
typedef
struct
pars_res_word_struct
pars_res_word_t
;
...
...
pars/lexyy.c
View file @
e8b80a5a
This diff is collapsed.
Click to expand it.
pars/pars0lex.l
View file @
e8b80a5a
...
...
@@ -84,6 +84,7 @@ string_append(
DIGIT [0-9]
ID [a-z_A-Z][a-z_A-Z0-9]*
BOUND_LIT \:[a-z_A-Z0-9]+
BOUND_ID \$[a-z_A-Z0-9]+
%x comment
%x quoted
...
...
@@ -111,6 +112,13 @@ BOUND_LIT \:[a-z_A-Z0-9]+
return(type);
}
{BOUND_ID} {
yylval = sym_tab_add_bound_id(pars_sym_tab_global,
yytext + 1);
return(PARS_ID_TOKEN);
}
"'" {
/* Quoted character string literals are handled in an explicit
start state 'quoted'. This state is entered and the buffer for
...
...
pars/pars0pars.c
View file @
e8b80a5a
...
...
@@ -1931,6 +1931,7 @@ pars_info_create(void)
info
->
heap
=
heap
;
info
->
funcs
=
NULL
;
info
->
bound_lits
=
NULL
;
info
->
bound_ids
=
NULL
;
info
->
graph_owns_us
=
TRUE
;
return
(
info
);
...
...
@@ -2070,6 +2071,32 @@ pars_info_add_function(
ib_vector_push
(
info
->
funcs
,
puf
);
}
/********************************************************************
Add bound id. */
void
pars_info_add_id
(
/*=============*/
pars_info_t
*
info
,
/* in: info struct */
const
char
*
name
,
/* in: name */
const
char
*
id
)
/* in: id */
{
pars_bound_id_t
*
bid
;
ut_ad
(
!
pars_info_get_bound_id
(
info
,
name
));
bid
=
mem_heap_alloc
(
info
->
heap
,
sizeof
(
*
bid
));
bid
->
name
=
name
;
bid
->
id
=
id
;
if
(
!
info
->
bound_ids
)
{
info
->
bound_ids
=
ib_vector_create
(
info
->
heap
,
8
);
}
ib_vector_push
(
info
->
bound_ids
,
bid
);
}
/********************************************************************
Get user function with the given name.*/
...
...
@@ -2131,3 +2158,34 @@ pars_info_get_bound_lit(
return
(
NULL
);
}
/********************************************************************
Get bound id with the given name.*/
pars_bound_id_t
*
pars_info_get_bound_id
(
/*===================*/
/* out: bound id, or NULL if not
found */
pars_info_t
*
info
,
/* in: info struct */
const
char
*
name
)
/* in: bound id name to find */
{
ulint
i
;
ib_vector_t
*
vec
;
if
(
!
info
||
!
info
->
bound_ids
)
{
return
(
NULL
);
}
vec
=
info
->
bound_ids
;
for
(
i
=
0
;
i
<
ib_vector_size
(
vec
);
i
++
)
{
pars_bound_id_t
*
bid
=
ib_vector_get
(
vec
,
i
);
if
(
strcmp
(
bid
->
name
,
name
)
==
0
)
{
return
(
bid
);
}
}
return
(
NULL
);
}
pars/pars0sym.c
View file @
e8b80a5a
...
...
@@ -304,3 +304,42 @@ sym_tab_add_id(
return
(
node
);
}
/**********************************************************************
Add a bound identifier to a symbol table. */
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_node_t
*
node
;
pars_bound_id_t
*
bid
;
bid
=
pars_info_get_bound_id
(
sym_tab
->
info
,
name
);
ut_a
(
bid
);
node
=
mem_heap_alloc
(
sym_tab
->
heap
,
sizeof
(
sym_node_t
));
node
->
common
.
type
=
QUE_NODE_SYMBOL
;
node
->
resolved
=
FALSE
;
node
->
indirection
=
NULL
;
node
->
name
=
mem_heap_strdup
(
sym_tab
->
heap
,
bid
->
id
);
node
->
name_len
=
strlen
(
node
->
name
);
UT_LIST_ADD_LAST
(
sym_list
,
sym_tab
->
sym_list
,
node
);
dfield_set_data
(
&
(
node
->
common
.
val
),
NULL
,
UNIV_SQL_NULL
);
node
->
common
.
val_buf_size
=
0
;
node
->
prefetch_buf
=
NULL
;
node
->
cursor_def
=
NULL
;
node
->
sym_table
=
sym_tab
;
return
(
node
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment