summaryrefslogtreecommitdiff
path: root/ndb/test/ndbapi
diff options
context:
space:
mode:
authorunknown <joreland@mysql.com>2005-06-08 16:55:06 +0200
committerunknown <joreland@mysql.com>2005-06-08 16:55:06 +0200
commitdbfce2a55576b0a55b219110193e8fce32a78981 (patch)
tree76cc090a86aec7dcae3a4d44cc449a1e3bb0cc22 /ndb/test/ndbapi
parente595b7ee9db2e1aecadc68a11d821b65c42de1a1 (diff)
parenta7917b1e8aa10bf57c97443273771929dbadfd1d (diff)
downloadmariadb-git-dbfce2a55576b0a55b219110193e8fce32a78981.tar.gz
Merge mysql.com:/home/jonas/src/mysql-4.1
into mysql.com:/home/jonas/src/mysql-5.0 ndb/src/kernel/blocks/backup/Backup.cpp: Auto merged ndb/src/kernel/blocks/dbacc/DbaccMain.cpp: Auto merged ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged ndb/test/ndbapi/testNdbApi.cpp: Auto merged ndb/test/run-test/daily-basic-tests.txt: Auto merged ndb/tools/restore/Restore.cpp: Auto merged ndb/tools/restore/consumer_restore.cpp: Auto merged
Diffstat (limited to 'ndb/test/ndbapi')
-rw-r--r--ndb/test/ndbapi/testNdbApi.cpp239
1 files changed, 239 insertions, 0 deletions
diff --git a/ndb/test/ndbapi/testNdbApi.cpp b/ndb/test/ndbapi/testNdbApi.cpp
index ad1b1462ae7..65324af6fe6 100644
--- a/ndb/test/ndbapi/testNdbApi.cpp
+++ b/ndb/test/ndbapi/testNdbApi.cpp
@@ -1037,6 +1037,239 @@ int runCheckGetNdbErrorOperation(NDBT_Context* ctx, NDBT_Step* step){
return result;
}
+int runBug_11133(NDBT_Context* ctx, NDBT_Step* step){
+ int result = NDBT_OK;
+ const NdbDictionary::Table* pTab = ctx->getTab();
+
+ HugoOperations hugoOps(*pTab);
+
+ Ndb* pNdb = GETNDB(step);
+ Uint32 lm;
+
+ NdbConnection* pCon = pNdb->startTransaction();
+ if (pCon == NULL){
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+
+ NdbOperation* pOp = pCon->getNdbOperation(pTab->getName());
+ if (pOp == NULL){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+
+ if (pOp->readTuple(NdbOperation::LM_Exclusive) != 0){
+ pNdb->closeTransaction(pCon);
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() == true){
+ if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() != true){
+ if (pOp->getValue(pTab->getColumn(a)->getName()) == NULL) {
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ int check = pCon->execute(NoCommit);
+ if (check == 0){
+ ndbout << "execute worked" << endl;
+ } else {
+ ERR(pCon->getNdbError());
+ result = NDBT_FAILED;
+ }
+
+ pOp = pCon->getNdbOperation(pTab->getName());
+ if (pOp == NULL){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+
+ if (pOp->deleteTuple() != 0){
+ pNdb->closeTransaction(pCon);
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() == true){
+ if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ check = pCon->execute(NoCommit);
+ if (check == 0){
+ ndbout << "execute worked" << endl;
+ } else {
+ ERR(pCon->getNdbError());
+ result = NDBT_FAILED;
+ }
+
+ pOp = pCon->getNdbOperation(pTab->getName());
+ if (pOp == NULL){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+
+ if (pOp->writeTuple() != 0){
+ pNdb->closeTransaction(pCon);
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() == true){
+ if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() != true){
+ if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
+ {
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ check = pCon->execute(NoCommit);
+ if (check == 0){
+ ndbout << "execute worked" << endl;
+ } else {
+ ERR(pCon->getNdbError());
+ result = NDBT_FAILED;
+ }
+
+ pOp = pCon->getNdbOperation(pTab->getName());
+ if (pOp == NULL){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+
+ if (pOp->writeTuple() != 0){
+ pNdb->closeTransaction(pCon);
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() == true){
+ if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() != true){
+ if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
+ {
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ check = pCon->execute(NoCommit);
+ if (check == 0){
+ ndbout << "execute worked" << endl;
+ } else {
+ ERR(pCon->getNdbError());
+ result = NDBT_FAILED;
+ }
+
+ check = pCon->execute(Rollback);
+ if (check == 0){
+ ndbout << "execute worked" << endl;
+ } else {
+ ERR(pCon->getNdbError());
+ result = NDBT_FAILED;
+ }
+
+ pCon->close();
+
+ pCon = pNdb->startTransaction();
+ if (pCon == NULL){
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+
+ pOp = pCon->getNdbOperation(pTab->getName());
+ if (pOp == NULL){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+
+ if (pOp->writeTuple() != 0){
+ pNdb->closeTransaction(pCon);
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() == true){
+ if(hugoOps.equalForAttr(pOp, a, 1) != 0){
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ for(int a = 0; a<pTab->getNoOfColumns(); a++){
+ if (pTab->getColumn(a)->getPrimaryKey() != true){
+ if(hugoOps.setValueForAttr(pOp, a, 1, 1) != 0)
+ {
+ ERR(pCon->getNdbError());
+ pNdb->closeTransaction(pCon);
+ return NDBT_FAILED;
+ }
+ }
+ }
+
+ check = pCon->execute(Commit);
+ if (check == 0){
+ ndbout << "execute worked" << endl;
+ } else {
+ ERR(pCon->getNdbError());
+ result = NDBT_FAILED;
+ }
+
+ return result;
+}
+
+
NDBT_TESTSUITE(testNdbApi);
TESTCASE("MaxNdb",
@@ -1112,6 +1345,12 @@ TESTCASE("ReadWithoutGetValue",
INITIALIZER(runReadWithoutGetValue);
FINALIZER(runClearTable);
}
+TESTCASE("Bug_11133",
+ "Test ReadEx-Delete-Write\n"){
+ INITIALIZER(runLoadTable);
+ INITIALIZER(runBug_11133);
+ FINALIZER(runClearTable);
+}
NDBT_TESTSUITE_END(testNdbApi);
int main(int argc, const char** argv){