-- source include/have_ndb.inc -- source include/not_embedded.inc --disable_warnings DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7; drop database if exists mysqltest; --enable_warnings # # Basic test to show that the NDB # table handler is working # # # Create a normal table with primary key # CREATE TABLE t1 ( pk1 INT NOT NULL PRIMARY KEY, attr1 INT NOT NULL, attr2 INT, attr3 VARCHAR(10) ) ENGINE=ndbcluster; SHOW INDEX FROM t1; INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413'); SHOW INDEX FROM t1; SELECT pk1 FROM t1 ORDER BY pk1; SELECT * FROM t1 ORDER BY pk1; SELECT t1.* FROM t1 ORDER BY pk1; # Update on record by primary key UPDATE t1 SET attr1=1 WHERE pk1=9410; SELECT * FROM t1 ORDER BY pk1; # Update primary key UPDATE t1 SET pk1=2 WHERE attr1=1; SELECT * FROM t1 ORDER BY pk1; UPDATE t1 SET pk1=pk1 + 1; SELECT * FROM t1 ORDER BY pk1; UPDATE t1 SET pk1=4 WHERE pk1 = 3; SELECT * FROM t1 ORDER BY pk1; # Delete the record DELETE FROM t1; SELECT * FROM t1; # Insert more records and update them all at once INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9408, 8765, NULL, '8765'), (7,8, NULL, NULL), (8,9, NULL, NULL), (9,10, NULL, NULL), (10,11, NULL, NULL), (11,12, NULL, NULL), (12,13, NULL, NULL), (13,14, NULL, NULL); UPDATE t1 SET attr1 = 9999; SELECT * FROM t1 ORDER BY pk1; UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000; SELECT * FROM t1 ORDER BY pk1;