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
31a8bfbe
Commit
31a8bfbe
authored
Apr 02, 2007
by
kostja@bodhi.local
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into bodhi.local:/opt/local/work/mysql-5.0-runtime
parents
898ec87e
1381b26e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
315 additions
and
185 deletions
+315
-185
mysql-test/r/sp.result
mysql-test/r/sp.result
+85
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+55
-5
sql/item_func.cc
sql/item_func.cc
+158
-166
sql/item_func.h
sql/item_func.h
+17
-14
No files found.
mysql-test/r/sp.result
View file @
31a8bfbe
...
@@ -5969,4 +5969,89 @@ SUM(f2) bug25373(f1)
...
@@ -5969,4 +5969,89 @@ SUM(f2) bug25373(f1)
21.300000071526 NULL
21.300000071526 NULL
DROP FUNCTION bug25373|
DROP FUNCTION bug25373|
DROP TABLE t3|
DROP TABLE t3|
drop function if exists bug20777|
drop table if exists examplebug20777|
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
return f1;
end|
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
9223372036854775803 2**63-5
9223372036854775803
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
9223372036854775804 2**63-4
9223372036854775804
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
9223372036854775805 2**63-3
9223372036854775805
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
9223372036854775806 2**63-2
9223372036854775806
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
9223372036854775807 2**63-1
9223372036854775807
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
9223372036854775808 2**63+0
9223372036854775808
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
9223372036854775809 2**63+1
9223372036854775809
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
9223372036854775810 2**63+2
9223372036854775810
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
lower bounds signed bigint
0
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
upper bounds signed bigint
9223372036854775807
select bug20777(0) as 'lower bounds unsigned bigint';
lower bounds unsigned bigint
0
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
upper bounds unsigned bigint
18446744073709551615
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
upper bounds unsigned bigint + 1
18446744073709551615
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
lower bounds unsigned bigint - 1
0
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64',
bug20777(0) as '0',
bug20777(-1) as '-1';
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
show create table examplebug20777;
Table Create Table
examplebug20777 CREATE TABLE `examplebug20777` (
`i` int(1) NOT NULL default '0',
`2**63-2` bigint(20) unsigned default NULL,
`2**63-1` bigint(20) unsigned default NULL,
`2**63` bigint(20) unsigned default NULL,
`2**63+1` bigint(20) unsigned default NULL,
`2**64-2` bigint(20) unsigned default NULL,
`2**64-1` bigint(20) unsigned default NULL,
`2**64` bigint(20) unsigned default NULL,
`0` bigint(20) unsigned default NULL,
`-1` bigint(20) unsigned default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from examplebug20777 order by i;
i 2**63-2 2**63-1 2**63 2**63+1 2**64-2 2**64-1 2**64 0 -1
0 9223372036854775806 9223372036854775807 9223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 18446744073709551615 0 0
1 9223372036854775806 9223372036854775807 223372036854775808 9223372036854775809 18446744073709551614 18446744073709551615 8446744073709551616 0 0
drop table examplebug20777;
select bug20777(18446744073709551613)+1;
bug20777(18446744073709551613)+1
18446744073709551614
drop function bug20777;
End of 5.0 tests.
drop table t1,t2;
drop table t1,t2;
mysql-test/t/sp.test
View file @
31a8bfbe
...
@@ -6930,9 +6930,54 @@ SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
...
@@ -6930,9 +6930,54 @@ SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
DROP FUNCTION bug25373|
DROP FUNCTION bug25373|
DROP TABLE t3|
DROP TABLE t3|
#
#
# NOTE: The delimiter is `
|
`, and not `
;
`. It is changed to `
;
`
# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
# at the end of the file!
--disable_warnings
#
drop function if exists bug20777|
drop table if exists examplebug20777|
--enabled_warnings
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
return f1;
end|
delimiter ;|
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
select bug20777(0) as 'lower bounds unsigned bigint';
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64',
bug20777(0) as '0',
bug20777(-1) as '-1';
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
show create table examplebug20777;
select * from examplebug20777 order by i;
drop table examplebug20777;
select bug20777(18446744073709551613)+1;
drop function bug20777;
delimiter |;
###
--echo End of 5.0 tests.
#
#
# BUG#NNNN: New bug synopsis
# BUG#NNNN: New bug synopsis
...
@@ -6941,8 +6986,13 @@ DROP TABLE t3|
...
@@ -6941,8 +6986,13 @@ DROP TABLE t3|
#drop procedure if exists bugNNNN|
#drop procedure if exists bugNNNN|
#--enable_warnings
#--enable_warnings
#create procedure bugNNNN...
#create procedure bugNNNN...
#
# Add bugs above this line. Use existing tables t1 and t2 when
# Add bugs above this line. Use existing tables t1 and t2 when
# practical, or create table t3, t4 etc temporarily (and drop them).
# practical, or create table t3,t4 etc temporarily (and drop them).
# NOTE: The delimiter is `
|
`, and not `
;
`. It is changed to `
;
`
# at the end of the file!
#
delimiter
;
|
delimiter
;
|
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
sql/item_func.cc
View file @
31a8bfbe
This diff is collapsed.
Click to expand it.
sql/item_func.h
View file @
31a8bfbe
...
@@ -1405,12 +1405,15 @@ private:
...
@@ -1405,12 +1405,15 @@ private:
sp_name
*
m_name
;
sp_name
*
m_name
;
mutable
sp_head
*
m_sp
;
mutable
sp_head
*
m_sp
;
TABLE
*
dummy_table
;
TABLE
*
dummy_table
;
Field
*
result_field
;
char
result_buf
[
64
];
char
result_buf
[
64
];
/*
The result field of the concrete stored function.
*/
Field
*
sp_result_field
;
bool
execute
(
Field
**
flp
);
bool
execute
();
bool
execute_impl
(
THD
*
thd
,
Field
*
return_value_fld
);
bool
execute_impl
(
THD
*
thd
);
Field
*
sp_result_field
(
void
)
const
;
bool
init_result_field
(
THD
*
thd
)
;
public:
public:
...
@@ -1436,23 +1439,23 @@ public:
...
@@ -1436,23 +1439,23 @@ public:
longlong
val_int
()
longlong
val_int
()
{
{
if
(
execute
(
&
result_field
))
if
(
execute
())
return
(
longlong
)
0
;
return
(
longlong
)
0
;
return
result_field
->
val_int
();
return
sp_
result_field
->
val_int
();
}
}
double
val_real
()
double
val_real
()
{
{
if
(
execute
(
&
result_field
))
if
(
execute
())
return
0.0
;
return
0.0
;
return
result_field
->
val_real
();
return
sp_
result_field
->
val_real
();
}
}
my_decimal
*
val_decimal
(
my_decimal
*
dec_buf
)
my_decimal
*
val_decimal
(
my_decimal
*
dec_buf
)
{
{
if
(
execute
(
&
result_field
))
if
(
execute
())
return
NULL
;
return
NULL
;
return
result_field
->
val_decimal
(
dec_buf
);
return
sp_
result_field
->
val_decimal
(
dec_buf
);
}
}
String
*
val_str
(
String
*
str
)
String
*
val_str
(
String
*
str
)
...
@@ -1461,7 +1464,7 @@ public:
...
@@ -1461,7 +1464,7 @@ public:
char
buff
[
20
];
char
buff
[
20
];
buf
.
set
(
buff
,
20
,
str
->
charset
());
buf
.
set
(
buff
,
20
,
str
->
charset
());
buf
.
length
(
0
);
buf
.
length
(
0
);
if
(
execute
(
&
result_field
))
if
(
execute
())
return
NULL
;
return
NULL
;
/*
/*
result_field will set buf pointing to internal buffer
result_field will set buf pointing to internal buffer
...
@@ -1469,7 +1472,7 @@ public:
...
@@ -1469,7 +1472,7 @@ public:
when SP is executed. In order to prevent occasional
when SP is executed. In order to prevent occasional
corruption of returned value, we make here a copy.
corruption of returned value, we make here a copy.
*/
*/
result_field
->
val_str
(
&
buf
);
sp_
result_field
->
val_str
(
&
buf
);
str
->
copy
(
buf
);
str
->
copy
(
buf
);
return
str
;
return
str
;
}
}
...
@@ -1477,11 +1480,11 @@ public:
...
@@ -1477,11 +1480,11 @@ public:
virtual
bool
change_context_processor
(
byte
*
cntx
)
virtual
bool
change_context_processor
(
byte
*
cntx
)
{
context
=
(
Name_resolution_context
*
)
cntx
;
return
FALSE
;
}
{
context
=
(
Name_resolution_context
*
)
cntx
;
return
FALSE
;
}
void
fix_length_and_dec
();
bool
sp_check_access
(
THD
*
thd
);
bool
find_and_check_access
(
THD
*
thd
);
virtual
enum
Functype
functype
()
const
{
return
FUNC_SP
;
}
virtual
enum
Functype
functype
()
const
{
return
FUNC_SP
;
}
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
void
fix_length_and_dec
(
void
);
bool
is_expensive
()
{
return
1
;
}
bool
is_expensive
()
{
return
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