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
a945c58f
Commit
a945c58f
authored
Mar 23, 2006
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/home/marty/MySQL/mysql-5.0
into mysql.com:/usr/local/home/marty/MySQL/mysql-5.1-new
parents
94814d73
a40d9128
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
132 additions
and
18 deletions
+132
-18
mysql-test/r/ndb_insert.result
mysql-test/r/ndb_insert.result
+27
-1
mysql-test/r/ndb_replace.result
mysql-test/r/ndb_replace.result
+12
-0
mysql-test/t/ndb_insert.test
mysql-test/t/ndb_insert.test
+14
-9
mysql-test/t/ndb_replace.test
mysql-test/t/ndb_replace.test
+11
-0
storage/ndb/include/ndbapi/NdbIndexOperation.hpp
storage/ndb/include/ndbapi/NdbIndexOperation.hpp
+5
-0
storage/ndb/include/ndbapi/NdbOperation.hpp
storage/ndb/include/ndbapi/NdbOperation.hpp
+45
-2
storage/ndb/include/ndbapi/NdbScanOperation.hpp
storage/ndb/include/ndbapi/NdbScanOperation.hpp
+2
-1
storage/ndb/src/ndbapi/NdbIndexOperation.cpp
storage/ndb/src/ndbapi/NdbIndexOperation.cpp
+7
-1
storage/ndb/src/ndbapi/NdbOperation.cpp
storage/ndb/src/ndbapi/NdbOperation.cpp
+2
-1
storage/ndb/src/ndbapi/NdbScanOperation.cpp
storage/ndb/src/ndbapi/NdbScanOperation.cpp
+3
-3
storage/ndb/src/ndbapi/NdbTransaction.cpp
storage/ndb/src/ndbapi/NdbTransaction.cpp
+4
-0
No files found.
mysql-test/r/ndb_insert.result
View file @
a945c58f
...
@@ -577,6 +577,25 @@ pk1 b c
...
@@ -577,6 +577,25 @@ pk1 b c
2 2 17
2 2 17
4 4 3
4 4 3
6 6 3
6 6 3
DELETE FROM t1;
CREATE UNIQUE INDEX bi ON t1(b);
INSERT INTO t1 VALUES
(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);
INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,b=b+10;
select * from t1 order by pk1;
pk1 b c
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
11 11 1
21 21 21
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1(a INT) ENGINE=ndb;
CREATE TABLE t1(a INT) ENGINE=ndb;
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
...
@@ -586,7 +605,7 @@ INSERT IGNORE INTO t1 SELECT a FROM t1;
...
@@ -586,7 +605,7 @@ INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
SELECT * FROM t1;
SELECT * FROM t1
ORDER BY a
;
a
a
1
1
1
1
...
@@ -606,4 +625,11 @@ a
...
@@ -606,4 +625,11 @@ a
1
1
1
1
1
1
DELETE FROM t1;
CREATE UNIQUE INDEX ai ON t1(a);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
SELECT * FROM t1 ORDER BY a;
a
1
DROP TABLE t1;
DROP TABLE t1;
mysql-test/r/ndb_replace.result
View file @
a945c58f
...
@@ -19,3 +19,15 @@ gesuchnr benutzer_id
...
@@ -19,3 +19,15 @@ gesuchnr benutzer_id
2 1
2 1
3 2
3 2
drop table t1;
drop table t1;
CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT,
j INT,
k INT,
UNIQUE INDEX(j)
) ENGINE = ndb;
INSERT INTO t1 VALUES (1,1,23),(2,2,24);
REPLACE INTO t1 (j,k) VALUES (1,42);
REPLACE INTO t1 (i,j) VALUES (17,2);
SELECT * from t1 ORDER BY i;
i j k
3 1 42
17 2 24
mysql-test/t/ndb_insert.test
View file @
a945c58f
...
@@ -591,14 +591,14 @@ DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
...
@@ -591,14 +591,14 @@ DELETE FROM t1 WHERE pk1 = 2 OR pk1 = 4 OR pk1 = 6;
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
17
),(
3
,
4
,
5
)
ON
DUPLICATE
KEY
UPDATE
pk1
=
b
;
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),(
2
,
2
,
17
),(
3
,
4
,
5
)
ON
DUPLICATE
KEY
UPDATE
pk1
=
b
;
select
*
from
t1
where
pk1
=
b
and
b
!=
c
order
by
pk1
;
select
*
from
t1
where
pk1
=
b
and
b
!=
c
order
by
pk1
;
# T
he following test case currently does not work
# T
est handling of duplicate unique
#
DELETE FROM t1;
DELETE
FROM
t1
;
#
CREATE UNIQUE INDEX bi ON t1(b);
CREATE
UNIQUE
INDEX
bi
ON
t1
(
b
);
#
INSERT INTO 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
);
#INSERT INTO t1 VALUES(0,1,0),(21,21,21) ON DUPLICATE KEY UPDATE pk1=b+10,c
=b+10;
INSERT
INTO
t1
VALUES
(
0
,
1
,
0
),(
21
,
21
,
21
)
ON
DUPLICATE
KEY
UPDATE
pk1
=
b
+
10
,
b
=
b
+
10
;
#
select * from t1 order by pk1;
select
*
from
t1
order
by
pk1
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
...
@@ -614,7 +614,12 @@ INSERT IGNORE INTO t1 SELECT a FROM t1;
...
@@ -614,7 +614,12 @@ INSERT IGNORE INTO t1 SELECT a FROM t1;
INSERT
IGNORE
INTO
t1
SELECT
a
FROM
t1
;
INSERT
IGNORE
INTO
t1
SELECT
a
FROM
t1
;
INSERT
IGNORE
INTO
t1
VALUES
(
1
);
INSERT
IGNORE
INTO
t1
VALUES
(
1
);
INSERT
IGNORE
INTO
t1
VALUES
(
1
);
INSERT
IGNORE
INTO
t1
VALUES
(
1
);
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
ORDER
BY
a
;
DELETE
FROM
t1
;
CREATE
UNIQUE
INDEX
ai
ON
t1
(
a
);
INSERT
IGNORE
INTO
t1
VALUES
(
1
);
INSERT
IGNORE
INTO
t1
VALUES
(
1
);
SELECT
*
FROM
t1
ORDER
BY
a
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
# End of 4.1 tests
# End of 4.1 tests
mysql-test/t/ndb_replace.test
View file @
a945c58f
...
@@ -27,4 +27,15 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
...
@@ -27,4 +27,15 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1);
select
*
from
t1
order
by
gesuchnr
;
select
*
from
t1
order
by
gesuchnr
;
drop
table
t1
;
drop
table
t1
;
# bug#17431
CREATE
TABLE
t1
(
i
INT
PRIMARY
KEY
AUTO_INCREMENT
,
j
INT
,
k
INT
,
UNIQUE
INDEX
(
j
)
)
ENGINE
=
ndb
;
INSERT
INTO
t1
VALUES
(
1
,
1
,
23
),(
2
,
2
,
24
);
REPLACE
INTO
t1
(
j
,
k
)
VALUES
(
1
,
42
);
REPLACE
INTO
t1
(
i
,
j
)
VALUES
(
17
,
2
);
SELECT
*
from
t1
ORDER
BY
i
;
# End of 4.1 tests
# End of 4.1 tests
storage/ndb/include/ndbapi/NdbIndexOperation.hpp
View file @
a945c58f
...
@@ -129,6 +129,11 @@ public:
...
@@ -129,6 +129,11 @@ public:
*/
*/
int
deleteTuple
();
int
deleteTuple
();
/**
* Get index object for this operation
*/
const
NdbDictionary
::
Index
*
getIndex
()
const
;
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
#ifndef DOXYGEN_SHOULD_SKIP_DEPRECATED
/**
/**
* Define the NdbIndexOperation to be a standard operation of type
* Define the NdbIndexOperation to be a standard operation of type
...
...
storage/ndb/include/ndbapi/NdbOperation.hpp
View file @
a945c58f
...
@@ -55,6 +55,29 @@ public:
...
@@ -55,6 +55,29 @@ public:
* @{
* @{
*/
*/
/**
* Different access types (supported by sub-classes of NdbOperation)
*/
enum
Type
{
PrimaryKeyAccess
///< Read, insert, update, or delete using pk
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
=
0
// NdbOperation
#endif
,
UniqueIndexAccess
///< Read, update, or delete using unique index
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
=
1
// NdbIndexOperation
#endif
,
TableScan
///< Full table scan
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
=
2
// NdbScanOperation
#endif
,
OrderedIndexScan
///< Ordered index scan
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
=
3
// NdbIndexScanOperation
#endif
};
/**
/**
* Lock when performing read
* Lock when performing read
*/
*/
...
@@ -720,6 +743,11 @@ public:
...
@@ -720,6 +743,11 @@ public:
*/
*/
const
NdbDictionary
::
Table
*
getTable
()
const
;
const
NdbDictionary
::
Table
*
getTable
()
const
;
/**
* Get the type of access for this operation
*/
const
Type
getType
()
const
;
/** @} *********************************************************************/
/** @} *********************************************************************/
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
...
@@ -773,7 +801,7 @@ protected:
...
@@ -773,7 +801,7 @@ protected:
int
init
(
const
class
NdbTableImpl
*
,
NdbTransaction
*
aCon
);
int
init
(
const
class
NdbTableImpl
*
,
NdbTransaction
*
aCon
);
void
initInterpreter
();
void
initInterpreter
();
NdbOperation
(
Ndb
*
aNdb
);
NdbOperation
(
Ndb
*
aNdb
,
Type
aType
=
PrimaryKeyAccess
);
virtual
~
NdbOperation
();
virtual
~
NdbOperation
();
void
next
(
NdbOperation
*
);
// Set next pointer
void
next
(
NdbOperation
*
);
// Set next pointer
NdbOperation
*
next
();
// Get next pointer
NdbOperation
*
next
();
// Get next pointer
...
@@ -887,6 +915,8 @@ protected:
...
@@ -887,6 +915,8 @@ protected:
* These are the private variables that are defined in the operation objects.
* These are the private variables that are defined in the operation objects.
*****************************************************************************/
*****************************************************************************/
Type
m_type
;
NdbReceiver
theReceiver
;
NdbReceiver
theReceiver
;
NdbError
theError
;
// Errorcode
NdbError
theError
;
// Errorcode
...
@@ -1050,6 +1080,19 @@ NdbOperation::getFirstRecAttr() const
...
@@ -1050,6 +1080,19 @@ NdbOperation::getFirstRecAttr() const
return
theReceiver
.
theFirstRecAttr
;
return
theReceiver
.
theFirstRecAttr
;
}
}
/******************************************************************************
Type getType()
Return Value Return the Type.
Remark: Gets type of access.
******************************************************************************/
inline
const
NdbOperation
::
Type
NdbOperation
::
getType
()
const
{
return
m_type
;
}
/******************************************************************************
/******************************************************************************
OperationStatus Status();
OperationStatus Status();
...
...
storage/ndb/include/ndbapi/NdbScanOperation.hpp
View file @
a945c58f
...
@@ -178,7 +178,8 @@ public:
...
@@ -178,7 +178,8 @@ public:
int
restart
(
bool
forceSend
=
false
);
int
restart
(
bool
forceSend
=
false
);
protected:
protected:
NdbScanOperation
(
Ndb
*
aNdb
);
NdbScanOperation
(
Ndb
*
aNdb
,
NdbOperation
::
Type
aType
=
NdbOperation
::
TableScan
);
virtual
~
NdbScanOperation
();
virtual
~
NdbScanOperation
();
int
nextResultImpl
(
bool
fetchAllowed
=
true
,
bool
forceSend
=
false
);
int
nextResultImpl
(
bool
fetchAllowed
=
true
,
bool
forceSend
=
false
);
...
...
storage/ndb/src/ndbapi/NdbIndexOperation.cpp
View file @
a945c58f
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <signaldata/IndxAttrInfo.hpp>
#include <signaldata/IndxAttrInfo.hpp>
NdbIndexOperation
::
NdbIndexOperation
(
Ndb
*
aNdb
)
:
NdbIndexOperation
::
NdbIndexOperation
(
Ndb
*
aNdb
)
:
NdbOperation
(
aNdb
),
NdbOperation
(
aNdb
,
NdbOperation
::
UniqueIndexAccess
),
m_theIndex
(
NULL
)
m_theIndex
(
NULL
)
{
{
m_tcReqGSN
=
GSN_TCINDXREQ
;
m_tcReqGSN
=
GSN_TCINDXREQ
;
...
@@ -164,6 +164,12 @@ int NdbIndexOperation::interpretedDeleteTuple()
...
@@ -164,6 +164,12 @@ int NdbIndexOperation::interpretedDeleteTuple()
return
NdbOperation
::
interpretedDeleteTuple
();
return
NdbOperation
::
interpretedDeleteTuple
();
}
}
const
NdbDictionary
::
Index
*
NdbIndexOperation
::
getIndex
()
const
{
return
m_theIndex
;
}
int
int
NdbIndexOperation
::
prepareSend
(
Uint32
aTC_ConnectPtr
,
Uint64
aTransactionId
)
NdbIndexOperation
::
prepareSend
(
Uint32
aTC_ConnectPtr
,
Uint64
aTransactionId
)
{
{
...
...
storage/ndb/src/ndbapi/NdbOperation.cpp
View file @
a945c58f
...
@@ -37,7 +37,8 @@
...
@@ -37,7 +37,8 @@
* aTable: Pointers to the Table object
* aTable: Pointers to the Table object
* Remark: Creat an object of NdbOperation.
* Remark: Creat an object of NdbOperation.
****************************************************************************/
****************************************************************************/
NdbOperation
::
NdbOperation
(
Ndb
*
aNdb
)
:
NdbOperation
::
NdbOperation
(
Ndb
*
aNdb
,
NdbOperation
::
Type
aType
)
:
m_type
(
aType
),
theReceiver
(
aNdb
),
theReceiver
(
aNdb
),
theErrorLine
(
0
),
theErrorLine
(
0
),
theNdb
(
aNdb
),
theNdb
(
aNdb
),
...
...
storage/ndb/src/ndbapi/NdbScanOperation.cpp
View file @
a945c58f
...
@@ -37,8 +37,8 @@
...
@@ -37,8 +37,8 @@
#define DEBUG_NEXT_RESULT 0
#define DEBUG_NEXT_RESULT 0
NdbScanOperation
::
NdbScanOperation
(
Ndb
*
aNdb
)
:
NdbScanOperation
::
NdbScanOperation
(
Ndb
*
aNdb
,
NdbOperation
::
Type
aType
)
:
NdbOperation
(
aNdb
),
NdbOperation
(
aNdb
,
aType
),
m_transConnection
(
NULL
)
m_transConnection
(
NULL
)
{
{
theParallelism
=
0
;
theParallelism
=
0
;
...
@@ -1032,7 +1032,7 @@ NdbScanOperation::getBlobHandle(Uint32 anAttrId)
...
@@ -1032,7 +1032,7 @@ NdbScanOperation::getBlobHandle(Uint32 anAttrId)
}
}
NdbIndexScanOperation
::
NdbIndexScanOperation
(
Ndb
*
aNdb
)
NdbIndexScanOperation
::
NdbIndexScanOperation
(
Ndb
*
aNdb
)
:
NdbScanOperation
(
aNdb
)
:
NdbScanOperation
(
aNdb
,
NdbOperation
::
OrderedIndexScan
)
{
{
}
}
...
...
storage/ndb/src/ndbapi/NdbTransaction.cpp
View file @
a945c58f
...
@@ -1193,6 +1193,8 @@ NdbTransaction::getNdbIndexScanOperation(const NdbIndexImpl* index,
...
@@ -1193,6 +1193,8 @@ NdbTransaction::getNdbIndexScanOperation(const NdbIndexImpl* index,
{
{
tOp
->
m_currentTable
=
table
;
tOp
->
m_currentTable
=
table
;
}
}
// Mark that this really an NdbIndexScanOperation
tOp
->
m_type
=
NdbOperation
::
OrderedIndexScan
;
return
tOp
;
return
tOp
;
}
else
{
}
else
{
setOperationErrorCodeAbort
(
4271
);
setOperationErrorCodeAbort
(
4271
);
...
@@ -1254,6 +1256,8 @@ NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab)
...
@@ -1254,6 +1256,8 @@ NdbTransaction::getNdbScanOperation(const NdbTableImpl * tab)
if
(
tOp
->
init
(
tab
,
this
)
!=
-
1
)
{
if
(
tOp
->
init
(
tab
,
this
)
!=
-
1
)
{
define_scan_op
(
tOp
);
define_scan_op
(
tOp
);
// Mark that this NdbIndexScanOperation is used as NdbScanOperation
tOp
->
m_type
=
NdbOperation
::
TableScan
;
return
tOp
;
return
tOp
;
}
else
{
}
else
{
theNdb
->
releaseScanOperation
(
tOp
);
theNdb
->
releaseScanOperation
(
tOp
);
...
...
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