Commit f015b825 authored by osku's avatar osku

Add support for UNSIGNED types in InnoDB's SQL parser.

Remove trailing whitespace from flex/bison input files.
parent 92436940
......@@ -114,7 +114,8 @@
PARS_COMMIT_TOKEN = 340,
PARS_ROLLBACK_TOKEN = 341,
PARS_WORK_TOKEN = 342,
NEG = 343
PARS_UNSIGNED_TOKEN = 343,
NEG = 344
};
#endif
#define PARS_INT_LIT 258
......@@ -202,7 +203,8 @@
#define PARS_COMMIT_TOKEN 340
#define PARS_ROLLBACK_TOKEN 341
#define PARS_WORK_TOKEN 342
#define NEG 343
#define PARS_UNSIGNED_TOKEN 343
#define NEG 344
......
......@@ -345,6 +345,8 @@ pars_column_def(
pars_res_word_t* type, /* in: data type */
sym_node_t* len, /* in: length of column, or
NULL */
void* is_unsigned, /* in: if not NULL, column
is of type UNSIGNED. */
void* is_not_null); /* in: if not NULL, column
is of type NOT NULL. */
/*************************************************************************
......
This diff is collapsed.
This diff is collapsed.
......@@ -114,7 +114,8 @@
PARS_COMMIT_TOKEN = 340,
PARS_ROLLBACK_TOKEN = 341,
PARS_WORK_TOKEN = 342,
NEG = 343
PARS_UNSIGNED_TOKEN = 343,
NEG = 344
};
#endif
#define PARS_INT_LIT 258
......@@ -202,7 +203,8 @@
#define PARS_COMMIT_TOKEN 340
#define PARS_ROLLBACK_TOKEN 341
#define PARS_WORK_TOKEN 342
#define NEG 343
#define PARS_UNSIGNED_TOKEN 343
#define NEG 344
......
......@@ -29,7 +29,7 @@ que_node_t */
int
yylex(void);
%}
%token PARS_INT_LIT
%token PARS_FLOAT_LIT
%token PARS_STR_LIT
......@@ -115,6 +115,7 @@ yylex(void);
%token PARS_COMMIT_TOKEN
%token PARS_ROLLBACK_TOKEN
%token PARS_WORK_TOKEN
%token PARS_UNSIGNED_TOKEN
%left PARS_AND_TOKEN PARS_OR_TOKEN
%left PARS_NOT_TOKEN
......@@ -262,14 +263,14 @@ select_item:
que_node_list_add_last(NULL,
$3)); }
;
select_item_list:
/* Nothing */ { $$ = NULL; }
| select_item { $$ = que_node_list_add_last(NULL, $1); }
| select_item_list ',' select_item
{ $$ = que_node_list_add_last($1, $3); }
;
select_list:
'*' { $$ = pars_select_list(&pars_star_denoter,
NULL); }
......@@ -377,7 +378,7 @@ delete_statement_positioned:
delete_statement_start
cursor_positioned { $$ = pars_update_statement($1, $2, NULL); }
;
row_printf_statement:
PARS_ROW_PRINTF_TOKEN select_statement
{ $$ = pars_row_printf_statement($2); }
......@@ -450,8 +451,8 @@ fetch_statement:
;
column_def:
PARS_ID_TOKEN type_name opt_column_len opt_not_null
{ $$ = pars_column_def($1, $2, $3, $4); }
PARS_ID_TOKEN type_name opt_column_len opt_unsigned opt_not_null
{ $$ = pars_column_def($1, $2, $3, $4, $5); }
;
column_def_list:
......@@ -466,6 +467,13 @@ opt_column_len:
{ $$ = $2; }
;
opt_unsigned:
/* Nothing */ { $$ = NULL; }
| PARS_UNSIGNED_TOKEN
{ $$ = &pars_int_token;
/* pass any non-NULL pointer */ }
;
opt_not_null:
/* Nothing */ { $$ = NULL; }
| PARS_NOT_TOKEN PARS_NULL_LIT
......@@ -479,7 +487,7 @@ not_fit_in_memory:
{ $$ = &pars_int_token;
/* pass any non-NULL pointer */ }
;
create_table:
PARS_CREATE_TOKEN PARS_TABLE_TOKEN
PARS_ID_TOKEN '(' column_def_list ')'
......@@ -550,8 +558,8 @@ variable_declaration:
;
variable_declaration_list:
/* Nothing */
| variable_declaration
/* Nothing */
| variable_declaration
| variable_declaration_list variable_declaration
;
......@@ -577,5 +585,5 @@ procedure_definition:
PARS_END_TOKEN { $$ = pars_procedure_definition($2, $4,
$10); }
;
%%
......@@ -96,7 +96,7 @@ string_append(
}
%}
DIGIT [0-9]
ID [a-z_A-Z][a-z_A-Z0-9]*
%x comment
......@@ -462,6 +462,10 @@ In the state 'quoted', only two actions are possible (defined below). */
return(PARS_WORK_TOKEN);
}
"UNSIGNED" {
return(PARS_UNSIGNED_TOKEN);
}
{ID} {
yylval = sym_tab_add_id(pars_sym_tab_global,
(byte*)yytext,
......
......@@ -1085,6 +1085,8 @@ pars_set_dfield_type(
pars_res_word_t* type, /* in: pointer to a type
token */
ulint len, /* in: length, or 0 */
ibool is_unsigned, /* in: if TRUE, column is
UNSIGNED. */
ibool is_not_null) /* in: if TRUE, column is
NOT NULL. */
{
......@@ -1094,6 +1096,10 @@ pars_set_dfield_type(
flags |= DATA_NOT_NULL;
}
if (is_unsigned) {
flags |= DATA_UNSIGNED;
}
if (type == &pars_int_token) {
if (len != 0) {
ut_error;
......@@ -1158,7 +1164,7 @@ pars_variable_declaration(
node->param_type = PARS_NOT_PARAM;
pars_set_dfield_type(que_node_get_val(node), type, 0, FALSE);
pars_set_dfield_type(que_node_get_val(node), type, 0, FALSE, FALSE);
return(node);
}
......@@ -1529,6 +1535,8 @@ pars_column_def(
pars_res_word_t* type, /* in: data type */
sym_node_t* len, /* in: length of column, or
NULL */
void* is_unsigned, /* in: if not NULL, column
is of type UNSIGNED. */
void* is_not_null) /* in: if not NULL, column
is of type NOT NULL. */
{
......@@ -1541,7 +1549,7 @@ pars_column_def(
}
pars_set_dfield_type(que_node_get_val(sym_node), type, len2,
is_not_null != NULL);
is_unsigned != NULL, is_not_null != NULL);
return(sym_node);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment