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
fa807c50
Commit
fa807c50
authored
Apr 30, 2007
by
malff/marcsql@weblab.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
into weblab.(none):/home/marcsql/TREE/mysql-5.1-21513
parents
62fd6aa6
012f841f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
42 deletions
+49
-42
mysql-test/t/sp.test
mysql-test/t/sp.test
+11
-0
sql/item.cc
sql/item.cc
+0
-2
sql/sql_lex.cc
sql/sql_lex.cc
+30
-34
sql/sql_yacc.yy
sql/sql_yacc.yy
+8
-6
No files found.
mysql-test/t/sp.test
View file @
fa807c50
...
...
@@ -7146,6 +7146,17 @@ SELECT bug5274_f2()|
DROP FUNCTION bug5274_f1|
DROP FUNCTION bug5274_f2|
#
# Bug#21513 (SP having body starting with quoted label rendered unusable)
#
--disable_warnings
drop procedure if exists proc_21513|
--enable_warnings
create procedure proc_21513()`
my_label
`:BEGIN END|
show create procedure proc_21513|
drop procedure proc_21513|
###
--echo End of 5.0 tests.
...
...
sql/item.cc
View file @
fa807c50
...
...
@@ -4711,7 +4711,6 @@ inline uint char_val(char X)
Item_hex_string
::
Item_hex_string
(
const
char
*
str
,
uint
str_length
)
{
name
=
(
char
*
)
str
-
2
;
// Lex makes this start with 0x
max_length
=
(
str_length
+
1
)
/
2
;
char
*
ptr
=
(
char
*
)
sql_alloc
(
max_length
+
1
);
if
(
!
ptr
)
...
...
@@ -4822,7 +4821,6 @@ Item_bin_string::Item_bin_string(const char *str, uint str_length)
uchar
bits
=
0
;
uint
power
=
1
;
name
=
(
char
*
)
str
-
2
;
max_length
=
(
str_length
+
7
)
>>
3
;
char
*
ptr
=
(
char
*
)
sql_alloc
(
max_length
+
1
);
if
(
!
ptr
)
...
...
sql/sql_lex.cc
View file @
fa807c50
...
...
@@ -302,12 +302,12 @@ bool is_lex_native_function(const LEX_STRING *name)
/* make a copy of token before ptr and set yytoklen */
static
LEX_STRING
get_token
(
Lex_input_stream
*
lip
,
uint
length
)
static
LEX_STRING
get_token
(
Lex_input_stream
*
lip
,
uint
skip
,
uint
length
)
{
LEX_STRING
tmp
;
yyUnget
();
// ptr points now after last token char
tmp
.
length
=
lip
->
yytoklen
=
length
;
tmp
.
str
=
lip
->
m_thd
->
strmake
(
lip
->
tok_start
,
tmp
.
length
);
tmp
.
str
=
lip
->
m_thd
->
strmake
(
lip
->
tok_start
+
skip
,
tmp
.
length
);
return
tmp
;
}
...
...
@@ -319,6 +319,7 @@ static LEX_STRING get_token(Lex_input_stream *lip, uint length)
*/
static
LEX_STRING
get_quoted_token
(
Lex_input_stream
*
lip
,
uint
skip
,
uint
length
,
char
quote
)
{
LEX_STRING
tmp
;
...
...
@@ -327,9 +328,10 @@ static LEX_STRING get_quoted_token(Lex_input_stream *lip,
yyUnget
();
// ptr points now after last token char
tmp
.
length
=
lip
->
yytoklen
=
length
;
tmp
.
str
=
(
char
*
)
lip
->
m_thd
->
alloc
(
tmp
.
length
+
1
);
for
(
from
=
lip
->
tok_start
,
to
=
tmp
.
str
,
end
=
to
+
length
;
to
!=
end
;
)
from
=
lip
->
tok_start
+
skip
to
=
tmp
.
str
;
end
=
to
+
length
;
for
(
;
to
!=
end
;
)
{
if
((
*
to
++=
*
from
++
)
==
quote
)
from
++
;
// Skip double quotes
...
...
@@ -709,7 +711,7 @@ int MYSQLlex(void *arg, void *yythd)
}
yySkip
();
// next state does a unget
}
yylval
->
lex_str
=
get_token
(
lip
,
length
);
yylval
->
lex_str
=
get_token
(
lip
,
0
,
length
);
/*
Note: "SELECT _bla AS 'alias'"
...
...
@@ -751,7 +753,7 @@ int MYSQLlex(void *arg, void *yythd)
{
yySkip
();
while
(
my_isdigit
(
cs
,
yyGet
()))
;
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
=
get_token
(
lip
,
0
,
yyLength
());
return
(
FLOAT_NUM
);
}
}
...
...
@@ -763,10 +765,8 @@ int MYSQLlex(void *arg, void *yythd)
while
(
my_isxdigit
(
cs
,(
c
=
yyGet
())))
;
if
((
lip
->
ptr
-
lip
->
tok_start
)
>=
4
&&
!
ident_map
[
c
])
{
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
.
str
+=
2
;
// Skip 0x
yylval
->
lex_str
.
length
-=
2
;
lip
->
yytoklen
-=
2
;
/* skip '0x' */
yylval
->
lex_str
=
get_token
(
lip
,
2
,
yyLength
()
-
2
);
return
(
HEX_NUM
);
}
yyUnget
();
...
...
@@ -777,10 +777,8 @@ int MYSQLlex(void *arg, void *yythd)
while
(
my_isxdigit
(
cs
,(
c
=
yyGet
())))
;
if
((
lip
->
ptr
-
lip
->
tok_start
)
>=
4
&&
!
ident_map
[
c
])
{
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
.
str
+=
2
;
// Skip 0x
yylval
->
lex_str
.
length
-=
2
;
lip
->
yytoklen
-=
2
;
/* Skip '0b' */
yylval
->
lex_str
=
get_token
(
lip
,
2
,
yyLength
()
-
2
);
return
(
BIN_NUM
);
}
yyUnget
();
...
...
@@ -813,14 +811,13 @@ int MYSQLlex(void *arg, void *yythd)
if
(
c
==
'.'
&&
ident_map
[
yyPeek
()])
lip
->
next_state
=
MY_LEX_IDENT_SEP
;
// Next is '.'
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
=
get_token
(
lip
,
0
,
yyLength
());
return
(
result_state
);
case
MY_LEX_USER_VARIABLE_DELIMITER
:
// Found quote char
{
uint
double_quotes
=
0
;
char
quote_char
=
c
;
// Used char
lip
->
tok_start
=
lip
->
ptr
;
// Skip first `
while
((
c
=
yyGet
()))
{
int
var_length
;
...
...
@@ -842,19 +839,20 @@ int MYSQLlex(void *arg, void *yythd)
#endif
}
if
(
double_quotes
)
yylval
->
lex_str
=
get_quoted_token
(
lip
,
yyLength
()
-
double_quotes
,
yylval
->
lex_str
=
get_quoted_token
(
lip
,
1
,
yyLength
()
-
double_quotes
-
1
,
quote_char
);
else
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
()
);
yylval
->
lex_str
=
get_token
(
lip
,
1
,
yyLength
()
-
1
);
if
(
c
==
quote_char
)
yySkip
();
// Skip end `
lip
->
next_state
=
MY_LEX_START
;
return
(
IDENT_QUOTED
);
}
case
MY_LEX_INT_OR_REAL
:
// Comple
at int or incompleat
real
case
MY_LEX_INT_OR_REAL
:
// Comple
te int or incomplete
real
if
(
c
!=
'.'
)
{
// Found complete integer number.
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
=
get_token
(
lip
,
0
,
yyLength
());
return
int_token
(
yylval
->
lex_str
.
str
,
yylval
->
lex_str
.
length
);
}
// fall through
...
...
@@ -872,10 +870,10 @@ int MYSQLlex(void *arg, void *yythd)
break
;
}
while
(
my_isdigit
(
cs
,
yyGet
()))
;
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
=
get_token
(
lip
,
0
,
yyLength
());
return
(
FLOAT_NUM
);
}
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
=
get_token
(
lip
,
0
,
yyLength
());
return
(
DECIMAL_NUM
);
case
MY_LEX_HEX_NUMBER
:
// Found x'hexstring'
...
...
@@ -887,10 +885,9 @@ int MYSQLlex(void *arg, void *yythd)
return
(
ABORT_SYM
);
// Illegal hex constant
}
yyGet
();
// get_token makes an unget
yylval
->
lex_str
=
get_token
(
lip
,
length
);
yylval
->
lex_str
.
str
+=
2
;
// Skip x'
yylval
->
lex_str
.
length
-=
3
;
// Don't count x' and last '
lip
->
yytoklen
-=
3
;
yylval
->
lex_str
=
get_token
(
lip
,
2
,
// skip x'
length
-
3
);
// don't count x' and last '
return
(
HEX_NUM
);
case
MY_LEX_BIN_NUMBER
:
// Found b'bin-string'
...
...
@@ -900,11 +897,10 @@ int MYSQLlex(void *arg, void *yythd)
if
(
c
!=
'\''
)
return
(
ABORT_SYM
);
// Illegal hex constant
yyGet
();
// get_token makes an unget
yylval
->
lex_str
=
get_token
(
lip
,
length
);
yylval
->
lex_str
.
str
+=
2
;
// Skip b'
yylval
->
lex_str
.
length
-=
3
;
// Don't count b' and last '
lip
->
yytoklen
-=
3
;
return
(
BIN_NUM
);
yylval
->
lex_str
=
get_token
(
lip
,
2
,
// skip b'
length
-
3
);
// don't count b' and last '
return
(
BIN_NUM
);
case
MY_LEX_CMP_OP
:
// Incomplete comparison operator
if
(
state_map
[
yyPeek
()]
==
MY_LEX_CMP_OP
||
...
...
@@ -1076,7 +1072,7 @@ int MYSQLlex(void *arg, void *yythd)
for
(
c
=
yyGet
()
;
my_isalnum
(
cs
,
c
)
||
c
==
'.'
||
c
==
'_'
||
c
==
'$'
;
c
=
yyGet
())
;
yylval
->
lex_str
=
get_token
(
lip
,
yyLength
());
yylval
->
lex_str
=
get_token
(
lip
,
0
,
yyLength
());
return
(
LEX_HOSTNAME
);
case
MY_LEX_SYSTEM_VAR
:
yylval
->
lex_str
.
str
=
(
char
*
)
lip
->
ptr
;
...
...
@@ -1108,7 +1104,7 @@ int MYSQLlex(void *arg, void *yythd)
yyUnget
();
// Put back 'c'
return
(
tokval
);
// Was keyword
}
yylval
->
lex_str
=
get_token
(
lip
,
length
);
yylval
->
lex_str
=
get_token
(
lip
,
0
,
length
);
return
(
result_state
);
}
}
...
...
sql/sql_yacc.yy
View file @
fa807c50
...
...
@@ -6210,21 +6210,23 @@ select_item_list:
select_item:
remember_name select_item2 remember_end select_alias
{
if (add_item_to_list(YYTHD, $2))
THD *thd= YYTHD;
DBUG_ASSERT($1 < $3);
if (add_item_to_list(thd, $2))
MYSQL_YYABORT;
if ($4.str)
{
$2->is_autogenerated_name= FALSE;
$2->set_name($4.str, $4.length, system_charset_info);
}
else if (!$2->name) {
char *str = $1;
if (str[-1] == '`')
str--;
$2->set_name(str,(uint) ($3 - str), YYTHD->charset());
else if (!$2->name)
{
$2->set_name($1, (uint) ($3 - $1), thd->charset());
}
};
remember_name:
{
THD *thd= YYTHD;
...
...
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