Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c437ac8b
Commit
c437ac8b
authored
Jul 09, 2004
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into mysql.com:/usr/local/home/marty/MySQL/mysql-4.1-ndb
parents
4b13824c
bddd075d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
47 deletions
+12
-47
mysql-test/r/ndb_basic.result
mysql-test/r/ndb_basic.result
+3
-13
mysql-test/t/ndb_basic.test
mysql-test/t/ndb_basic.test
+3
-8
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+6
-26
No files found.
mysql-test/r/ndb_basic.result
View file @
c437ac8b
...
@@ -3,35 +3,25 @@ CREATE TABLE t1 (
...
@@ -3,35 +3,25 @@ CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
attr1 INT NOT NULL
) ENGINE=ndbcluster;
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412)
,(9411,9413)
;
INSERT INTO t1 VALUES (9410,9412);
SELECT pk1 FROM t1;
SELECT pk1 FROM t1;
pk1
pk1
9410
9410
9411
SELECT * FROM t1;
SELECT * FROM t1;
pk1 attr1
pk1 attr1
9410 9412
9410 9412
9411 9413
SELECT t1.* FROM t1;
SELECT t1.* FROM t1;
pk1 attr1
pk1 attr1
9410 9412
9410 9412
9411 9413
UPDATE t1 SET attr1=1 WHERE pk1=9410;
UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1;
SELECT * FROM t1;
pk1 attr1
pk1 attr1
9410 1
9410 1
9411 9413
UPDATE t1 SET pk1=2 WHERE attr1=1;
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;
SELECT * FROM t1;
pk1 attr1
pk1 attr1
2 1
9410 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
DELETE FROM t1;
DELETE FROM t1;
SELECT * FROM t1;
SELECT * FROM t1;
pk1 attr1
pk1 attr1
...
...
mysql-test/t/ndb_basic.test
View file @
c437ac8b
...
@@ -17,7 +17,7 @@ CREATE TABLE t1 (
...
@@ -17,7 +17,7 @@ CREATE TABLE t1 (
attr1
INT
NOT
NULL
attr1
INT
NOT
NULL
)
ENGINE
=
ndbcluster
;
)
ENGINE
=
ndbcluster
;
INSERT
INTO
t1
VALUES
(
9410
,
9412
)
,(
9411
,
9413
)
;
INSERT
INTO
t1
VALUES
(
9410
,
9412
);
SELECT
pk1
FROM
t1
;
SELECT
pk1
FROM
t1
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
...
@@ -27,16 +27,11 @@ SELECT t1.* FROM t1;
...
@@ -27,16 +27,11 @@ SELECT t1.* FROM t1;
UPDATE
t1
SET
attr1
=
1
WHERE
pk1
=
9410
;
UPDATE
t1
SET
attr1
=
1
WHERE
pk1
=
9410
;
SELECT
*
FROM
t1
;
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
;
UPDATE
t1
SET
pk1
=
2
WHERE
attr1
=
1
;
SELECT
*
FROM
t1
;
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 the record
DELETE
FROM
t1
;
DELETE
FROM
t1
;
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
...
...
sql/ha_ndbcluster.cc
View file @
c437ac8b
...
@@ -1174,30 +1174,8 @@ int ha_ndbcluster::update_row(const byte *old_data, byte *new_data)
...
@@ -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 */
/* Check for update of primary key and return error */
if
((
table
->
primary_key
!=
MAX_KEY
)
&&
if
((
table
->
primary_key
!=
MAX_KEY
)
&&
(
key_cmp
(
table
->
primary_key
,
old_data
,
new_data
)))
(
key_cmp
(
table
->
primary_key
,
old_data
,
new_data
)))
{
DBUG_RETURN
(
HA_ERR_UNSUPPORTED
);
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
);
}
}
if
(
cursor
)
if
(
cursor
)
{
{
/*
/*
...
@@ -1650,8 +1628,10 @@ int ha_ndbcluster::rnd_init(bool scan)
...
@@ -1650,8 +1628,10 @@ int ha_ndbcluster::rnd_init(bool scan)
NdbResultSet
*
cursor
=
m_active_cursor
;
NdbResultSet
*
cursor
=
m_active_cursor
;
DBUG_ENTER
(
"rnd_init"
);
DBUG_ENTER
(
"rnd_init"
);
DBUG_PRINT
(
"enter"
,
(
"scan: %d"
,
scan
));
DBUG_PRINT
(
"enter"
,
(
"scan: %d"
,
scan
));
// Check that cursor is not defined
// Check if scan is to be restarted
if
(
cursor
)
if
(
cursor
&&
scan
)
cursor
->
restart
();
else
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
index_init
(
table
->
primary_key
);
index_init
(
table
->
primary_key
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment