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
5eafe401
Commit
5eafe401
authored
Jun 20, 2002
by
bar@gw.udmsearch.izhnet.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New syntax for string with charset: _latin1'string'
Remove dupicated code
parent
8d6342af
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
40 deletions
+32
-40
sql/sql_lex.cc
sql/sql_lex.cc
+13
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+19
-39
No files found.
sql/sql_lex.cc
View file @
5eafe401
...
...
@@ -525,6 +525,18 @@ int yylex(void *arg)
yylval
->
lex_str
=
get_token
(
lex
,
length
);
if
(
lex
->
convert_set
)
lex
->
convert_set
->
convert
((
char
*
)
yylval
->
lex_str
.
str
,
lex
->
yytoklen
);
/*
Note: "SELECT _bla AS 'alias'"
_bla should be considered as a IDENT if charset haven't been found.
So we don't use MYF(MY_WME) with get_charset_by_name to avoid
producing an error.
*/
if
((
yylval
->
lex_str
.
str
[
0
]
==
'_'
)
&&
(
lex
->
charset
=
get_charset_by_name
(
yylval
->
lex_str
.
str
+
1
,
MYF
(
0
))))
return
(
UNDERSCORE_CHARSET
);
else
return
(
IDENT
);
case
STATE_IDENT_SEP
:
// Found ident and now '.'
...
...
sql/sql_yacc.yy
View file @
5eafe401
...
...
@@ -334,6 +334,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token UDF_SONAME_SYM
%token UDF_SYM
%token UNCOMMITTED_SYM
%token UNDERSCORE_CHARSET
%token UNION_SYM
%token UNIQUE_SYM
%token USAGE
...
...
@@ -525,7 +526,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <lex_str>
IDENT TEXT_STRING REAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM LEX_HOSTNAME
ULONGLONG_NUM field_ident select_alias ident ident_or_text
ULONGLONG_NUM field_ident select_alias ident ident_or_text
UNDERSCORE_CHARSET
%type <lex_str_ptr>
opt_table_alias
...
...
@@ -888,15 +889,9 @@ create_table_option:
Lex->create_info.table_charset=NULL;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
| CHARSET EQ
iden
t
| CHARSET EQ
charse
t
{
CHARSET_INFO *cs=get_charset_by_name($3.str,MYF(MY_WME));
if (!cs)
{
net_printf(¤t_thd->net,ER_UNKNOWN_CHARACTER_SET,$3);
YYABORT;
}
Lex->create_info.table_charset=cs;
Lex->create_info.table_charset=Lex->charset;
Lex->create_info.used_fields|= HA_CREATE_USED_CHARSET;
}
| INSERT_METHOD EQ merge_insert_types { Lex->create_info.merge_insert_method= $3; Lex->create_info.used_fields|= HA_CREATE_USED_INSERT_METHOD;}
...
...
@@ -1133,32 +1128,24 @@ attribute:
| UNIQUE_SYM KEY_SYM { Lex->type|= UNIQUE_KEY_FLAG; }
| COMMENT_SYM text_literal { Lex->comment= $2; };
opt_binary:
/* empty */ { Lex->charset=NULL; }
| BINARY { Lex->type|=BINARY_FLAG; Lex->charset=NULL; }
| CHAR_SYM SET ident
charset:
ident
{
CHARSET_INFO *cs=get_charset_by_name($3.str,MYF(MY_WME));
if (!cs)
if (!(Lex->charset=get_charset_by_name($1.str,MYF(0))))
{
net_printf(¤t_thd->net,ER_UNKNOWN_CHARACTER_SET,$3
);
net_printf(¤t_thd->net,ER_UNKNOWN_CHARACTER_SET,$1
);
YYABORT;
}
Lex->charset=cs;
};
opt_binary:
/* empty */ { Lex->charset=NULL; }
| BINARY { Lex->type|=BINARY_FLAG; Lex->charset=NULL; }
| CHAR_SYM SET charset {/* charset is already in Lex->charset */} ;
default_charset:
/* empty */ { Lex->charset=NULL; }
| DEFAULT CHAR_SYM SET ident
{
CHARSET_INFO *cs=get_charset_by_name($4.str,MYF(MY_WME));
if (!cs)
{
net_printf(¤t_thd->net,ER_UNKNOWN_CHARACTER_SET,$4);
YYABORT;
}
Lex->charset=cs;
};
| DEFAULT CHAR_SYM SET charset ;
references:
REFERENCES table_ident
...
...
@@ -1777,16 +1764,8 @@ simple_expr:
| CASE_SYM opt_expr WHEN_SYM when_list opt_else END
{ $$= new Item_func_case(* $4, $2, $5 ); }
| CONVERT_SYM '(' expr ',' cast_type ')' { $$= create_func_cast($3, $5); }
| CONVERT_SYM '(' expr USING IDENT ')'
{
CHARSET_INFO *cs=get_charset_by_name($5.str,MYF(MY_WME));
if (!cs)
{
net_printf(¤t_thd->net,ER_UNKNOWN_CHARACTER_SET,$5);
YYABORT;
}
$$= new Item_func_conv_charset($3,cs);
}
| CONVERT_SYM '(' expr USING charset ')'
{ $$= new Item_func_conv_charset($3,Lex->charset); }
| CONVERT_SYM '(' expr ',' expr ',' expr ')'
{
$$= new Item_func_conv_charset3($3,$7,$5);
...
...
@@ -3094,6 +3073,7 @@ opt_ignore_lines:
text_literal:
TEXT_STRING { $$ = new Item_string($1.str,$1.length,default_charset_info); }
| UNDERSCORE_CHARSET TEXT_STRING { $$ = new Item_string($2.str,$2.length,Lex->charset); }
| text_literal TEXT_STRING
{ ((Item_string*) $1)->append($2.str,$2.length); };
...
...
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