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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e7a7af07
Commit
e7a7af07
authored
Dec 02, 2005
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/usr/home/pem/mysql-5.1-new
parents
c1854e67
035c24be
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
124 additions
and
27 deletions
+124
-27
mysql-test/r/ps.result
mysql-test/r/ps.result
+7
-7
mysql-test/r/sp.result
mysql-test/r/sp.result
+29
-0
mysql-test/t/count_distinct3.test
mysql-test/t/count_distinct3.test
+1
-1
mysql-test/t/sp.test
mysql-test/t/sp.test
+45
-0
sql/field.cc
sql/field.cc
+2
-2
sql/item.cc
sql/item.cc
+2
-2
sql/item.h
sql/item.h
+2
-2
sql/item_func.cc
sql/item_func.cc
+1
-1
sql/item_func.h
sql/item_func.h
+2
-2
sql/item_sum.cc
sql/item_sum.cc
+3
-3
sql/item_sum.h
sql/item_sum.h
+4
-4
sql/sp_pcontext.cc
sql/sp_pcontext.cc
+2
-2
sql/sp_pcontext.h
sql/sp_pcontext.h
+17
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+7
-1
No files found.
mysql-test/r/ps.result
View file @
e7a7af07
...
@@ -337,7 +337,7 @@ set @precision=10000000000;
...
@@ -337,7 +337,7 @@ set @precision=10000000000;
select rand(),
select rand(),
cast(rand(10)*@precision as unsigned integer) from t1;
cast(rand(10)*@precision as unsigned integer) from t1;
rand() cast(rand(10)*@precision as unsigned integer)
rand() cast(rand(10)*@precision as unsigned integer)
- 65705152
19
- 65705152
20
- 1282061302
- 1282061302
- 6698761160
- 6698761160
- 9647622201
- 9647622201
...
@@ -348,23 +348,23 @@ prepare stmt from
...
@@ -348,23 +348,23 @@ prepare stmt from
set @var=1;
set @var=1;
execute stmt using @var;
execute stmt using @var;
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
- 65705152
19
-
- 65705152
20
-
- 1282061302 -
- 1282061302 -
- 6698761160 -
- 6698761160 -
- 9647622201 -
- 9647622201 -
set @var=2;
set @var=2;
execute stmt using @var;
execute stmt using @var;
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
- 65705152
19
6555866465
- 65705152
20
6555866465
- 1282061302 122346619
2
- 1282061302 122346619
3
- 6698761160 644973187
3
- 6698761160 644973187
4
- 9647622201 8578261098
- 9647622201 8578261098
set @var=3;
set @var=3;
execute stmt using @var;
execute stmt using @var;
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
- 65705152
19 9057697559
- 65705152
20 9057697560
- 1282061302 3730790581
- 1282061302 3730790581
- 6698761160 148086053
4
- 6698761160 148086053
5
- 9647622201 6211931236
- 9647622201 6211931236
drop table t1;
drop table t1;
deallocate prepare stmt;
deallocate prepare stmt;
...
...
mysql-test/r/sp.result
View file @
e7a7af07
...
@@ -4070,4 +4070,33 @@ a
...
@@ -4070,4 +4070,33 @@ a
3
3
drop procedure bug14304|
drop procedure bug14304|
drop table t3, t4|
drop table t3, t4|
drop procedure if exists bug14376|
create procedure bug14376()
begin
declare x int default x;
end|
call bug14376()|
ERROR 42S22: Unknown column 'x' in 'field list'
drop procedure bug14376|
create procedure bug14376()
begin
declare x int default 42;
begin
declare x int default x;
select x;
end;
end|
call bug14376()|
x
42
drop procedure bug14376|
create procedure bug14376(x int)
begin
declare x int default x;
select x;
end|
call bug14376(4711)|
x
4711
drop procedure bug14376|
drop table t1,t2;
drop table t1,t2;
mysql-test/t/count_distinct3.test
View file @
e7a7af07
...
@@ -17,7 +17,7 @@ while ($1)
...
@@ -17,7 +17,7 @@ while ($1)
SET
@
rnd
=
RAND
();
SET
@
rnd
=
RAND
();
SET
@
id
=
CAST
(
@
rnd
*
@
rnd_max
AS
UNSIGNED
);
SET
@
id
=
CAST
(
@
rnd
*
@
rnd_max
AS
UNSIGNED
);
SET
@
id_rev
=
@
rnd_max
-
@
id
;
SET
@
id_rev
=
@
rnd_max
-
@
id
;
SET
@
grp
=
CAST
(
12
8
.0
*
@
rnd
AS
UNSIGNED
);
SET
@
grp
=
CAST
(
12
7
.0
*
@
rnd
AS
UNSIGNED
);
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
VALUES
(
@
id
,
@
grp
,
@
id_rev
);
INSERT
INTO
t1
(
id
,
grp
,
id_rev
)
VALUES
(
@
id
,
@
grp
,
@
id_rev
);
dec
$
1
;
dec
$
1
;
}
}
...
...
mysql-test/t/sp.test
View file @
e7a7af07
...
@@ -4855,6 +4855,51 @@ call bug14304()|
...
@@ -4855,6 +4855,51 @@ call bug14304()|
drop
procedure
bug14304
|
drop
procedure
bug14304
|
drop
table
t3
,
t4
|
drop
table
t3
,
t4
|
#
# BUG#14376: MySQL crash on scoped variable (re)initialization
#
--
disable_warnings
drop
procedure
if
exists
bug14376
|
--
enable_warnings
create
procedure
bug14376
()
begin
declare
x
int
default
x
;
end
|
# Not the error we want, but that's what we got for now...
--
error
ER_BAD_FIELD_ERROR
call
bug14376
()
|
drop
procedure
bug14376
|
create
procedure
bug14376
()
begin
declare
x
int
default
42
;
begin
declare
x
int
default
x
;
select
x
;
end
;
end
|
call
bug14376
()
|
drop
procedure
bug14376
|
create
procedure
bug14376
(
x
int
)
begin
declare
x
int
default
x
;
select
x
;
end
|
call
bug14376
(
4711
)
|
drop
procedure
bug14376
|
#
#
# BUG#NNNN: New bug synopsis
# BUG#NNNN: New bug synopsis
#
#
...
...
sql/field.cc
View file @
e7a7af07
...
@@ -3958,7 +3958,7 @@ longlong Field_float::val_int(void)
...
@@ -3958,7 +3958,7 @@ longlong Field_float::val_int(void)
else
else
#endif
#endif
memcpy_fixed
((
byte
*
)
&
j
,
ptr
,
sizeof
(
j
));
memcpy_fixed
((
byte
*
)
&
j
,
ptr
,
sizeof
(
j
));
return
(
(
longlong
)
j
);
return
(
longlong
)
rint
(
j
);
}
}
...
@@ -4246,7 +4246,7 @@ longlong Field_double::val_int(void)
...
@@ -4246,7 +4246,7 @@ longlong Field_double::val_int(void)
else
else
#endif
#endif
doubleget
(
j
,
ptr
);
doubleget
(
j
,
ptr
);
return
(
(
longlong
)
j
);
return
(
longlong
)
rint
(
j
);
}
}
...
...
sql/item.cc
View file @
e7a7af07
...
@@ -2460,7 +2460,7 @@ longlong Item_param::val_int()
...
@@ -2460,7 +2460,7 @@ longlong Item_param::val_int()
{
{
switch
(
state
)
{
switch
(
state
)
{
case
REAL_VALUE
:
case
REAL_VALUE
:
return
(
longlong
)
(
value
.
real
+
(
value
.
real
>
0
?
0.5
:
-
0.5
)
);
return
(
longlong
)
rint
(
value
.
real
);
case
INT_VALUE
:
case
INT_VALUE
:
return
value
.
integer
;
return
value
.
integer
;
case
DECIMAL_VALUE
:
case
DECIMAL_VALUE
:
...
@@ -5483,7 +5483,7 @@ void Item_cache_real::store(Item *item)
...
@@ -5483,7 +5483,7 @@ void Item_cache_real::store(Item *item)
longlong
Item_cache_real
::
val_int
()
longlong
Item_cache_real
::
val_int
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
(
value
+
(
value
>
0
?
0.5
:
-
0.5
)
);
return
(
longlong
)
rint
(
value
);
}
}
...
...
sql/item.h
View file @
e7a7af07
...
@@ -159,7 +159,7 @@ struct Hybrid_type_traits
...
@@ -159,7 +159,7 @@ struct Hybrid_type_traits
{
val
->
real
/=
ulonglong2double
(
u
);
}
{
val
->
real
/=
ulonglong2double
(
u
);
}
virtual
longlong
val_int
(
Hybrid_type
*
val
,
bool
unsigned_flag
)
const
virtual
longlong
val_int
(
Hybrid_type
*
val
,
bool
unsigned_flag
)
const
{
return
(
longlong
)
val
->
real
;
}
{
return
(
longlong
)
rint
(
val
->
real
)
;
}
virtual
double
val_real
(
Hybrid_type
*
val
)
const
{
return
val
->
real
;
}
virtual
double
val_real
(
Hybrid_type
*
val
)
const
{
return
val
->
real
;
}
virtual
my_decimal
*
val_decimal
(
Hybrid_type
*
val
,
my_decimal
*
buf
)
const
;
virtual
my_decimal
*
val_decimal
(
Hybrid_type
*
val
,
my_decimal
*
buf
)
const
;
virtual
String
*
val_str
(
Hybrid_type
*
val
,
String
*
buf
,
uint8
decimals
)
const
;
virtual
String
*
val_str
(
Hybrid_type
*
val
,
String
*
buf
,
uint8
decimals
)
const
;
...
@@ -1354,7 +1354,7 @@ class Item_float :public Item_num
...
@@ -1354,7 +1354,7 @@ class Item_float :public Item_num
{
{
return
LONGLONG_MAX
;
return
LONGLONG_MAX
;
}
}
return
(
longlong
)
(
value
+
(
value
>
0
?
0.5
:
-
0.5
)
);
return
(
longlong
)
rint
(
value
);
}
}
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
...
...
sql/item_func.cc
View file @
e7a7af07
...
@@ -737,7 +737,7 @@ longlong Item_func_numhybrid::val_int()
...
@@ -737,7 +737,7 @@ longlong Item_func_numhybrid::val_int()
case
INT_RESULT
:
case
INT_RESULT
:
return
int_op
();
return
int_op
();
case
REAL_RESULT
:
case
REAL_RESULT
:
return
(
longlong
)
real_op
(
);
return
(
longlong
)
rint
(
real_op
()
);
case
STRING_RESULT
:
case
STRING_RESULT
:
{
{
int
err_not_used
;
int
err_not_used
;
...
...
sql/item_func.h
View file @
e7a7af07
...
@@ -199,7 +199,7 @@ class Item_real_func :public Item_func
...
@@ -199,7 +199,7 @@ class Item_real_func :public Item_func
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
my_decimal
*
val_decimal
(
my_decimal
*
decimal_value
);
my_decimal
*
val_decimal
(
my_decimal
*
decimal_value
);
longlong
val_int
()
longlong
val_int
()
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
val_real
(
);
}
{
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
rint
(
val_real
()
);
}
enum
Item_result
result_type
()
const
{
return
REAL_RESULT
;
}
enum
Item_result
result_type
()
const
{
return
REAL_RESULT
;
}
void
fix_length_and_dec
()
void
fix_length_and_dec
()
{
decimals
=
NOT_FIXED_DEC
;
max_length
=
float_length
(
decimals
);
}
{
decimals
=
NOT_FIXED_DEC
;
max_length
=
float_length
(
decimals
);
}
...
@@ -943,7 +943,7 @@ class Item_func_udf_float :public Item_udf_func
...
@@ -943,7 +943,7 @@ class Item_func_udf_float :public Item_udf_func
longlong
val_int
()
longlong
val_int
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
Item_func_udf_float
::
val_real
(
);
return
(
longlong
)
rint
(
Item_func_udf_float
::
val_real
()
);
}
}
my_decimal
*
val_decimal
(
my_decimal
*
dec_buf
)
my_decimal
*
val_decimal
(
my_decimal
*
dec_buf
)
{
{
...
...
sql/item_sum.cc
View file @
e7a7af07
...
@@ -465,7 +465,7 @@ longlong Item_sum_sum::val_int()
...
@@ -465,7 +465,7 @@ longlong Item_sum_sum::val_int()
&
result
);
&
result
);
return
result
;
return
result
;
}
}
return
(
longlong
)
val_real
(
);
return
(
longlong
)
rint
(
val_real
()
);
}
}
...
@@ -1308,7 +1308,7 @@ longlong Item_sum_hybrid::val_int()
...
@@ -1308,7 +1308,7 @@ longlong Item_sum_hybrid::val_int()
return
sum_int
;
return
sum_int
;
}
}
default:
default:
return
(
longlong
)
Item_sum_hybrid
::
val_real
(
);
return
(
longlong
)
rint
(
Item_sum_hybrid
::
val_real
()
);
}
}
}
}
...
@@ -2024,7 +2024,7 @@ double Item_avg_field::val_real()
...
@@ -2024,7 +2024,7 @@ double Item_avg_field::val_real()
longlong
Item_avg_field
::
val_int
()
longlong
Item_avg_field
::
val_int
()
{
{
return
(
longlong
)
val_real
(
);
return
(
longlong
)
rint
(
val_real
()
);
}
}
...
...
sql/item_sum.h
View file @
e7a7af07
...
@@ -126,7 +126,7 @@ class Item_sum_num :public Item_sum
...
@@ -126,7 +126,7 @@ class Item_sum_num :public Item_sum
longlong
val_int
()
longlong
val_int
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
val_real
(
);
/* Real as default */
return
(
longlong
)
rint
(
val_real
()
);
/* Real as default */
}
}
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
...
@@ -392,7 +392,7 @@ class Item_sum_avg :public Item_sum_sum
...
@@ -392,7 +392,7 @@ class Item_sum_avg :public Item_sum_sum
bool
add
();
bool
add
();
double
val_real
();
double
val_real
();
// In SPs we might force the "wrong" type with select into a declare variable
// In SPs we might force the "wrong" type with select into a declare variable
longlong
val_int
()
{
return
(
longlong
)
val_real
(
);
}
longlong
val_int
()
{
return
(
longlong
)
rint
(
val_real
()
);
}
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
void
reset_field
();
void
reset_field
();
...
@@ -421,7 +421,7 @@ class Item_variance_field :public Item_result_field
...
@@ -421,7 +421,7 @@ class Item_variance_field :public Item_result_field
enum
Type
type
()
const
{
return
FIELD_VARIANCE_ITEM
;
}
enum
Type
type
()
const
{
return
FIELD_VARIANCE_ITEM
;
}
double
val_real
();
double
val_real
();
longlong
val_int
()
longlong
val_int
()
{
/* can't be fix_fields()ed */
return
(
longlong
)
val_real
(
);
}
{
/* can't be fix_fields()ed */
return
(
longlong
)
rint
(
val_real
()
);
}
String
*
val_str
(
String
*
);
String
*
val_str
(
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
bool
is_null
()
{
(
void
)
val_int
();
return
null_value
;
}
bool
is_null
()
{
(
void
)
val_int
();
return
null_value
;
}
...
@@ -699,7 +699,7 @@ class Item_sum_udf_float :public Item_udf_sum
...
@@ -699,7 +699,7 @@ class Item_sum_udf_float :public Item_udf_sum
longlong
val_int
()
longlong
val_int
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
return
(
longlong
)
Item_sum_udf_float
::
val_real
(
);
return
(
longlong
)
rint
(
Item_sum_udf_float
::
val_real
()
);
}
}
double
val_real
();
double
val_real
();
String
*
val_str
(
String
*
str
);
String
*
val_str
(
String
*
str
);
...
...
sql/sp_pcontext.cc
View file @
e7a7af07
...
@@ -52,7 +52,7 @@ sp_cond_check(LEX_STRING *sqlstate)
...
@@ -52,7 +52,7 @@ sp_cond_check(LEX_STRING *sqlstate)
sp_pcontext
::
sp_pcontext
(
sp_pcontext
*
prev
)
sp_pcontext
::
sp_pcontext
(
sp_pcontext
*
prev
)
:
Sql_alloc
(),
m_psubsize
(
0
),
m_csubsize
(
0
),
m_hsubsize
(
0
),
:
Sql_alloc
(),
m_psubsize
(
0
),
m_csubsize
(
0
),
m_hsubsize
(
0
),
m_handlers
(
0
),
m_parent
(
prev
)
m_handlers
(
0
),
m_parent
(
prev
)
,
m_pboundary
(
0
)
{
{
VOID
(
my_init_dynamic_array
(
&
m_pvar
,
sizeof
(
sp_pvar_t
*
),
16
,
8
));
VOID
(
my_init_dynamic_array
(
&
m_pvar
,
sizeof
(
sp_pvar_t
*
),
16
,
8
));
VOID
(
my_init_dynamic_array
(
&
m_cond
,
sizeof
(
sp_cond_type_t
*
),
16
,
8
));
VOID
(
my_init_dynamic_array
(
&
m_cond
,
sizeof
(
sp_cond_type_t
*
),
16
,
8
));
...
@@ -150,7 +150,7 @@ sp_pcontext::diff_cursors(sp_pcontext *ctx)
...
@@ -150,7 +150,7 @@ sp_pcontext::diff_cursors(sp_pcontext *ctx)
sp_pvar_t
*
sp_pvar_t
*
sp_pcontext
::
find_pvar
(
LEX_STRING
*
name
,
my_bool
scoped
)
sp_pcontext
::
find_pvar
(
LEX_STRING
*
name
,
my_bool
scoped
)
{
{
uint
i
=
m_pvar
.
elements
;
uint
i
=
m_pvar
.
elements
-
m_pboundary
;
while
(
i
--
)
while
(
i
--
)
{
{
...
...
sql/sp_pcontext.h
View file @
e7a7af07
...
@@ -174,6 +174,16 @@ class sp_pcontext : public Sql_alloc
...
@@ -174,6 +174,16 @@ class sp_pcontext : public Sql_alloc
sp_pvar_t
*
sp_pvar_t
*
find_pvar
(
uint
offset
);
find_pvar
(
uint
offset
);
/*
Set the current scope boundary (for default values)
The argument is the number of variables to skip.
*/
inline
void
declare_var_boundary
(
uint
n
)
{
m_pboundary
=
n
;
}
//
//
// Labels
// Labels
//
//
...
@@ -282,6 +292,13 @@ class sp_pcontext : public Sql_alloc
...
@@ -282,6 +292,13 @@ class sp_pcontext : public Sql_alloc
uint
m_poffset
;
// Variable offset for this context
uint
m_poffset
;
// Variable offset for this context
uint
m_coffset
;
// Cursor offset for this context
uint
m_coffset
;
// Cursor offset for this context
/*
Boundary for finding variables in this context. This is the number
of variables currently "invisible" to default clauses.
This is normally 0, but will be larger during parsing of
DECLARE ... DEFAULT, to get the scope right for DEFAULT values.
*/
uint
m_pboundary
;
DYNAMIC_ARRAY
m_pvar
;
// Parameters/variables
DYNAMIC_ARRAY
m_pvar
;
// Parameters/variables
DYNAMIC_ARRAY
m_cond
;
// Conditions
DYNAMIC_ARRAY
m_cond
;
// Conditions
...
...
sql/sql_yacc.yy
View file @
e7a7af07
...
@@ -1619,7 +1619,12 @@ sp_decls:
...
@@ -1619,7 +1619,12 @@ sp_decls:
sp_decl:
sp_decl:
DECLARE_SYM sp_decl_idents type
DECLARE_SYM sp_decl_idents type
{ Lex->sphead->reset_lex(YYTHD); }
{
LEX *lex= Lex;
lex->sphead->reset_lex(YYTHD);
lex->spcont->declare_var_boundary($2);
}
sp_opt_default
sp_opt_default
{
{
LEX *lex= Lex;
LEX *lex= Lex;
...
@@ -1650,6 +1655,7 @@ sp_decl:
...
@@ -1650,6 +1655,7 @@ sp_decl:
lex->sphead->add_instr(in);
lex->sphead->add_instr(in);
ctx->set_default(off, it);
ctx->set_default(off, it);
}
}
ctx->declare_var_boundary(0);
lex->sphead->restore_lex(YYTHD);
lex->sphead->restore_lex(YYTHD);
$$.vars= $2;
$$.vars= $2;
$$.conds= $$.hndlrs= $$.curs= 0;
$$.conds= $$.hndlrs= $$.curs= 0;
...
...
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