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
b96041ff
Commit
b96041ff
authored
Dec 01, 2002
by
monty@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed that one can use ` in identifiers: CREATE TABLE `fo``a` ...
Added BOOLEAN as synonym for tinyint
parent
27dc59e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
6 deletions
+45
-6
sql/sql_lex.cc
sql/sql_lex.cc
+43
-6
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-0
No files found.
sql/sql_lex.cc
View file @
b96041ff
...
@@ -216,7 +216,7 @@ static int find_keyword(LEX *lex, uint len, bool function)
...
@@ -216,7 +216,7 @@ static int find_keyword(LEX *lex, uint len, bool function)
/* make a copy of token before ptr and set yytoklen */
/* make a copy of token before ptr and set yytoklen */
LEX_STRING
get_token
(
LEX
*
lex
,
uint
length
)
static
LEX_STRING
get_token
(
LEX
*
lex
,
uint
length
)
{
{
LEX_STRING
tmp
;
LEX_STRING
tmp
;
yyUnget
();
// ptr points now after last token char
yyUnget
();
// ptr points now after last token char
...
@@ -225,8 +225,27 @@ LEX_STRING get_token(LEX *lex,uint length)
...
@@ -225,8 +225,27 @@ LEX_STRING get_token(LEX *lex,uint length)
return
tmp
;
return
tmp
;
}
}
/* Return an unescaped text literal without quotes */
static
LEX_STRING
get_quoted_token
(
LEX
*
lex
,
uint
length
,
char
quote
)
/* Fix sometimes to do only one scan of the string */
{
LEX_STRING
tmp
;
byte
*
from
,
*
to
,
*
end
;
yyUnget
();
// ptr points now after last token char
tmp
.
length
=
lex
->
yytoklen
=
length
;
tmp
.
str
=
(
char
*
)
lex
->
thd
->
alloc
(
tmp
.
length
+
1
);
for
(
from
=
(
byte
*
)
lex
->
tok_start
,
to
=
tmp
.
str
,
end
=
to
+
length
;
to
!=
end
;)
{
if
((
*
to
++=
*
from
++
)
==
quote
)
from
++
;
// Skip double quotes
}
*
to
=
0
;
// End null for safety
return
tmp
;
}
/*
Return an unescaped text literal without quotes
Fix sometimes to do only one scan of the string
*/
static
char
*
get_text
(
LEX
*
lex
)
static
char
*
get_text
(
LEX
*
lex
)
{
{
...
@@ -663,14 +682,32 @@ int yylex(void *arg)
...
@@ -663,14 +682,32 @@ int yylex(void *arg)
lex
->
ptr
+=
l
-
1
;
lex
->
ptr
+=
l
-
1
;
}
}
}
}
yylval
->
lex_str
=
get_token
(
lex
,
yyLength
());
}
}
else
else
#endif
#endif
{
{
while
((
c
=
yyGet
())
&&
state_map
[
c
]
!=
STATE_USER_VARIABLE_DELIMITER
&&
uint
double_quotes
=
0
;
c
!=
(
uchar
)
NAMES_SEP_CHAR
)
;
char
quote_char
=
c
;
while
((
c
=
yyGet
()))
{
if
(
c
==
quote_char
)
{
if
(
yyPeek
()
!=
quote_char
)
break
;
c
=
yyGet
();
double_quotes
++
;
continue
;
}
if
(
c
==
(
uchar
)
NAMES_SEP_CHAR
)
break
;
}
if
(
double_quotes
)
yylval
->
lex_str
=
get_quoted_token
(
lex
,
yyLength
()
-
double_quotes
,
quote_char
);
else
yylval
->
lex_str
=
get_token
(
lex
,
yyLength
());
}
}
yylval
->
lex_str
=
get_token
(
lex
,
yyLength
());
if
(
lex
->
convert_set
)
if
(
lex
->
convert_set
)
lex
->
convert_set
->
convert
((
char
*
)
yylval
->
lex_str
.
str
,
lex
->
yytoklen
);
lex
->
convert_set
->
convert
((
char
*
)
yylval
->
lex_str
.
str
,
lex
->
yytoklen
);
if
(
state_map
[
c
]
==
STATE_USER_VARIABLE_DELIMITER
)
if
(
state_map
[
c
]
==
STATE_USER_VARIABLE_DELIMITER
)
...
...
sql/sql_yacc.yy
View file @
b96041ff
...
@@ -1072,6 +1072,8 @@ type:
...
@@ -1072,6 +1072,8 @@ type:
$$=FIELD_TYPE_TINY; }
$$=FIELD_TYPE_TINY; }
| BOOL_SYM { Lex->length=(char*) "1";
| BOOL_SYM { Lex->length=(char*) "1";
$$=FIELD_TYPE_TINY; }
$$=FIELD_TYPE_TINY; }
| BOOLEAN_SYM { Lex->length=(char*) "1";
$$=FIELD_TYPE_TINY; }
| char '(' NUM ')' opt_binary { Lex->length=$3.str;
| char '(' NUM ')' opt_binary { Lex->length=$3.str;
$$=FIELD_TYPE_STRING; }
$$=FIELD_TYPE_STRING; }
| char opt_binary { Lex->length=(char*) "1";
| char opt_binary { Lex->length=(char*) "1";
...
...
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