mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-0
This commit is contained in:
@@ -821,144 +821,6 @@ SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
|
|||||||
MAX(id)
|
MAX(id)
|
||||||
NULL
|
NULL
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
create table t1m (a int) engine=myisam;
|
|
||||||
create table t1i (a int) engine=innodb;
|
|
||||||
create table t2m (a int) engine=myisam;
|
|
||||||
create table t2i (a int) engine=innodb;
|
|
||||||
insert into t2m values (5);
|
|
||||||
insert into t2i values (5);
|
|
||||||
select min(a) from t1m;
|
|
||||||
min(a)
|
|
||||||
NULL
|
|
||||||
select min(7) from t1m;
|
|
||||||
min(7)
|
|
||||||
NULL
|
|
||||||
select min(7) from DUAL;
|
|
||||||
min(7)
|
|
||||||
NULL
|
|
||||||
explain select min(7) from t2m join t1m;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
|
||||||
select min(7) from t2m join t1m;
|
|
||||||
min(7)
|
|
||||||
NULL
|
|
||||||
select max(a) from t1m;
|
|
||||||
max(a)
|
|
||||||
NULL
|
|
||||||
select max(7) from t1m;
|
|
||||||
max(7)
|
|
||||||
NULL
|
|
||||||
select max(7) from DUAL;
|
|
||||||
max(7)
|
|
||||||
NULL
|
|
||||||
explain select max(7) from t2m join t1m;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
|
||||||
select max(7) from t2m join t1m;
|
|
||||||
max(7)
|
|
||||||
NULL
|
|
||||||
select 1, min(a) from t1m where a=99;
|
|
||||||
1 min(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, min(a) from t1m where 1=99;
|
|
||||||
1 min(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, min(1) from t1m where a=99;
|
|
||||||
1 min(1)
|
|
||||||
1 NULL
|
|
||||||
select 1, min(1) from t1m where 1=99;
|
|
||||||
1 min(1)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(a) from t1m where a=99;
|
|
||||||
1 max(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(a) from t1m where 1=99;
|
|
||||||
1 max(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(1) from t1m where a=99;
|
|
||||||
1 max(1)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(1) from t1m where 1=99;
|
|
||||||
1 max(1)
|
|
||||||
1 NULL
|
|
||||||
select min(a) from t1i;
|
|
||||||
min(a)
|
|
||||||
NULL
|
|
||||||
select min(7) from t1i;
|
|
||||||
min(7)
|
|
||||||
NULL
|
|
||||||
select min(7) from DUAL;
|
|
||||||
min(7)
|
|
||||||
NULL
|
|
||||||
explain select min(7) from t2i join t1i;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
|
||||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
|
||||||
select min(7) from t2i join t1i;
|
|
||||||
min(7)
|
|
||||||
NULL
|
|
||||||
select max(a) from t1i;
|
|
||||||
max(a)
|
|
||||||
NULL
|
|
||||||
select max(7) from t1i;
|
|
||||||
max(7)
|
|
||||||
NULL
|
|
||||||
select max(7) from DUAL;
|
|
||||||
max(7)
|
|
||||||
NULL
|
|
||||||
explain select max(7) from t2i join t1i;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
|
||||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
|
||||||
select max(7) from t2i join t1i;
|
|
||||||
max(7)
|
|
||||||
NULL
|
|
||||||
select 1, min(a) from t1i where a=99;
|
|
||||||
1 min(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, min(a) from t1i where 1=99;
|
|
||||||
1 min(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, min(1) from t1i where a=99;
|
|
||||||
1 min(1)
|
|
||||||
1 NULL
|
|
||||||
select 1, min(1) from t1i where 1=99;
|
|
||||||
1 min(1)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(a) from t1i where a=99;
|
|
||||||
1 max(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(a) from t1i where 1=99;
|
|
||||||
1 max(a)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(1) from t1i where a=99;
|
|
||||||
1 max(1)
|
|
||||||
1 NULL
|
|
||||||
select 1, max(1) from t1i where 1=99;
|
|
||||||
1 max(1)
|
|
||||||
1 NULL
|
|
||||||
explain select count(*), min(7), max(7) from t1m, t1i;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
|
||||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
|
||||||
select count(*), min(7), max(7) from t1m, t1i;
|
|
||||||
count(*) min(7) max(7)
|
|
||||||
0 NULL NULL
|
|
||||||
explain select count(*), min(7), max(7) from t1m, t2i;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
|
||||||
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
|
||||||
select count(*), min(7), max(7) from t1m, t2i;
|
|
||||||
count(*) min(7) max(7)
|
|
||||||
0 NULL NULL
|
|
||||||
explain select count(*), min(7), max(7) from t2m, t1i;
|
|
||||||
id select_type table type possible_keys key key_len ref rows Extra
|
|
||||||
1 SIMPLE t2m system NULL NULL NULL NULL 1
|
|
||||||
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
|
||||||
select count(*), min(7), max(7) from t2m, t1i;
|
|
||||||
count(*) min(7) max(7)
|
|
||||||
0 NULL NULL
|
|
||||||
drop table t1m, t1i, t2m, t2i;
|
|
||||||
create table t2 (ff double);
|
create table t2 (ff double);
|
||||||
insert into t2 values (2.2);
|
insert into t2 values (2.2);
|
||||||
select cast(sum(distinct ff) as decimal(5,2)) from t2;
|
select cast(sum(distinct ff) as decimal(5,2)) from t2;
|
||||||
|
@@ -54,3 +54,141 @@ c.c_id = 218 and expiredate is null;
|
|||||||
slai_id
|
slai_id
|
||||||
12
|
12
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
create table t1m (a int) engine=myisam;
|
||||||
|
create table t1i (a int) engine=innodb;
|
||||||
|
create table t2m (a int) engine=myisam;
|
||||||
|
create table t2i (a int) engine=innodb;
|
||||||
|
insert into t2m values (5);
|
||||||
|
insert into t2i values (5);
|
||||||
|
select min(a) from t1m;
|
||||||
|
min(a)
|
||||||
|
NULL
|
||||||
|
select min(7) from t1m;
|
||||||
|
min(7)
|
||||||
|
NULL
|
||||||
|
select min(7) from DUAL;
|
||||||
|
min(7)
|
||||||
|
NULL
|
||||||
|
explain select min(7) from t2m join t1m;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||||
|
select min(7) from t2m join t1m;
|
||||||
|
min(7)
|
||||||
|
NULL
|
||||||
|
select max(a) from t1m;
|
||||||
|
max(a)
|
||||||
|
NULL
|
||||||
|
select max(7) from t1m;
|
||||||
|
max(7)
|
||||||
|
NULL
|
||||||
|
select max(7) from DUAL;
|
||||||
|
max(7)
|
||||||
|
NULL
|
||||||
|
explain select max(7) from t2m join t1m;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||||
|
select max(7) from t2m join t1m;
|
||||||
|
max(7)
|
||||||
|
NULL
|
||||||
|
select 1, min(a) from t1m where a=99;
|
||||||
|
1 min(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, min(a) from t1m where 1=99;
|
||||||
|
1 min(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, min(1) from t1m where a=99;
|
||||||
|
1 min(1)
|
||||||
|
1 NULL
|
||||||
|
select 1, min(1) from t1m where 1=99;
|
||||||
|
1 min(1)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(a) from t1m where a=99;
|
||||||
|
1 max(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(a) from t1m where 1=99;
|
||||||
|
1 max(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(1) from t1m where a=99;
|
||||||
|
1 max(1)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(1) from t1m where 1=99;
|
||||||
|
1 max(1)
|
||||||
|
1 NULL
|
||||||
|
select min(a) from t1i;
|
||||||
|
min(a)
|
||||||
|
NULL
|
||||||
|
select min(7) from t1i;
|
||||||
|
min(7)
|
||||||
|
NULL
|
||||||
|
select min(7) from DUAL;
|
||||||
|
min(7)
|
||||||
|
NULL
|
||||||
|
explain select min(7) from t2i join t1i;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||||
|
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||||
|
select min(7) from t2i join t1i;
|
||||||
|
min(7)
|
||||||
|
NULL
|
||||||
|
select max(a) from t1i;
|
||||||
|
max(a)
|
||||||
|
NULL
|
||||||
|
select max(7) from t1i;
|
||||||
|
max(7)
|
||||||
|
NULL
|
||||||
|
select max(7) from DUAL;
|
||||||
|
max(7)
|
||||||
|
NULL
|
||||||
|
explain select max(7) from t2i join t1i;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||||
|
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||||
|
select max(7) from t2i join t1i;
|
||||||
|
max(7)
|
||||||
|
NULL
|
||||||
|
select 1, min(a) from t1i where a=99;
|
||||||
|
1 min(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, min(a) from t1i where 1=99;
|
||||||
|
1 min(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, min(1) from t1i where a=99;
|
||||||
|
1 min(1)
|
||||||
|
1 NULL
|
||||||
|
select 1, min(1) from t1i where 1=99;
|
||||||
|
1 min(1)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(a) from t1i where a=99;
|
||||||
|
1 max(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(a) from t1i where 1=99;
|
||||||
|
1 max(a)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(1) from t1i where a=99;
|
||||||
|
1 max(1)
|
||||||
|
1 NULL
|
||||||
|
select 1, max(1) from t1i where 1=99;
|
||||||
|
1 max(1)
|
||||||
|
1 NULL
|
||||||
|
explain select count(*), min(7), max(7) from t1m, t1i;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
||||||
|
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||||
|
select count(*), min(7), max(7) from t1m, t1i;
|
||||||
|
count(*) min(7) max(7)
|
||||||
|
0 NULL NULL
|
||||||
|
explain select count(*), min(7), max(7) from t1m, t2i;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t1m system NULL NULL NULL NULL 0 const row not found
|
||||||
|
1 SIMPLE t2i ALL NULL NULL NULL NULL 1
|
||||||
|
select count(*), min(7), max(7) from t1m, t2i;
|
||||||
|
count(*) min(7) max(7)
|
||||||
|
0 NULL NULL
|
||||||
|
explain select count(*), min(7), max(7) from t2m, t1i;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE t2m system NULL NULL NULL NULL 1
|
||||||
|
1 SIMPLE t1i ALL NULL NULL NULL NULL 1
|
||||||
|
select count(*), min(7), max(7) from t2m, t1i;
|
||||||
|
count(*) min(7) max(7)
|
||||||
|
0 NULL NULL
|
||||||
|
drop table t1m, t1i, t2m, t2i;
|
||||||
|
@@ -500,3 +500,69 @@ select count(*) from t1;
|
|||||||
count(*)
|
count(*)
|
||||||
0
|
0
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (
|
||||||
|
a varchar(40) not null,
|
||||||
|
b mediumint not null,
|
||||||
|
t text,
|
||||||
|
c varchar(2) not null,
|
||||||
|
d bigint not null,
|
||||||
|
primary key (a,b,c),
|
||||||
|
key (c,a),
|
||||||
|
unique key (d)
|
||||||
|
) engine=ndb;
|
||||||
|
insert into t1 (a,b,c,d,t) values ('a',1110,'a',1,@v1);
|
||||||
|
insert into t1 (a,b,c,d,t) values ('b',1110,'a',2,@v2);
|
||||||
|
insert into t1 (a,b,c,d,t) values ('a',1110,'b',3,@v3);
|
||||||
|
insert into t1 (a,b,c,d,t) values ('b',1110,'b',4,@v4);
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
a b c d sha1(t)
|
||||||
|
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||||
|
b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||||
|
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||||
|
b 1110 b 4 NULL
|
||||||
|
select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='a';
|
||||||
|
a b c d sha1(t)
|
||||||
|
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||||
|
select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='b';
|
||||||
|
a b c d sha1(t)
|
||||||
|
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||||
|
update t1 set t=@v4 where a='b' and b=1110 and c='a';
|
||||||
|
update t1 set t=@v2 where a='b' and b=1110 and c='b';
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
a b c d sha1(t)
|
||||||
|
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||||
|
b 1110 a 2 NULL
|
||||||
|
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||||
|
b 1110 b 4 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||||
|
update t1 set t=@v2 where d=2;
|
||||||
|
update t1 set t=@v4 where d=4;
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
a b c d sha1(t)
|
||||||
|
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||||
|
b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||||
|
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||||
|
b 1110 b 4 NULL
|
||||||
|
update t1 set t=@v4 where a='b' and c='a';
|
||||||
|
update t1 set t=@v2 where a='b' and c='b';
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
a b c d sha1(t)
|
||||||
|
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||||
|
b 1110 a 2 NULL
|
||||||
|
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||||
|
b 1110 b 4 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||||
|
update t1 set t=@v2 where b+d=1112;
|
||||||
|
update t1 set t=@v4 where b+d=1114;
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
a b c d sha1(t)
|
||||||
|
a 1110 a 1 558a30713786aa72f66abc1e6a521d55aacdeeb5
|
||||||
|
b 1110 a 2 b238654911689bfb626a3ef9dba4a1ca074e6a5e
|
||||||
|
a 1110 b 3 2b6515f29c20b8e9e17cc597527e516c0de8d612
|
||||||
|
b 1110 b 4 NULL
|
||||||
|
delete from t1 where a='a' and b=1110 and c='a';
|
||||||
|
delete from t1 where a='b' and c='a';
|
||||||
|
delete from t1 where d=3;
|
||||||
|
delete from t1 where b+d=1114;
|
||||||
|
select count(*) from t1;
|
||||||
|
count(*)
|
||||||
|
0
|
||||||
|
drop table t1;
|
||||||
|
@@ -539,77 +539,6 @@ INSERT INTO t1 VALUES
|
|||||||
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
|
SELECT MAX(id) FROM t1 WHERE id < 3 AND a=2 AND b=6;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
#
|
|
||||||
# Bug #12882 min/max inconsistent on empty table
|
|
||||||
#
|
|
||||||
|
|
||||||
--disable_warnings
|
|
||||||
create table t1m (a int) engine=myisam;
|
|
||||||
create table t1i (a int) engine=innodb;
|
|
||||||
create table t2m (a int) engine=myisam;
|
|
||||||
create table t2i (a int) engine=innodb;
|
|
||||||
--enable_warnings
|
|
||||||
insert into t2m values (5);
|
|
||||||
insert into t2i values (5);
|
|
||||||
|
|
||||||
# test with MyISAM
|
|
||||||
select min(a) from t1m;
|
|
||||||
select min(7) from t1m;
|
|
||||||
select min(7) from DUAL;
|
|
||||||
explain select min(7) from t2m join t1m;
|
|
||||||
select min(7) from t2m join t1m;
|
|
||||||
|
|
||||||
select max(a) from t1m;
|
|
||||||
select max(7) from t1m;
|
|
||||||
select max(7) from DUAL;
|
|
||||||
explain select max(7) from t2m join t1m;
|
|
||||||
select max(7) from t2m join t1m;
|
|
||||||
|
|
||||||
select 1, min(a) from t1m where a=99;
|
|
||||||
select 1, min(a) from t1m where 1=99;
|
|
||||||
select 1, min(1) from t1m where a=99;
|
|
||||||
select 1, min(1) from t1m where 1=99;
|
|
||||||
|
|
||||||
select 1, max(a) from t1m where a=99;
|
|
||||||
select 1, max(a) from t1m where 1=99;
|
|
||||||
select 1, max(1) from t1m where a=99;
|
|
||||||
select 1, max(1) from t1m where 1=99;
|
|
||||||
|
|
||||||
# test with InnoDB
|
|
||||||
select min(a) from t1i;
|
|
||||||
select min(7) from t1i;
|
|
||||||
select min(7) from DUAL;
|
|
||||||
explain select min(7) from t2i join t1i;
|
|
||||||
select min(7) from t2i join t1i;
|
|
||||||
|
|
||||||
select max(a) from t1i;
|
|
||||||
select max(7) from t1i;
|
|
||||||
select max(7) from DUAL;
|
|
||||||
explain select max(7) from t2i join t1i;
|
|
||||||
select max(7) from t2i join t1i;
|
|
||||||
|
|
||||||
select 1, min(a) from t1i where a=99;
|
|
||||||
select 1, min(a) from t1i where 1=99;
|
|
||||||
select 1, min(1) from t1i where a=99;
|
|
||||||
select 1, min(1) from t1i where 1=99;
|
|
||||||
|
|
||||||
select 1, max(a) from t1i where a=99;
|
|
||||||
select 1, max(a) from t1i where 1=99;
|
|
||||||
select 1, max(1) from t1i where a=99;
|
|
||||||
select 1, max(1) from t1i where 1=99;
|
|
||||||
|
|
||||||
# mixed MyISAM/InnoDB test
|
|
||||||
explain select count(*), min(7), max(7) from t1m, t1i;
|
|
||||||
select count(*), min(7), max(7) from t1m, t1i;
|
|
||||||
|
|
||||||
explain select count(*), min(7), max(7) from t1m, t2i;
|
|
||||||
select count(*), min(7), max(7) from t1m, t2i;
|
|
||||||
|
|
||||||
explain select count(*), min(7), max(7) from t2m, t1i;
|
|
||||||
select count(*), min(7), max(7) from t2m, t1i;
|
|
||||||
|
|
||||||
drop table t1m, t1i, t2m, t2i;
|
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
# Test of init_connect variable
|
# Test of init_connect variable
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# should work with embedded server after mysqltest is fixed
|
||||||
|
-- source include/not_embedded.inc
|
||||||
connect (con0,localhost,root,,);
|
connect (con0,localhost,root,,);
|
||||||
connection con0;
|
connection con0;
|
||||||
select hex(@a);
|
select hex(@a);
|
||||||
|
@@ -57,3 +57,75 @@ where
|
|||||||
c.c_id = 218 and expiredate is null;
|
c.c_id = 218 and expiredate is null;
|
||||||
|
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #12882 min/max inconsistent on empty table
|
||||||
|
#
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
create table t1m (a int) engine=myisam;
|
||||||
|
create table t1i (a int) engine=innodb;
|
||||||
|
create table t2m (a int) engine=myisam;
|
||||||
|
create table t2i (a int) engine=innodb;
|
||||||
|
--enable_warnings
|
||||||
|
insert into t2m values (5);
|
||||||
|
insert into t2i values (5);
|
||||||
|
|
||||||
|
# test with MyISAM
|
||||||
|
select min(a) from t1m;
|
||||||
|
select min(7) from t1m;
|
||||||
|
select min(7) from DUAL;
|
||||||
|
explain select min(7) from t2m join t1m;
|
||||||
|
select min(7) from t2m join t1m;
|
||||||
|
|
||||||
|
select max(a) from t1m;
|
||||||
|
select max(7) from t1m;
|
||||||
|
select max(7) from DUAL;
|
||||||
|
explain select max(7) from t2m join t1m;
|
||||||
|
select max(7) from t2m join t1m;
|
||||||
|
|
||||||
|
select 1, min(a) from t1m where a=99;
|
||||||
|
select 1, min(a) from t1m where 1=99;
|
||||||
|
select 1, min(1) from t1m where a=99;
|
||||||
|
select 1, min(1) from t1m where 1=99;
|
||||||
|
|
||||||
|
select 1, max(a) from t1m where a=99;
|
||||||
|
select 1, max(a) from t1m where 1=99;
|
||||||
|
select 1, max(1) from t1m where a=99;
|
||||||
|
select 1, max(1) from t1m where 1=99;
|
||||||
|
|
||||||
|
# test with InnoDB
|
||||||
|
select min(a) from t1i;
|
||||||
|
select min(7) from t1i;
|
||||||
|
select min(7) from DUAL;
|
||||||
|
explain select min(7) from t2i join t1i;
|
||||||
|
select min(7) from t2i join t1i;
|
||||||
|
|
||||||
|
select max(a) from t1i;
|
||||||
|
select max(7) from t1i;
|
||||||
|
select max(7) from DUAL;
|
||||||
|
explain select max(7) from t2i join t1i;
|
||||||
|
select max(7) from t2i join t1i;
|
||||||
|
|
||||||
|
select 1, min(a) from t1i where a=99;
|
||||||
|
select 1, min(a) from t1i where 1=99;
|
||||||
|
select 1, min(1) from t1i where a=99;
|
||||||
|
select 1, min(1) from t1i where 1=99;
|
||||||
|
|
||||||
|
select 1, max(a) from t1i where a=99;
|
||||||
|
select 1, max(a) from t1i where 1=99;
|
||||||
|
select 1, max(1) from t1i where a=99;
|
||||||
|
select 1, max(1) from t1i where 1=99;
|
||||||
|
|
||||||
|
# mixed MyISAM/InnoDB test
|
||||||
|
explain select count(*), min(7), max(7) from t1m, t1i;
|
||||||
|
select count(*), min(7), max(7) from t1m, t1i;
|
||||||
|
|
||||||
|
explain select count(*), min(7), max(7) from t1m, t2i;
|
||||||
|
select count(*), min(7), max(7) from t1m, t2i;
|
||||||
|
|
||||||
|
explain select count(*), min(7), max(7) from t2m, t1i;
|
||||||
|
select count(*), min(7), max(7) from t2m, t1i;
|
||||||
|
|
||||||
|
drop table t1m, t1i, t2m, t2i;
|
||||||
|
|
||||||
|
@@ -428,4 +428,60 @@ truncate t1;
|
|||||||
select count(*) from t1;
|
select count(*) from t1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
# -- bug#19956 - var* key, complex key
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
a varchar(40) not null,
|
||||||
|
b mediumint not null,
|
||||||
|
t text,
|
||||||
|
c varchar(2) not null,
|
||||||
|
d bigint not null,
|
||||||
|
primary key (a,b,c),
|
||||||
|
key (c,a),
|
||||||
|
unique key (d)
|
||||||
|
) engine=ndb;
|
||||||
|
|
||||||
|
--disable_query_log
|
||||||
|
set @s1 = 'rggurloniukyehuxdbfkkyzlceixzrehqhvxvxbpwizzvjzpucqmzrhzxzfau';
|
||||||
|
set @s2 = 'ykyymbzqgqlcjhlhmyqelfoaaohvtbekvifukdtnvcrrjveevfakxarxexomz';
|
||||||
|
set @s3 = 'dbnfqyzgtqxalcrwtfsqabknvtfcbpoonxsjiqvmhnfikxxhcgoexlkoezvah';
|
||||||
|
set @v1 = repeat(@s1,123);
|
||||||
|
set @v2 = repeat(@s2,234);
|
||||||
|
set @v3 = repeat(@s3,345);
|
||||||
|
set @v4 = NULL;
|
||||||
|
--enable_query_log
|
||||||
|
|
||||||
|
insert into t1 (a,b,c,d,t) values ('a',1110,'a',1,@v1);
|
||||||
|
insert into t1 (a,b,c,d,t) values ('b',1110,'a',2,@v2);
|
||||||
|
insert into t1 (a,b,c,d,t) values ('a',1110,'b',3,@v3);
|
||||||
|
insert into t1 (a,b,c,d,t) values ('b',1110,'b',4,@v4);
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
|
||||||
|
select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='a';
|
||||||
|
select a,b,c,d,sha1(t) from t1 where a='a' and b=1110 and c='b';
|
||||||
|
|
||||||
|
update t1 set t=@v4 where a='b' and b=1110 and c='a';
|
||||||
|
update t1 set t=@v2 where a='b' and b=1110 and c='b';
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
|
||||||
|
update t1 set t=@v2 where d=2;
|
||||||
|
update t1 set t=@v4 where d=4;
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
|
||||||
|
update t1 set t=@v4 where a='b' and c='a';
|
||||||
|
update t1 set t=@v2 where a='b' and c='b';
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
|
||||||
|
update t1 set t=@v2 where b+d=1112;
|
||||||
|
update t1 set t=@v4 where b+d=1114;
|
||||||
|
select a,b,c,d,sha1(t) from t1 order by c,a;
|
||||||
|
|
||||||
|
delete from t1 where a='a' and b=1110 and c='a';
|
||||||
|
delete from t1 where a='b' and c='a';
|
||||||
|
delete from t1 where d=3;
|
||||||
|
delete from t1 where b+d=1114;
|
||||||
|
select count(*) from t1;
|
||||||
|
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@@ -105,7 +105,8 @@ public:
|
|||||||
void stopSessions(bool wait = false);
|
void stopSessions(bool wait = false);
|
||||||
|
|
||||||
void foreachSession(void (*f)(Session*, void*), void *data);
|
void foreachSession(void (*f)(Session*, void*), void *data);
|
||||||
|
void checkSessions();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct SessionInstance {
|
struct SessionInstance {
|
||||||
Service * m_service;
|
Service * m_service;
|
||||||
@@ -116,12 +117,13 @@ private:
|
|||||||
Service * m_service;
|
Service * m_service;
|
||||||
NDB_SOCKET_TYPE m_socket;
|
NDB_SOCKET_TYPE m_socket;
|
||||||
};
|
};
|
||||||
MutexVector<SessionInstance> m_sessions;
|
NdbLockable m_session_mutex;
|
||||||
|
Vector<SessionInstance> m_sessions;
|
||||||
MutexVector<ServiceInstance> m_services;
|
MutexVector<ServiceInstance> m_services;
|
||||||
unsigned m_maxSessions;
|
unsigned m_maxSessions;
|
||||||
|
|
||||||
void doAccept();
|
void doAccept();
|
||||||
void checkSessions();
|
void checkSessionsImpl();
|
||||||
void startSession(SessionInstance &);
|
void startSession(SessionInstance &);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -184,9 +184,12 @@ SocketServer::doAccept(){
|
|||||||
SessionInstance s;
|
SessionInstance s;
|
||||||
s.m_service = si.m_service;
|
s.m_service = si.m_service;
|
||||||
s.m_session = si.m_service->newSession(childSock);
|
s.m_session = si.m_service->newSession(childSock);
|
||||||
if(s.m_session != 0){
|
if(s.m_session != 0)
|
||||||
|
{
|
||||||
|
m_session_mutex.lock();
|
||||||
m_sessions.push_back(s);
|
m_sessions.push_back(s);
|
||||||
startSession(m_sessions.back());
|
startSession(m_sessions.back());
|
||||||
|
m_session_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -240,10 +243,13 @@ void
|
|||||||
SocketServer::doRun(){
|
SocketServer::doRun(){
|
||||||
|
|
||||||
while(!m_stopThread){
|
while(!m_stopThread){
|
||||||
checkSessions();
|
m_session_mutex.lock();
|
||||||
|
checkSessionsImpl();
|
||||||
if(m_sessions.size() < m_maxSessions){
|
if(m_sessions.size() < m_maxSessions){
|
||||||
|
m_session_mutex.unlock();
|
||||||
doAccept();
|
doAccept();
|
||||||
} else {
|
} else {
|
||||||
|
m_session_mutex.unlock();
|
||||||
NdbSleep_MilliSleep(200);
|
NdbSleep_MilliSleep(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -276,17 +282,30 @@ transfer(NDB_SOCKET_TYPE sock){
|
|||||||
void
|
void
|
||||||
SocketServer::foreachSession(void (*func)(SocketServer::Session*, void *), void *data)
|
SocketServer::foreachSession(void (*func)(SocketServer::Session*, void *), void *data)
|
||||||
{
|
{
|
||||||
|
m_session_mutex.lock();
|
||||||
for(int i = m_sessions.size() - 1; i >= 0; i--){
|
for(int i = m_sessions.size() - 1; i >= 0; i--){
|
||||||
(*func)(m_sessions[i].m_session, data);
|
(*func)(m_sessions[i].m_session, data);
|
||||||
}
|
}
|
||||||
checkSessions();
|
m_session_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SocketServer::checkSessions(){
|
SocketServer::checkSessions()
|
||||||
for(int i = m_sessions.size() - 1; i >= 0; i--){
|
{
|
||||||
if(m_sessions[i].m_session->m_stopped){
|
m_session_mutex.lock();
|
||||||
if(m_sessions[i].m_thread != 0){
|
checkSessionsImpl();
|
||||||
|
m_session_mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SocketServer::checkSessionsImpl()
|
||||||
|
{
|
||||||
|
for(int i = m_sessions.size() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if(m_sessions[i].m_session->m_stopped)
|
||||||
|
{
|
||||||
|
if(m_sessions[i].m_thread != 0)
|
||||||
|
{
|
||||||
void* ret;
|
void* ret;
|
||||||
NdbThread_WaitFor(m_sessions[i].m_thread, &ret);
|
NdbThread_WaitFor(m_sessions[i].m_thread, &ret);
|
||||||
NdbThread_Destroy(&m_sessions[i].m_thread);
|
NdbThread_Destroy(&m_sessions[i].m_thread);
|
||||||
@@ -301,19 +320,26 @@ SocketServer::checkSessions(){
|
|||||||
void
|
void
|
||||||
SocketServer::stopSessions(bool wait){
|
SocketServer::stopSessions(bool wait){
|
||||||
int i;
|
int i;
|
||||||
|
m_session_mutex.lock();
|
||||||
for(i = m_sessions.size() - 1; i>=0; i--)
|
for(i = m_sessions.size() - 1; i>=0; i--)
|
||||||
{
|
{
|
||||||
m_sessions[i].m_session->stopSession();
|
m_sessions[i].m_session->stopSession();
|
||||||
m_sessions[i].m_session->m_stop = true; // to make sure
|
m_sessions[i].m_session->m_stop = true; // to make sure
|
||||||
}
|
}
|
||||||
|
m_session_mutex.unlock();
|
||||||
|
|
||||||
for(i = m_services.size() - 1; i>=0; i--)
|
for(i = m_services.size() - 1; i>=0; i--)
|
||||||
m_services[i].m_service->stopSessions();
|
m_services[i].m_service->stopSessions();
|
||||||
|
|
||||||
if(wait){
|
if(wait){
|
||||||
|
m_session_mutex.lock();
|
||||||
while(m_sessions.size() > 0){
|
while(m_sessions.size() > 0){
|
||||||
checkSessions();
|
checkSessionsImpl();
|
||||||
|
m_session_mutex.unlock();
|
||||||
NdbSleep_MilliSleep(100);
|
NdbSleep_MilliSleep(100);
|
||||||
|
m_session_mutex.lock();
|
||||||
}
|
}
|
||||||
|
m_session_mutex.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,4 +374,4 @@ sessionThread_C(void* _sc){
|
|||||||
}
|
}
|
||||||
|
|
||||||
template class MutexVector<SocketServer::ServiceInstance>;
|
template class MutexVector<SocketServer::ServiceInstance>;
|
||||||
template class MutexVector<SocketServer::SessionInstance>;
|
template class Vector<SocketServer::SessionInstance>;
|
||||||
|
@@ -48,58 +48,66 @@ read_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
|
|||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
int
|
int
|
||||||
readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
|
readln_socket(NDB_SOCKET_TYPE socket, int timeout_millis,
|
||||||
char * buf, int buflen){
|
char * buf, int buflen){
|
||||||
if(buflen <= 1)
|
if(buflen <= 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
int sock_flags= fcntl(socket, F_GETFL);
|
||||||
|
if(fcntl(socket, F_SETFL, sock_flags | O_NONBLOCK) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
fd_set readset;
|
fd_set readset;
|
||||||
FD_ZERO(&readset);
|
FD_ZERO(&readset);
|
||||||
FD_SET(socket, &readset);
|
FD_SET(socket, &readset);
|
||||||
|
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
timeout.tv_sec = (timeout_millis / 1000);
|
timeout.tv_sec = (timeout_millis / 1000);
|
||||||
timeout.tv_usec = (timeout_millis % 1000) * 1000;
|
timeout.tv_usec = (timeout_millis % 1000) * 1000;
|
||||||
|
|
||||||
const int selectRes = select(socket + 1, &readset, 0, 0, &timeout);
|
const int selectRes = select(socket + 1, &readset, 0, 0, &timeout);
|
||||||
if(selectRes == 0)
|
if(selectRes == 0){
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if(selectRes == -1){
|
if(selectRes == -1){
|
||||||
|
fcntl(socket, F_SETFL, sock_flags);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = 0; buf[pos] = 0;
|
|
||||||
while(true){
|
|
||||||
const int t = recv(socket, &buf[pos], 1, 0);
|
|
||||||
if(t != 1){
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(buf[pos] == '\n'){
|
|
||||||
buf[pos] = 0;
|
|
||||||
|
|
||||||
if(pos > 0 && buf[pos-1] == '\r'){
|
buf[0] = 0;
|
||||||
pos--;
|
const int t = recv(socket, buf, buflen, MSG_PEEK);
|
||||||
buf[pos] = 0;
|
|
||||||
|
if(t < 1)
|
||||||
|
{
|
||||||
|
fcntl(socket, F_SETFL, sock_flags);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0; i< t;i++)
|
||||||
|
{
|
||||||
|
if(buf[i] == '\n'){
|
||||||
|
recv(socket, buf, i+1, 0);
|
||||||
|
buf[i] = 0;
|
||||||
|
|
||||||
|
if(i > 0 && buf[i-1] == '\r'){
|
||||||
|
i--;
|
||||||
|
buf[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pos;
|
fcntl(socket, F_SETFL, sock_flags);
|
||||||
}
|
return t;
|
||||||
pos++;
|
|
||||||
if(pos == (buflen - 1)){
|
|
||||||
buf[pos] = 0;
|
|
||||||
return buflen;
|
|
||||||
}
|
|
||||||
|
|
||||||
FD_ZERO(&readset);
|
|
||||||
FD_SET(socket, &readset);
|
|
||||||
timeout.tv_sec = (timeout_millis / 1000);
|
|
||||||
timeout.tv_usec = (timeout_millis % 1000) * 1000;
|
|
||||||
const int selectRes = select(socket + 1, &readset, 0, 0, &timeout);
|
|
||||||
if(selectRes != 1){
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(t == (buflen - 1)){
|
||||||
|
recv(socket, buf, t, 0);
|
||||||
|
buf[t] = 0;
|
||||||
|
fcntl(socket, F_SETFL, sock_flags);
|
||||||
|
return buflen;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@@ -49,7 +49,9 @@ extern EventLogger g_eventLogger;
|
|||||||
enum ndbd_options {
|
enum ndbd_options {
|
||||||
OPT_INITIAL = NDB_STD_OPTIONS_LAST,
|
OPT_INITIAL = NDB_STD_OPTIONS_LAST,
|
||||||
OPT_NODAEMON,
|
OPT_NODAEMON,
|
||||||
OPT_FOREGROUND
|
OPT_FOREGROUND,
|
||||||
|
OPT_NOWAIT_NODES,
|
||||||
|
OPT_INITIAL_START
|
||||||
};
|
};
|
||||||
|
|
||||||
NDB_STD_OPTS_VARS;
|
NDB_STD_OPTS_VARS;
|
||||||
@@ -88,11 +90,11 @@ static struct my_option my_long_options[] =
|
|||||||
" (implies --nodaemon)",
|
" (implies --nodaemon)",
|
||||||
(gptr*) &_foreground, (gptr*) &_foreground, 0,
|
(gptr*) &_foreground, (gptr*) &_foreground, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
{ "nowait-nodes", NO_ARG,
|
{ "nowait-nodes", OPT_NOWAIT_NODES,
|
||||||
"Nodes that will not be waited for during start",
|
"Nodes that will not be waited for during start",
|
||||||
(gptr*) &_nowait_nodes, (gptr*) &_nowait_nodes, 0,
|
(gptr*) &_nowait_nodes, (gptr*) &_nowait_nodes, 0,
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
{ "initial-start", NO_ARG,
|
{ "initial-start", OPT_INITIAL_START,
|
||||||
"Perform initial start",
|
"Perform initial start",
|
||||||
(gptr*) &_initialstart, (gptr*) &_initialstart, 0,
|
(gptr*) &_initialstart, (gptr*) &_initialstart, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
|
@@ -501,6 +501,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
|
|||||||
ps.tick= tick;
|
ps.tick= tick;
|
||||||
m_mgmsrv.get_socket_server()->
|
m_mgmsrv.get_socket_server()->
|
||||||
foreachSession(stop_session_if_timed_out,&ps);
|
foreachSession(stop_session_if_timed_out,&ps);
|
||||||
|
m_mgmsrv.get_socket_server()->checkSessions();
|
||||||
error_string = "";
|
error_string = "";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1558,6 +1559,7 @@ MgmApiSession::purge_stale_sessions(Parser_t::Context &ctx,
|
|||||||
ps.free_nodes.bitXORC(NodeBitmask()); // invert connected_nodes to get free nodes
|
ps.free_nodes.bitXORC(NodeBitmask()); // invert connected_nodes to get free nodes
|
||||||
|
|
||||||
m_mgmsrv.get_socket_server()->foreachSession(stop_session_if_not_connected,&ps);
|
m_mgmsrv.get_socket_server()->foreachSession(stop_session_if_not_connected,&ps);
|
||||||
|
m_mgmsrv.get_socket_server()->checkSessions();
|
||||||
|
|
||||||
m_output->println("purge stale sessions reply");
|
m_output->println("purge stale sessions reply");
|
||||||
if (str.length() > 0)
|
if (str.length() > 0)
|
||||||
|
@@ -91,6 +91,10 @@ public:
|
|||||||
NdbDictionary::Column * m_facade;
|
NdbDictionary::Column * m_facade;
|
||||||
|
|
||||||
static NdbDictionary::Column * create_psuedo(const char *);
|
static NdbDictionary::Column * create_psuedo(const char *);
|
||||||
|
|
||||||
|
// Get total length in bytes, used by NdbOperation
|
||||||
|
// backported from 5.1
|
||||||
|
bool get_var_length(const void* value, Uint32& len) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class NdbTableImpl : public NdbDictionary::Table, public NdbDictObjectImpl {
|
class NdbTableImpl : public NdbDictionary::Table, public NdbDictObjectImpl {
|
||||||
@@ -489,6 +493,27 @@ NdbColumnImpl::getBlobType() const {
|
|||||||
m_type == NdbDictionary::Column::Text);
|
m_type == NdbDictionary::Column::Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
bool
|
||||||
|
NdbColumnImpl::get_var_length(const void* value, Uint32& len) const
|
||||||
|
{
|
||||||
|
Uint32 max_len = m_attrSize * m_arraySize;
|
||||||
|
switch (m_type) {
|
||||||
|
case NdbDictionary::Column::Varchar:
|
||||||
|
case NdbDictionary::Column::Varbinary:
|
||||||
|
len = 1 + *((Uint8*)value);
|
||||||
|
break;
|
||||||
|
case NdbDictionary::Column::Longvarchar:
|
||||||
|
case NdbDictionary::Column::Longvarbinary:
|
||||||
|
len = 2 + uint2korr((char*)value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
len = max_len;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return (len <= max_len);
|
||||||
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
NdbTableImpl &
|
NdbTableImpl &
|
||||||
NdbTableImpl::getImpl(NdbDictionary::Table & t){
|
NdbTableImpl::getImpl(NdbDictionary::Table & t){
|
||||||
|
@@ -71,6 +71,7 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
|
|||||||
Uint32 tKeyInfoPosition;
|
Uint32 tKeyInfoPosition;
|
||||||
const char* aValue = aValuePassed;
|
const char* aValue = aValuePassed;
|
||||||
Uint64 tempData[512];
|
Uint64 tempData[512];
|
||||||
|
Uint64 tempData2[512];
|
||||||
|
|
||||||
if ((theStatus == OperationDefined) &&
|
if ((theStatus == OperationDefined) &&
|
||||||
(aValue != NULL) &&
|
(aValue != NULL) &&
|
||||||
@@ -131,6 +132,19 @@ NdbOperation::equal_impl(const NdbColumnImpl* tAttrInfo,
|
|||||||
OperationType tOpType = theOperationType;
|
OperationType tOpType = theOperationType;
|
||||||
Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
|
Uint32 sizeInBytes = tAttrInfo->m_attrSize * tAttrInfo->m_arraySize;
|
||||||
|
|
||||||
|
Uint32 real_len;
|
||||||
|
if (! tAttrInfo->get_var_length(aValue, real_len)) {
|
||||||
|
setErrorCodeAbort(4209);
|
||||||
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5.0 fixed storage + NdbBlob uses full size => pad var* with nulls
|
||||||
|
if (real_len < sizeInBytes && m_currentTable->m_noOfBlobs != 0) {
|
||||||
|
memcpy(tempData2, aValue, real_len);
|
||||||
|
memset((char*)tempData2 + real_len, 0, sizeInBytes - real_len);
|
||||||
|
aValue = (char*)tempData2;
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* Check if the pointer of the value passed is aligned on a 4 byte
|
* Check if the pointer of the value passed is aligned on a 4 byte
|
||||||
|
Reference in New Issue
Block a user