Commit f95ebd12 authored by jmiller@mysql.com's avatar jmiller@mysql.com

Changes done from Jonas's review of pervious commit

parent 68ef8b07
...@@ -17,15 +17,15 @@ ALTER TABLESPACE ts1 ...@@ -17,15 +17,15 @@ ALTER TABLESPACE ts1
ADD DATAFILE 'datafile02.dat' ADD DATAFILE 'datafile02.dat'
INITIAL_SIZE = 4M INITIAL_SIZE = 4M
ENGINE=NDB; ENGINE=NDB;
CREATE TABLE test.t1 CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL) (pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK TABLESPACE ts1 STORAGE DISK
ENGINE=NDB; ENGINE=NDB;
INSERT INTO test.t1 VALUES (0, 0, 0); INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM test.t1; SELECT * FROM t1;
pk1 b c pk1 b c
0 0 0 0 0 0
INSERT INTO test.t1 VALUES INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10), (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15), (11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
...@@ -126,7 +126,7 @@ INSERT INTO test.t1 VALUES ...@@ -126,7 +126,7 @@ INSERT INTO test.t1 VALUES
(486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490), (486,486,486),(487,487,487),(488,488,488),(489,489,489),(490,490,490),
(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495), (491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500); (496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
501 501
CREATE LOGFILE GROUP lg2 CREATE LOGFILE GROUP lg2
...@@ -156,198 +156,198 @@ ADD UNDOFILE 'x.dat' ...@@ -156,198 +156,198 @@ ADD UNDOFILE 'x.dat'
INITIAL_SIZE 1000000000000K INITIAL_SIZE 1000000000000K
ENGINE = NDB; ENGINE = NDB;
ERROR HY000: The size number was correct but we don't allow the digit part to be more than 2 billion ERROR HY000: The size number was correct but we don't allow the digit part to be more than 2 billion
DROP TABLE test.t1; DROP TABLE t1;
CREATE TABLE test.t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB; CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
INSERT INTO test.t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3'); INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN; BEGIN;
UPDATE test.t1 SET b = '2' WHERE a = 1; UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
2 2
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 2 1 1 2 1
UPDATE test.t1 SET c = '2' WHERE a = 1; UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
2 2
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 2 2 1 2 2
UPDATE test.t1 SET b = '3' WHERE a = 1; UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
3 3
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 3 2 1 3 2
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 3 2 1 3 2
2 2 2 2 2 2
3 3 3 3 3 3
BEGIN; BEGIN;
UPDATE test.t1 SET c = '3' WHERE a = 1; UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
3 3
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 3 3 1 3 3
UPDATE test.t1 SET b = '4' WHERE a = 1; UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
4 4
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 4 3 1 4 3
UPDATE test.t1 SET c = '4' WHERE a = 1; UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
4 4
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 4 4 1 4 4
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 4 4 1 4 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET b = '5' WHERE a = 1; UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 5 4 1 5 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET b = '6' WHERE b = '5'; UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 6 4 1 6 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET b = '7'WHERE c = '4'; UPDATE t1 SET b = '7'WHERE c = '4';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 4 1 7 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET c = '5' WHERE a = 1; UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 5 1 7 5
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET c = '6' WHERE b = '7'; UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 6 1 7 6
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET c = '7' WHERE c = '6'; UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 7 1 7 7
2 2 2 2 2 2
3 3 3 3 3 3
DROP TABLE test.t1; DROP TABLE t1;
CREATE TABLE test.t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB; CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB;
INSERT INTO test.t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3'); INSERT INTO t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN; BEGIN;
UPDATE test.t1 SET b = '2' WHERE a = 1; UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
2 2
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 2 1 1 2 1
UPDATE test.t1 SET c = '2' WHERE a = 1; UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
2 2
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 2 2 1 2 2
UPDATE test.t1 SET b = '3' WHERE a = 1; UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
3 3
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 3 2 1 3 2
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 3 2 1 3 2
2 2 2 2 2 2
3 3 3 3 3 3
BEGIN; BEGIN;
UPDATE test.t1 SET c = '3' WHERE a = 1; UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
3 3
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 3 3 1 3 3
UPDATE test.t1 SET b = '4' WHERE a = 1; UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
4 4
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 4 3 1 4 3
UPDATE test.t1 SET c = '4' WHERE a = 1; UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
b b
4 4
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
a b c a b c
1 4 4 1 4 4
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 4 4 1 4 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET b = '5' WHERE a = 1; UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 5 4 1 5 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET b = '6' WHERE b = '5'; UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 6 4 1 6 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET b = '7' WHERE c = '4'; UPDATE t1 SET b = '7' WHERE c = '4';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 4 1 7 4
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET c = '5' WHERE a = 1; UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 5 1 7 5
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET c = '6' WHERE b = '7'; UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 6 1 7 6
2 2 2 2 2 2
3 3 3 3 3 3
UPDATE test.t1 SET c = '7' WHERE c = '6'; UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
a b c a b c
1 7 7 1 7 7
2 2 2 2 2 2
3 3 3 3 3 3
DROP TABLE test.t1; DROP TABLE t1;
CREATE TABLE test.t1 ( CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY, a INT NOT NULL PRIMARY KEY,
b TEXT NOT NULL b TEXT NOT NULL
) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER; ) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
...@@ -363,36 +363,36 @@ set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); ...@@ -363,36 +363,36 @@ set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
INSERT INTO test.t1 VALUES(1,@b1); INSERT INTO t1 VALUES(1,@b1);
INSERT INTO test.t1 VALUES(2,@b2); INSERT INTO t1 VALUES(2,@b2);
SELECT a,length(b),substr(b,1+2*900,2) FROM test.t1 WHERE a=1; SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=1;
a length(b) substr(b,1+2*900,2) a length(b) substr(b,1+2*900,2)
1 2256 b1 1 2256 b1
SELECT a,length(b),substr(b,1+2*9000,2) FROM test.t1 WHERE a=2; SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=2;
a length(b) substr(b,1+2*9000,2) a length(b) substr(b,1+2*9000,2)
2 20000 b2 2 20000 b2
UPDATE test.t1 SET b=@b2 WHERE a=1; UPDATE t1 SET b=@b2 WHERE a=1;
UPDATE test.t1 SET b=@b1 WHERE a=2; UPDATE t1 SET b=@b1 WHERE a=2;
SELECT a,length(b),substr(b,1+2*9000,2) FROM test.t1 WHERE a=1; SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=1;
a length(b) substr(b,1+2*9000,2) a length(b) substr(b,1+2*9000,2)
1 20000 b2 1 20000 b2
SELECT a,length(b),substr(b,1+2*900,2) FROM test.t1 WHERE a=2; SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=2;
a length(b) substr(b,1+2*900,2) a length(b) substr(b,1+2*900,2)
2 2256 b1 2 2256 b1
UPDATE test.t1 SET b=concat(b,b) WHERE a=1; UPDATE t1 SET b=concat(b,b) WHERE a=1;
UPDATE test.t1 SET b=concat(b,b) WHERE a=2; UPDATE t1 SET b=concat(b,b) WHERE a=2;
SELECT a,length(b),substr(b,1+4*9000,2) FROM test.t1 WHERE a=1; SELECT a,length(b),substr(b,1+4*9000,2) FROM t1 WHERE a=1;
a length(b) substr(b,1+4*9000,2) a length(b) substr(b,1+4*9000,2)
1 40000 b2 1 40000 b2
SELECT a,length(b),substr(b,1+4*900,2) FROM test.t1 WHERE a=2; SELECT a,length(b),substr(b,1+4*900,2) FROM t1 WHERE a=2;
a length(b) substr(b,1+4*900,2) a length(b) substr(b,1+4*900,2)
2 4512 b1 2 4512 b1
DELETE FROM test.t1 WHERE a=1; DELETE FROM t1 WHERE a=1;
DELETE FROM test.t1 WHERE a=2; DELETE FROM t1 WHERE a=2;
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
0 0
DROP TABLE test.t1; DROP TABLE t1;
ALTER TABLESPACE ts1 ALTER TABLESPACE ts1
DROP DATAFILE 'datafile.dat' DROP DATAFILE 'datafile.dat'
ENGINE = NDB; ENGINE = NDB;
......
...@@ -49,15 +49,15 @@ ENGINE=NDB; ...@@ -49,15 +49,15 @@ ENGINE=NDB;
# Create a table using this tablespace # Create a table using this tablespace
######################################## ########################################
CREATE TABLE test.t1 CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL) (pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK TABLESPACE ts1 STORAGE DISK
ENGINE=NDB; ENGINE=NDB;
INSERT INTO test.t1 VALUES (0, 0, 0); INSERT INTO t1 VALUES (0, 0, 0);
SELECT * FROM test.t1; SELECT * FROM t1;
INSERT INTO test.t1 VALUES INSERT INTO t1 VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5), (1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10), (6,6,6),(7,7,7),(8,8,8),(9,9,9),(10,10,10),
(11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15), (11,11,11),(12,12,12),(13,13,13),(14,14,14),(15,15,15),
...@@ -159,7 +159,7 @@ INSERT INTO test.t1 VALUES ...@@ -159,7 +159,7 @@ INSERT INTO test.t1 VALUES
(491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495), (491,491,491),(492,492,492),(493,493,493),(494,494,494),(495,495,495),
(496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500); (496,496,496),(497,497,497),(498,498,498),(499,499,499),(500, 500, 500);
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM t1;
#################################### ####################################
# Test error cases with size numbers # Test error cases with size numbers
...@@ -194,99 +194,99 @@ ADD UNDOFILE 'x.dat' ...@@ -194,99 +194,99 @@ ADD UNDOFILE 'x.dat'
INITIAL_SIZE 1000000000000K INITIAL_SIZE 1000000000000K
ENGINE = NDB; ENGINE = NDB;
DROP TABLE test.t1; DROP TABLE t1;
############################ ############################
# Test update of mm/dd part # Test update of mm/dd part
############################ ############################
CREATE TABLE test.t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB; CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE = NDB;
INSERT INTO test.t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3'); INSERT INTO t1 VALUES (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN; BEGIN;
UPDATE test.t1 SET b = '2' WHERE a = 1; UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET c = '2' WHERE a = 1; UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET b = '3' WHERE a = 1; UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
BEGIN; BEGIN;
UPDATE test.t1 SET c = '3' WHERE a = 1; UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET b = '4' WHERE a = 1; UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET c = '4' WHERE a = 1; UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET b = '5' WHERE a = 1; UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET b = '6' WHERE b = '5'; UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET b = '7'WHERE c = '4'; UPDATE t1 SET b = '7'WHERE c = '4';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET c = '5' WHERE a = 1; UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET c = '6' WHERE b = '7'; UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET c = '7' WHERE c = '6'; UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
DROP TABLE test.t1; DROP TABLE t1;
##### #####
CREATE TABLE test.t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB; CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4) NOT NULL, c CHAR(4) NOT NULL, KEY(b)) TABLESPACE ts1 STORAGE DISK ENGINE NDB;
INSERT INTO test.t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3'); INSERT INTO t1 VALUE (1,'1','1'), (2,'2','2'), (3,'3','3');
BEGIN; BEGIN;
UPDATE test.t1 SET b = '2' WHERE a = 1; UPDATE t1 SET b = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET c = '2' WHERE a = 1; UPDATE t1 SET c = '2' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET b = '3' WHERE a = 1; UPDATE t1 SET b = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
BEGIN; BEGIN;
UPDATE test.t1 SET c = '3' WHERE a = 1; UPDATE t1 SET c = '3' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET b = '4' WHERE a = 1; UPDATE t1 SET b = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
UPDATE test.t1 SET c = '4' WHERE a = 1; UPDATE t1 SET c = '4' WHERE a = 1;
SELECT b FROM test.t1 WHERE a = 1; SELECT b FROM t1 WHERE a = 1;
SELECT * FROM test.t1 WHERE a = 1; SELECT * FROM t1 WHERE a = 1;
COMMIT; COMMIT;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET b = '5' WHERE a = 1; UPDATE t1 SET b = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET b = '6' WHERE b = '5'; UPDATE t1 SET b = '6' WHERE b = '5';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET b = '7' WHERE c = '4'; UPDATE t1 SET b = '7' WHERE c = '4';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET c = '5' WHERE a = 1; UPDATE t1 SET c = '5' WHERE a = 1;
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET c = '6' WHERE b = '7'; UPDATE t1 SET c = '6' WHERE b = '7';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
UPDATE test.t1 SET c = '7' WHERE c = '6'; UPDATE t1 SET c = '7' WHERE c = '6';
SELECT * FROM test.t1 ORDER BY 1; SELECT * FROM t1 ORDER BY 1;
DROP TABLE test.t1; DROP TABLE t1;
######################## ########################
# Test for blobs... # Test for blobs...
######################## ########################
CREATE TABLE test.t1 ( CREATE TABLE t1 (
a INT NOT NULL PRIMARY KEY, a INT NOT NULL PRIMARY KEY,
b TEXT NOT NULL b TEXT NOT NULL
) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER; ) TABLESPACE ts1 STORAGE DISK ENGINE=NDBCLUSTER;
...@@ -308,22 +308,22 @@ set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); ...@@ -308,22 +308,22 @@ set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2); set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
INSERT INTO test.t1 VALUES(1,@b1); INSERT INTO t1 VALUES(1,@b1);
INSERT INTO test.t1 VALUES(2,@b2); INSERT INTO t1 VALUES(2,@b2);
SELECT a,length(b),substr(b,1+2*900,2) FROM test.t1 WHERE a=1; SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=1;
SELECT a,length(b),substr(b,1+2*9000,2) FROM test.t1 WHERE a=2; SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=2;
UPDATE test.t1 SET b=@b2 WHERE a=1; UPDATE t1 SET b=@b2 WHERE a=1;
UPDATE test.t1 SET b=@b1 WHERE a=2; UPDATE t1 SET b=@b1 WHERE a=2;
SELECT a,length(b),substr(b,1+2*9000,2) FROM test.t1 WHERE a=1; SELECT a,length(b),substr(b,1+2*9000,2) FROM t1 WHERE a=1;
SELECT a,length(b),substr(b,1+2*900,2) FROM test.t1 WHERE a=2; SELECT a,length(b),substr(b,1+2*900,2) FROM t1 WHERE a=2;
UPDATE test.t1 SET b=concat(b,b) WHERE a=1; UPDATE t1 SET b=concat(b,b) WHERE a=1;
UPDATE test.t1 SET b=concat(b,b) WHERE a=2; UPDATE t1 SET b=concat(b,b) WHERE a=2;
SELECT a,length(b),substr(b,1+4*9000,2) FROM test.t1 WHERE a=1; SELECT a,length(b),substr(b,1+4*9000,2) FROM t1 WHERE a=1;
SELECT a,length(b),substr(b,1+4*900,2) FROM test.t1 WHERE a=2; SELECT a,length(b),substr(b,1+4*900,2) FROM t1 WHERE a=2;
DELETE FROM test.t1 WHERE a=1; DELETE FROM t1 WHERE a=1;
DELETE FROM test.t1 WHERE a=2; DELETE FROM t1 WHERE a=2;
SELECT COUNT(*) FROM test.t1; SELECT COUNT(*) FROM t1;
DROP TABLE test.t1; DROP TABLE t1;
################### ###################
# Test Cleanup # Test Cleanup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment