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
6814c8d3
Commit
6814c8d3
authored
Mar 20, 2003
by
bar@bar.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SELECT N'string'
parent
982c49dc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
2 deletions
+29
-2
include/m_ctype.h
include/m_ctype.h
+2
-1
mysys/charset.c
mysys/charset.c
+1
-0
sql/sql_lex.cc
sql/sql_lex.cc
+20
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-1
No files found.
include/m_ctype.h
View file @
6814c8d3
...
@@ -85,7 +85,8 @@ enum my_lex_states
...
@@ -85,7 +85,8 @@ enum my_lex_states
MY_LEX_LONG_COMMENT
,
MY_LEX_END_LONG_COMMENT
,
MY_LEX_COLON
,
MY_LEX_LONG_COMMENT
,
MY_LEX_END_LONG_COMMENT
,
MY_LEX_COLON
,
MY_LEX_SET_VAR
,
MY_LEX_USER_END
,
MY_LEX_HOSTNAME
,
MY_LEX_SKIP
,
MY_LEX_SET_VAR
,
MY_LEX_USER_END
,
MY_LEX_HOSTNAME
,
MY_LEX_SKIP
,
MY_LEX_USER_VARIABLE_DELIMITER
,
MY_LEX_SYSTEM_VAR
,
MY_LEX_USER_VARIABLE_DELIMITER
,
MY_LEX_SYSTEM_VAR
,
MY_LEX_IDENT_OR_KEYWORD
,
MY_LEX_IDENT_OR_HEX
,
MY_LEX_IDENT_OR_BIN
,
MY_LEX_IDENT_OR_KEYWORD
,
MY_LEX_IDENT_OR_HEX
,
MY_LEX_IDENT_OR_BIN
,
MY_LEX_IDENT_OR_NCHAR
,
MY_LEX_STRING_OR_DELIMITER
MY_LEX_STRING_OR_DELIMITER
};
};
...
...
mysys/charset.c
View file @
6814c8d3
...
@@ -110,6 +110,7 @@ static void init_state_maps(CHARSET_INFO *cs)
...
@@ -110,6 +110,7 @@ static void init_state_maps(CHARSET_INFO *cs)
/* Special handling of hex and binary strings */
/* Special handling of hex and binary strings */
state_map
[(
uchar
)
'x'
]
=
state_map
[(
uchar
)
'X'
]
=
(
uchar
)
MY_LEX_IDENT_OR_HEX
;
state_map
[(
uchar
)
'x'
]
=
state_map
[(
uchar
)
'X'
]
=
(
uchar
)
MY_LEX_IDENT_OR_HEX
;
state_map
[(
uchar
)
'b'
]
=
state_map
[(
uchar
)
'b'
]
=
(
uchar
)
MY_LEX_IDENT_OR_BIN
;
state_map
[(
uchar
)
'b'
]
=
state_map
[(
uchar
)
'b'
]
=
(
uchar
)
MY_LEX_IDENT_OR_BIN
;
state_map
[(
uchar
)
'n'
]
=
state_map
[(
uchar
)
'N'
]
=
(
uchar
)
MY_LEX_IDENT_OR_NCHAR
;
}
}
...
...
sql/sql_lex.cc
View file @
6814c8d3
...
@@ -463,6 +463,26 @@ int yylex(void *arg, void *yythd)
...
@@ -463,6 +463,26 @@ int yylex(void *arg, void *yythd)
lex
->
tok_start
=
lex
->
ptr
;
// Let tok_start point at next item
lex
->
tok_start
=
lex
->
ptr
;
// Let tok_start point at next item
return
((
int
)
c
);
return
((
int
)
c
);
case
MY_LEX_IDENT_OR_NCHAR
:
if
(
yyPeek
()
!=
'\''
)
{
// Found x'hex-number'
state
=
MY_LEX_IDENT
;
break
;
}
yyGet
();
// Skip '
while
((
c
=
yyGet
())
&&
(
c
!=
'\''
))
;
length
=
(
lex
->
ptr
-
lex
->
tok_start
);
// Length of hexnum+3
if
(
c
!=
'\''
)
{
return
(
ABORT_SYM
);
// Illegal hex constant
}
yyGet
();
// get_token makes an unget
yylval
->
lex_str
=
get_token
(
lex
,
length
);
yylval
->
lex_str
.
str
+=
2
;
// Skip x'
yylval
->
lex_str
.
length
-=
3
;
// Don't count x' and last '
lex
->
yytoklen
-=
3
;
return
(
NCHAR_STRING
);
case
MY_LEX_IDENT_OR_HEX
:
case
MY_LEX_IDENT_OR_HEX
:
if
(
yyPeek
()
==
'\''
)
if
(
yyPeek
()
==
'\''
)
{
// Found x'hex-number'
{
// Found x'hex-number'
...
...
sql/sql_yacc.yy
View file @
6814c8d3
...
@@ -291,6 +291,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -291,6 +291,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token NATURAL
%token NATURAL
%token NEW_SYM
%token NEW_SYM
%token NCHAR_SYM
%token NCHAR_SYM
%token NCHAR_STRING
%token NOT
%token NOT
%token NO_SYM
%token NO_SYM
%token NULL_SYM
%token NULL_SYM
...
@@ -561,6 +562,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -561,6 +562,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
IDENT TEXT_STRING REAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM LEX_HOSTNAME
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 IDENT_sys TEXT_STRING_sys TEXT_STRING_db
UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_db
NCHAR_STRING
%type <lex_str_ptr>
%type <lex_str_ptr>
opt_table_alias
opt_table_alias
...
@@ -3862,10 +3864,13 @@ text_literal:
...
@@ -3862,10 +3864,13 @@ text_literal:
thd->charset() : thd->db_charset;
thd->charset() : thd->db_charset;
$$ = new Item_string($1.str,$1.length,cs);
$$ = new Item_string($1.str,$1.length,cs);
}
}
| NCHAR_STRING
{ $$= new Item_string($1.str,$1.length,&my_charset_utf8); }
| UNDERSCORE_CHARSET TEXT_STRING
| UNDERSCORE_CHARSET TEXT_STRING
{ $$ = new Item_string($2.str,$2.length,Lex->charset,Item::COER_IMPLICIT); }
{ $$ = new Item_string($2.str,$2.length,Lex->charset,Item::COER_IMPLICIT); }
| text_literal TEXT_STRING_db
| text_literal TEXT_STRING_db
{ ((Item_string*) $1)->append($2.str,$2.length); };
{ ((Item_string*) $1)->append($2.str,$2.length); }
;
text_string:
text_string:
TEXT_STRING_db
TEXT_STRING_db
...
...
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