mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into mysql.com:/usr/local/home/marty/MySQL/mysql-4.1-ndb
This commit is contained in:
commit
c437ac8bf8
3 changed files with 12 additions and 47 deletions
|
@ -3,35 +3,25 @@ CREATE TABLE t1 (
|
|||
pk1 INT NOT NULL PRIMARY KEY,
|
||||
attr1 INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
INSERT INTO t1 VALUES (9410,9412),(9411,9413);
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
SELECT pk1 FROM t1;
|
||||
pk1
|
||||
9410
|
||||
9411
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
9410 9412
|
||||
9411 9413
|
||||
SELECT t1.* FROM t1;
|
||||
pk1 attr1
|
||||
9410 9412
|
||||
9411 9413
|
||||
UPDATE t1 SET attr1=1 WHERE pk1=9410;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
9410 1
|
||||
9411 9413
|
||||
UPDATE t1 SET pk1=2 WHERE attr1=1;
|
||||
ERROR 42000: Table 't1' uses an extension that doesn't exist in this MySQL version
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
2 1
|
||||
9411 9413
|
||||
UPDATE t1 SET pk1=2 WHERE attr1=9413;
|
||||
ERROR 23000: Can't write; duplicate key in table 't1'
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
2 1
|
||||
9411 9413
|
||||
9410 1
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
pk1 attr1
|
||||
|
|
|
@ -17,7 +17,7 @@ CREATE TABLE t1 (
|
|||
attr1 INT NOT NULL
|
||||
) ENGINE=ndbcluster;
|
||||
|
||||
INSERT INTO t1 VALUES (9410,9412),(9411,9413);
|
||||
INSERT INTO t1 VALUES (9410,9412);
|
||||
|
||||
SELECT pk1 FROM t1;
|
||||
SELECT * FROM t1;
|
||||
|
@ -27,16 +27,11 @@ SELECT t1.* FROM t1;
|
|||
UPDATE t1 SET attr1=1 WHERE pk1=9410;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Update pk
|
||||
# Can't UPDATE PK! Test that correct error is returned
|
||||
-- error 1112
|
||||
UPDATE t1 SET pk1=2 WHERE attr1=1;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Try to set same pk
|
||||
# 1022: Can't write; duplicate key in table 't1'
|
||||
-- error 1022
|
||||
UPDATE t1 SET pk1=2 WHERE attr1=9413;
|
||||
SELECT * FROM t1;
|
||||
|
||||
# Delete the record
|
||||
DELETE FROM t1;
|
||||
SELECT * FROM t1;
|
||||
|
|
|
@ -1174,30 +1174,8 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
|
|||
/* Check for update of primary key and return error */
|
||||
if ((table->primary_key != MAX_KEY) &&
|
||||
(key_cmp(table->primary_key, old_data, new_data)))
|
||||
{
|
||||
DBUG_PRINT("info", ("primary key update, doing insert + delete"));
|
||||
int insert_res = write_row(new_data);
|
||||
if (!insert_res)
|
||||
{
|
||||
DBUG_PRINT("info", ("insert succeded"));
|
||||
int delete_res = delete_row(old_data);
|
||||
if (!delete_res)
|
||||
{
|
||||
DBUG_PRINT("info", ("insert + delete succeeded"));
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("info", ("delete failed"));
|
||||
DBUG_RETURN(delete_row(new_data));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DBUG_PRINT("info", ("insert failed"));
|
||||
DBUG_RETURN(insert_res);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(HA_ERR_UNSUPPORTED);
|
||||
|
||||
if (cursor)
|
||||
{
|
||||
/*
|
||||
|
@ -1650,8 +1628,10 @@ int ha_ndbcluster::rnd_init(bool scan)
|
|||
NdbResultSet *cursor= m_active_cursor;
|
||||
DBUG_ENTER("rnd_init");
|
||||
DBUG_PRINT("enter", ("scan: %d", scan));
|
||||
// Check that cursor is not defined
|
||||
if (cursor)
|
||||
// Check if scan is to be restarted
|
||||
if (cursor && scan)
|
||||
cursor->restart();
|
||||
else
|
||||
DBUG_RETURN(1);
|
||||
index_init(table->primary_key);
|
||||
DBUG_RETURN(0);
|
||||
|
|
Loading…
Reference in a new issue