From: Date: August 11 2008 2:44pm Subject: bzr commit into mysql-5.1 tree (frazer:2644) Bug#38717 List-Archive: http://lists.mysql.com/commits/51303 X-Bug: 38717 Message-Id: <200808111244.m7BCigGR001333@forth.ndb.mysql.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1005411601==" --===============1005411601== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///home/frazer/bzr/mysql-5.1-telco-6.2/ ------------------------------------------------------------ revno: 2644 revision-id: frazer@stripped parent: jonas@stripped committer: Frazer Clement branch nick: mysql-5.1-telco-6.2 timestamp: Mon 2008-08-11 13:44:24 +0100 message: Bug#38717 readTuples() can be called > once Add state to NdbScanOperation to determine whether readTuples() has already been called. modified: storage/ndb/include/ndbapi/NdbScanOperation.hpp sp1f-ndbscanoperation.hpp-20040414082357-fjxe5xe43jqfor2px56dwicnrkjwc2kz storage/ndb/src/ndbapi/NdbScanOperation.cpp sp1f-ndbscanoperation.cpp-20040414082425-yr5memqa2kvjbeg5kez5mhmsjkkzcxmz --===============1005411601== MIME-Version: 1.0 Content-Type: text/text/x-diff; charset="us-ascii"; name="patch-2644.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline === modified file 'storage/ndb/include/ndbapi/NdbScanOperation.hpp' --- a/storage/ndb/include/ndbapi/NdbScanOperation.hpp 2008-02-19 15:00:29 +0000 +++ b/storage/ndb/include/ndbapi/NdbScanOperation.hpp 2008-08-11 12:44:24 +0000 @@ -539,6 +539,9 @@ /* This flag indicates whether a scan operation is using the old API */ bool m_scanUsingOldApi; + /* Whether readTuples has been called - only valid for old Api scans */ + bool m_readTuplesCalled; + /* Scan definition information saved by RecAttr scan API */ LockMode m_savedLockModeOldApi; Uint32 m_savedScanFlagsOldApi; === modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp' --- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2008-08-06 15:33:19 +0000 +++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2008-08-11 12:44:24 +0000 @@ -54,6 +54,7 @@ m_executed = false; m_scan_buffer= NULL; m_scanUsingOldApi= true; + m_readTuplesCalled= false; m_interpretedCodeOldApi= NULL; } @@ -120,6 +121,7 @@ m_read_range_no = 0; m_executed = false; m_scanUsingOldApi= true; + m_readTuplesCalled= false; m_interpretedCodeOldApi= NULL; m_api_receivers_count = 0; @@ -951,15 +953,16 @@ Uint32 parallel, Uint32 batch) { - // It is only possible to call readTuples if the scan transaction - // doesn't already contain a scan operation - if (theNdbCon->theScanningOp != NULL) + // It is only possible to call readTuples if readTuples hasn't + // already been called + if (m_readTuplesCalled) { setErrorCode(4605); return -1; } /* Save parameters for later */ + m_readTuplesCalled= true; m_savedLockModeOldApi= lm; m_savedScanFlagsOldApi= scan_flags; m_savedParallelOldApi= parallel; --===============1005411601==--