Commit 787c9786 authored by magnus@neptunus.(none)'s avatar magnus@neptunus.(none)

Merged ha_ndbcluster.cc

parents 05d83a89 794b3b52
...@@ -25,11 +25,59 @@ pk1 attr1 ...@@ -25,11 +25,59 @@ pk1 attr1
DELETE FROM t1; DELETE FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
pk1 attr1 pk1 attr1
INSERT INTO t1 VALUES (9410,9412); INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765),
(7,8), (8,9), (9,10), (10,11), (11,12), (12,13), (13,14);
UPDATE t1 SET attr1 = 9999;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1
7 9999
8 9999
9 9999
10 9999
11 9999
12 9999
13 9999
9408 9999
9410 9999
9411 9999
UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1
7 9998
8 9998
9 9998
10 9998
11 9998
12 9998
13 9998
9408 9999
9410 9999
9411 9999
UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
SELECT * FROM t1 ORDER BY pk1;
pk1 attr1
7 9998
8 9998
9 9998
10 9998
11 9998
12 9998
13 9998
9408 9997
9410 9997
9411 9997
DELETE FROM t1 WHERE pk1 = 9410; DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
pk1 attr1 pk1 attr1
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765); 7 9998
8 9998
9 9998
10 9998
11 9998
12 9998
13 9998
9408 9997
9411 9997
DELETE FROM t1; DELETE FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
pk1 attr1 pk1 attr1
......
...@@ -23,6 +23,7 @@ SELECT pk1 FROM t1; ...@@ -23,6 +23,7 @@ SELECT pk1 FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
SELECT t1.* FROM t1; SELECT t1.* FROM t1;
# Update on record by primary key
UPDATE t1 SET attr1=1 WHERE pk1=9410; UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1; SELECT * FROM t1;
...@@ -35,13 +36,23 @@ SELECT * FROM t1; ...@@ -35,13 +36,23 @@ SELECT * FROM t1;
DELETE FROM t1; DELETE FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
# Delete the record by specifying pk # Insert more records and update them all at once
INSERT INTO t1 VALUES (9410,9412); INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765),
(7,8), (8,9), (9,10), (10,11), (11,12), (12,13), (13,14);
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;
UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
SELECT * FROM t1 ORDER BY pk1;
# Delete one record by specifying pk
DELETE FROM t1 WHERE pk1 = 9410; DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1; SELECT * FROM t1 ORDER BY pk1;
# Insert three records and delete the # Delete all from table
INSERT INTO t1 VALUES (9410,9412), (9411, 9413), (9408, 8765);
DELETE FROM t1; DELETE FROM t1;
SELECT * FROM t1; SELECT * FROM t1;
......
This diff is collapsed.
...@@ -152,6 +152,7 @@ class ha_ndbcluster: public handler ...@@ -152,6 +152,7 @@ class ha_ndbcluster: public handler
const char* get_unique_index_name(uint idx_no) const; const char* get_unique_index_name(uint idx_no) const;
NDB_INDEX_TYPE get_index_type(uint idx_no) const; NDB_INDEX_TYPE get_index_type(uint idx_no) const;
NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const; NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const;
int get_ndb_lock_type();
int pk_read(const byte *key, uint key_len, int pk_read(const byte *key, uint key_len,
byte *buf); byte *buf);
...@@ -162,12 +163,10 @@ class ha_ndbcluster: public handler ...@@ -162,12 +163,10 @@ class ha_ndbcluster: public handler
bool sorted, byte* buf); bool sorted, byte* buf);
int full_table_scan(byte * buf); int full_table_scan(byte * buf);
int next_result(byte *buf); int next_result(byte *buf);
#if 0 int define_read_attrs(byte* buf, NdbOperation* op);
int filtered_scan(const byte *key, uint key_len, int filtered_scan(const byte *key, uint key_len,
byte *buf, byte *buf,
enum ha_rkey_function find_flag); enum ha_rkey_function find_flag);
#endif
void unpack_record(byte *buf); void unpack_record(byte *buf);
void set_dbname(const char *pathname); void set_dbname(const char *pathname);
...@@ -212,6 +211,7 @@ class ha_ndbcluster: public handler ...@@ -212,6 +211,7 @@ class ha_ndbcluster: public handler
ha_rows rows_to_insert; ha_rows rows_to_insert;
ha_rows rows_inserted; ha_rows rows_inserted;
ha_rows bulk_insert_rows; ha_rows bulk_insert_rows;
ha_rows ops_pending;
}; };
bool ndbcluster_init(void); bool ndbcluster_init(void);
......
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