Bug #30178 Patch: the ndbapi_simple_dual, the output is not correct
Submitted: 1 Aug 2007 14:28 Modified: 8 Aug 2007 8:20
Reporter: liang chen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: NDB API Severity:S3 (Non-critical)
Version:mysql-5.1 OS:Any (storage/ndb/ndbapi-examples/ndbapi_simple_dual/main.cpp)
Assigned to: CPU Architecture:Any
Tags: Contribution, mysql-5.1-ndb

[1 Aug 2007 14:28] liang chen
Description:
The comment said:
*  Correct output from this program is:
 *
 *  ATTR1 ATTR2
 *    0    10
 *    1     1
 *    2    12
 *  Detected that deleted tuple doesn't exist!
 *    4    14
 *    5     5
 *    6    16
 *    7     7
 *    8    18
 *    9     9
 *  ATTR1 ATTR2
 *    0    10
 *    1     1
 *    2    12
 *  Detected that deleted tuple doesn't exist!
 *    4    14
 *    5     5
 *    6    16
 *    7     7

But the output is:
  *  ATTR1 ATTR2
 *    0    10
 *    1     1
 *    2    12
 *    4    14
 *    5     5
 *    6    16
 *    7     7
 *    8    18
 *    9     9
 *  ATTR1 ATTR2
 *    0    10
 *    1     1
 *    2    12
 *    4    14
 *    5     5
 *    6    16
 *    7     7

How to repeat:
Just run it.

Suggested fix:
/usr/local/src/mysql-5.1-ndb-bak/storage/ndb/ndbapi-examples/ndbapi_simple_dual/main.cpp    2007-05-30 05:36:06.000000000 +0800
+++ ./main.cpp  2007-08-01 21:59:38.000000000 +0800
@@ -333,6 +333,9 @@
     if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());

     if(myTransaction->execute( NdbTransaction::Commit ) == -1)
+      APIERROR(myTransaction->getNdbError());
+
+    if (myTransaction->getNdbError().classification == NdbError::NoDataFound)
       if (i == 3) {
        std::cout << "Detected that deleted tuple doesn't exist!" << std::endl;
       } else {