From: Date: April 25 2008 5:13pm Subject: bk commit into 5.1 tree (frazer:1.2588) BUG#35876 List-Archive: http://lists.mysql.com/commits/46032 X-Bug: 35876 Message-Id: <200804251513.m3PFD41A005678@forth.ndb.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of frazer. When frazer does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-04-25 16:12:47+01:00, frazer@stripped +2 -0 Bug # 35876 NDBAPI : Old Api scan with no bounds incorrectly handled Changes : - An IndexBound which has neither an upper or lower bound is rejected with new error code - For old Api scans, when no bounds are set, we do not pass a bound into the scan. storage/ndb/src/ndbapi/NdbScanOperation.cpp@stripped, 2008-04-25 16:12:35+01:00, frazer@stripped +32 -4 Bug # 35876 NDBAPI : Old Api scan with no bounds incorrectly handled Changes : - An IndexBound which has neither an upper or lower bound is rejected with new error code - For old Api scans, when no bounds are set, we do not pass a bound into the scan. storage/ndb/src/ndbapi/ndberror.c@stripped, 2008-04-25 16:12:37+01:00, frazer@stripped +1 -0 Bug # 35876 NDBAPI : Old Api scan with no bounds incorrectly handled Changes : - An IndexBound which has neither an upper or lower bound is rejected with new error code - For old Api scans, when no bounds are set, we do not pass a bound into the scan. diff -Nrup a/storage/ndb/src/ndbapi/NdbScanOperation.cpp b/storage/ndb/src/ndbapi/NdbScanOperation.cpp --- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2008-04-08 23:30:18 +01:00 +++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2008-04-25 16:12:35 +01:00 @@ -571,6 +571,14 @@ NdbIndexScanOperation::setBound(const Nd return -1; } + if (((bound.low_key == NULL) && (bound.high_key == NULL)) || + ((bound.low_key_count == 0) && (bound.high_key_count == 0))) + { + /* IndexBound passed has no bound information */ + setErrorCodeAbort(4541); + return -1; + } + m_num_bounds++; if (unlikely((m_num_bounds > 1) && @@ -1720,12 +1728,24 @@ int NdbScanOperation::finaliseScanOldApi { assert(theOperationType == OpenRangeScanRequest); NdbIndexScanOperation *isop = - reinterpret_cast(this); + static_cast(this); /* Prepare a single bound if necessary */ NdbIndexScanOperation::IndexBound ib; - if (isop->buildIndexBoundOldApi(ib) != 0) + NdbIndexScanOperation::IndexBound* ib_ptr= NULL; + + switch (isop->buildIndexBoundOldApi(ib)) { + case 0: + /* Bound was specified */ + ib_ptr= &ib; + break; + case 1: + /* No bound was specified */ + ib_ptr= NULL; + break; + default: return -1; + } /* If this is an ordered scan, then we need * the pk columns in the mask, otherwise we @@ -1740,7 +1760,7 @@ int NdbScanOperation::finaliseScanOldApi m_currentTable->m_ndbrecord, m_savedLockModeOldApi, resultMask, - &ib, + ib_ptr, &options, sizeof(ScanOptions)); @@ -2650,10 +2670,16 @@ NdbIndexScanOperation::setBound(const Nd /* Method called just prior to scan execution to initialise * the passed in IndexBound for the scan using the information * stored by the old API's setBound() call. + * Return codes + * 0 == bound present and built + * 1 == bound not present + * -1 == error */ int NdbIndexScanOperation::buildIndexBoundOldApi(IndexBound& ib) { + int result= 1; + if (lowBound.highestKey != 0) { /* Have a low bound @@ -2672,6 +2698,7 @@ NdbIndexScanOperation::buildIndexBoundOl ib.low_key= lowBound.keyRecAttr->aRef(); ib.low_key_count= lowBound.highestKey; ib.low_inclusive= !lowBound.highestSoFarIsStrict; + result= 0; } else { @@ -2697,6 +2724,7 @@ NdbIndexScanOperation::buildIndexBoundOl ib.high_key= highBound.keyRecAttr->aRef(); ib.high_key_count= highBound.highestKey; ib.high_inclusive= !highBound.highestSoFarIsStrict; + result= 0; } else { @@ -2707,7 +2735,7 @@ NdbIndexScanOperation::buildIndexBoundOl ib.range_no= 0; - return 0; + return result; } /* Method called to release any resources allocated by the old diff -Nrup a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c --- a/storage/ndb/src/ndbapi/ndberror.c 2008-04-01 18:09:23 +01:00 +++ b/storage/ndb/src/ndbapi/ndberror.c 2008-04-25 16:12:37 +01:00 @@ -584,6 +584,7 @@ ErrorBundle ErrorCodes[] = { { 4538, DMEC, AE, "NdbInterpretedCode instruction requires that table is set" }, { 4539, DMEC, AE, "NdbInterpretedCode not supported for operation type" }, { 4540, DMEC, AE, "Attempt to pass an Index column to createRecord. Use base table columns only" }, + { 4541, DMEC, AE, "IndexBound has no bound information" }, { 4200, DMEC, AE, "Status Error when defining an operation" }, { 4201, DMEC, AE, "Variable Arrays not yet supported" },