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
7fd3cd9e
Commit
7fd3cd9e
authored
Jan 24, 2007
by
gkodinov/kgeorge@macbook.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.1-opt
into macbook.gmz:/Users/kgeorge/mysql/work/merge-5.1-opt
parents
13238b0e
8190cfca
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
108 additions
and
57 deletions
+108
-57
.bzrignore
.bzrignore
+1
-0
mysql-test/r/func_math.result
mysql-test/r/func_math.result
+40
-5
mysql-test/r/gis.result
mysql-test/r/gis.result
+11
-0
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+0
-2
mysql-test/r/innodb_gis.result
mysql-test/r/innodb_gis.result
+2
-0
mysql-test/r/view.result
mysql-test/r/view.result
+0
-11
mysql-test/t/func_math.test
mysql-test/t/func_math.test
+19
-5
mysql-test/t/gis.test
mysql-test/t/gis.test
+10
-0
mysql-test/t/innodb.test
mysql-test/t/innodb.test
+0
-6
mysql-test/t/innodb_gis.test
mysql-test/t/innodb_gis.test
+6
-0
mysql-test/t/view.test
mysql-test/t/view.test
+0
-9
sql/item_func.cc
sql/item_func.cc
+17
-19
sql/item_func.h
sql/item_func.h
+2
-0
No files found.
.bzrignore
View file @
7fd3cd9e
...
@@ -2933,3 +2933,4 @@ win/vs71cache.txt
...
@@ -2933,3 +2933,4 @@ win/vs71cache.txt
win/vs8cache.txt
win/vs8cache.txt
zlib/*.ds?
zlib/*.ds?
zlib/*.vcproj
zlib/*.vcproj
libmysqld/sql_servers.cc
mysql-test/r/func_math.result
View file @
7fd3cd9e
...
@@ -177,11 +177,46 @@ drop table t1;
...
@@ -177,11 +177,46 @@ drop table t1;
select abs(-2) * -2;
select abs(-2) * -2;
abs(-2) * -2
abs(-2) * -2
-4
-4
create table t1 (i int);
CREATE TABLE t1 (a INT);
insert into t1 values (1);
INSERT INTO t1 VALUES (1),(1),(1),(2);
select rand(i) from t1;
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
ERROR HY000: Incorrect arguments to RAND
FROM t1;
drop table t1;
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
656 405
122 405
645 405
858 656
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
FROM t1 WHERE a = 1;
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
656 405
122 405
645 405
INSERT INTO t1 VALUES (3);
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
FROM t1;
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
656 405
122 405
645 405
858 656
354 906
SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(a) * 1000 AS UNSIGNED)
FROM t1 WHERE a = 1;
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(a) * 1000 AS UNSIGNED)
656 405
122 405
645 405
PREPARE stmt FROM
"SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(?) * 1000 AS UNSIGNED)
FROM t1 WHERE a = 1";
set @var=2;
EXECUTE stmt USING @var;
CAST(RAND(2) * 1000 AS UNSIGNED) CAST(RAND(?) * 1000 AS UNSIGNED)
656 656
122 122
645 645
DROP TABLE t1;
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8;
insert into t1 values ('http://www.foo.com/', now());
insert into t1 values ('http://www.foo.com/', now());
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0));
...
...
mysql-test/r/gis.result
View file @
7fd3cd9e
...
@@ -718,3 +718,14 @@ desc t1;
...
@@ -718,3 +718,14 @@ desc t1;
Field Type Null Key Default Extra
Field Type Null Key Default Extra
GeomFromText('point(1 1)') geometry NO
GeomFromText('point(1 1)') geometry NO
drop table t1;
drop table t1;
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
desc v1;
Field Type Null Key Default Extra
f1 tinyint(1) YES NULL
f2 char(1) YES NULL
f3 varchar(1) YES NULL
f4 geometry YES NULL
f5 datetime YES NULL
drop view v1;
drop table t1;
mysql-test/r/innodb.result
View file @
7fd3cd9e
...
@@ -3447,8 +3447,6 @@ SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
...
@@ -3447,8 +3447,6 @@ SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
a
a
1
1
drop table t2, t1;
drop table t2, t1;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
ERROR HY000: The used table type doesn't support SPATIAL indexes
CREATE TABLE t1 ( a int ) ENGINE=innodb;
CREATE TABLE t1 ( a int ) ENGINE=innodb;
BEGIN;
BEGIN;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
...
...
mysql-test/r/innodb_gis.result
View file @
7fd3cd9e
...
@@ -460,3 +460,5 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
...
@@ -460,3 +460,5 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
drop table t1;
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
ERROR HY000: The used table type doesn't support SPATIAL indexes
mysql-test/r/view.result
View file @
7fd3cd9e
...
@@ -2060,17 +2060,6 @@ CALL p1();
...
@@ -2060,17 +2060,6 @@ CALL p1();
DROP PROCEDURE p1;
DROP PROCEDURE p1;
DROP VIEW v1;
DROP VIEW v1;
DROP TABLE t1;
DROP TABLE t1;
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
desc v1;
Field Type Null Key Default Extra
f1 tinyint(1) YES NULL
f2 char(1) YES NULL
f3 varchar(1) YES NULL
f4 geometry YES NULL
f5 datetime YES NULL
drop view v1;
drop table t1;
create table t1(f1 datetime);
create table t1(f1 datetime);
insert into t1 values('2005.01.01 12:0:0');
insert into t1 values('2005.01.01 12:0:0');
create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1;
create view v1 as select f1, subtime(f1, '1:1:1') as sb from t1;
...
...
mysql-test/t/func_math.test
View file @
7fd3cd9e
...
@@ -115,11 +115,25 @@ select abs(-2) * -2;
...
@@ -115,11 +115,25 @@ select abs(-2) * -2;
#
#
# Bug #6172 RAND(a) should only accept constant values as arguments
# Bug #6172 RAND(a) should only accept constant values as arguments
#
#
create
table
t1
(
i
int
);
CREATE
TABLE
t1
(
a
INT
);
insert
into
t1
values
(
1
);
--
error
1210
INSERT
INTO
t1
VALUES
(
1
),(
1
),(
1
),(
2
);
select
rand
(
i
)
from
t1
;
SELECT
CAST
(
RAND
(
2
)
*
1000
AS
UNSIGNED
),
CAST
(
RAND
(
a
)
*
1000
AS
UNSIGNED
)
drop
table
t1
;
FROM
t1
;
SELECT
CAST
(
RAND
(
2
)
*
1000
AS
UNSIGNED
),
CAST
(
RAND
(
a
)
*
1000
AS
UNSIGNED
)
FROM
t1
WHERE
a
=
1
;
INSERT
INTO
t1
VALUES
(
3
);
SELECT
CAST
(
RAND
(
2
)
*
1000
AS
UNSIGNED
),
CAST
(
RAND
(
a
)
*
1000
AS
UNSIGNED
)
FROM
t1
;
SELECT
CAST
(
RAND
(
2
)
*
1000
AS
UNSIGNED
),
CAST
(
RAND
(
a
)
*
1000
AS
UNSIGNED
)
FROM
t1
WHERE
a
=
1
;
PREPARE
stmt
FROM
"SELECT CAST(RAND(2) * 1000 AS UNSIGNED), CAST(RAND(?) * 1000 AS UNSIGNED)
FROM t1 WHERE a = 1"
;
set
@
var
=
2
;
EXECUTE
stmt
USING
@
var
;
DROP
TABLE
t1
;
#
#
# Bug #14009: use of abs() on null value causes problems with filesort
# Bug #14009: use of abs() on null value causes problems with filesort
...
...
mysql-test/t/gis.test
View file @
7fd3cd9e
...
@@ -428,3 +428,13 @@ drop table t1;
...
@@ -428,3 +428,13 @@ drop table t1;
create
table
t1
select
GeomFromText
(
'point(1 1)'
);
create
table
t1
select
GeomFromText
(
'point(1 1)'
);
desc
t1
;
desc
t1
;
drop
table
t1
;
drop
table
t1
;
#
# Bug #11335 View redefines column types
#
create
table
t1
(
f1
tinyint
(
1
),
f2
char
(
1
),
f3
varchar
(
1
),
f4
geometry
,
f5
datetime
);
create
view
v1
as
select
*
from
t1
;
desc
v1
;
drop
view
v1
;
drop
table
t1
;
mysql-test/t/innodb.test
View file @
7fd3cd9e
...
@@ -2488,12 +2488,6 @@ SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
...
@@ -2488,12 +2488,6 @@ SELECT p0.a FROM t2 p0 WHERE BINARY p0.b = 'customer_over';
drop
table
t2
,
t1
;
drop
table
t2
,
t1
;
#
# Bug #15680 (SPATIAL key in innodb)
#
--
error
ER_TABLE_CANT_HANDLE_SPKEYS
create
table
t1
(
g
geometry
not
null
,
spatial
gk
(
g
))
engine
=
innodb
;
#
#
# Test optimize on table with open transaction
# Test optimize on table with open transaction
#
#
...
...
mysql-test/t/innodb_gis.test
View file @
7fd3cd9e
--
source
include
/
have_innodb
.
inc
--
source
include
/
have_innodb
.
inc
SET
storage_engine
=
innodb
;
SET
storage_engine
=
innodb
;
--
source
include
/
gis_generic
.
inc
--
source
include
/
gis_generic
.
inc
#
# Bug #15680 (SPATIAL key in innodb)
#
--
error
ER_TABLE_CANT_HANDLE_SPKEYS
create
table
t1
(
g
geometry
not
null
,
spatial
gk
(
g
))
engine
=
innodb
;
mysql-test/t/view.test
View file @
7fd3cd9e
...
@@ -1878,15 +1878,6 @@ DROP PROCEDURE p1;
...
@@ -1878,15 +1878,6 @@ DROP PROCEDURE p1;
DROP
VIEW
v1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #11335 View redefines column types
#
create
table
t1
(
f1
tinyint
(
1
),
f2
char
(
1
),
f3
varchar
(
1
),
f4
geometry
,
f5
datetime
);
create
view
v1
as
select
*
from
t1
;
desc
v1
;
drop
view
v1
;
drop
table
t1
;
#
#
# Bug #11760 Typo in Item_func_add_time::print() results in NULLs returned
# Bug #11760 Typo in Item_func_add_time::print() results in NULLs returned
# subtime() in view
# subtime() in view
...
...
sql/item_func.cc
View file @
7fd3cd9e
...
@@ -2042,6 +2042,18 @@ my_decimal *Item_func_round::decimal_op(my_decimal *decimal_value)
...
@@ -2042,6 +2042,18 @@ my_decimal *Item_func_round::decimal_op(my_decimal *decimal_value)
}
}
void
Item_func_rand
::
seed_random
(
Item
*
arg
)
{
/*
TODO: do not do reinit 'rand' for every execute of PS/SP if
args[0] is a constant.
*/
uint32
tmp
=
(
uint32
)
arg
->
val_int
();
randominit
(
rand
,
(
uint32
)
(
tmp
*
0x10001L
+
55555555L
),
(
uint32
)
(
tmp
*
0x10000001L
));
}
bool
Item_func_rand
::
fix_fields
(
THD
*
thd
,
Item
**
ref
)
bool
Item_func_rand
::
fix_fields
(
THD
*
thd
,
Item
**
ref
)
{
{
if
(
Item_real_func
::
fix_fields
(
thd
,
ref
))
if
(
Item_real_func
::
fix_fields
(
thd
,
ref
))
...
@@ -2049,11 +2061,6 @@ bool Item_func_rand::fix_fields(THD *thd,Item **ref)
...
@@ -2049,11 +2061,6 @@ bool Item_func_rand::fix_fields(THD *thd,Item **ref)
used_tables_cache
|=
RAND_TABLE_BIT
;
used_tables_cache
|=
RAND_TABLE_BIT
;
if
(
arg_count
)
if
(
arg_count
)
{
// Only use argument once in query
{
// Only use argument once in query
if
(
!
args
[
0
]
->
const_during_execution
())
{
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
"RAND"
);
return
TRUE
;
}
/*
/*
Allocate rand structure once: we must use thd->stmt_arena
Allocate rand structure once: we must use thd->stmt_arena
to create rand in proper mem_root if it's a prepared statement or
to create rand in proper mem_root if it's a prepared statement or
...
@@ -2065,20 +2072,9 @@ bool Item_func_rand::fix_fields(THD *thd,Item **ref)
...
@@ -2065,20 +2072,9 @@ bool Item_func_rand::fix_fields(THD *thd,Item **ref)
if
(
!
rand
&&
!
(
rand
=
(
struct
rand_struct
*
)
if
(
!
rand
&&
!
(
rand
=
(
struct
rand_struct
*
)
thd
->
stmt_arena
->
alloc
(
sizeof
(
*
rand
))))
thd
->
stmt_arena
->
alloc
(
sizeof
(
*
rand
))))
return
TRUE
;
return
TRUE
;
/*
PARAM_ITEM is returned if we're in statement prepare and consequently
if
(
args
[
0
]
->
const_item
())
no placeholder value is set yet.
seed_random
(
args
[
0
]);
*/
if
(
args
[
0
]
->
type
()
!=
PARAM_ITEM
)
{
/*
TODO: do not do reinit 'rand' for every execute of PS/SP if
args[0] is a constant.
*/
uint32
tmp
=
(
uint32
)
args
[
0
]
->
val_int
();
randominit
(
rand
,
(
uint32
)
(
tmp
*
0x10001L
+
55555555L
),
(
uint32
)
(
tmp
*
0x10000001L
));
}
}
}
else
else
{
{
...
@@ -2108,6 +2104,8 @@ void Item_func_rand::update_used_tables()
...
@@ -2108,6 +2104,8 @@ void Item_func_rand::update_used_tables()
double
Item_func_rand
::
val_real
()
double
Item_func_rand
::
val_real
()
{
{
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
if
(
arg_count
&&
!
args
[
0
]
->
const_item
())
seed_random
(
args
[
0
]);
return
my_rnd
(
rand
);
return
my_rnd
(
rand
);
}
}
...
...
sql/item_func.h
View file @
7fd3cd9e
...
@@ -679,6 +679,8 @@ class Item_func_rand :public Item_real_func
...
@@ -679,6 +679,8 @@ class Item_func_rand :public Item_real_func
bool
const_item
()
const
{
return
0
;
}
bool
const_item
()
const
{
return
0
;
}
void
update_used_tables
();
void
update_used_tables
();
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
private:
void
seed_random
(
Item
*
val
);
};
};
...
...
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