NdbScanOperation Class Reference

Class of scan operations for use in transactions. More...

#include <NdbScanOperation.hpp>

Inheritance diagram for NdbScanOperation:

NdbOperation NdbIndexScanOperation

List of all members.

Public Types

Public Member Functions


Detailed Description

Class of scan operations for use in transactions.

Member Enumeration Documentation

Scan flags. OR-ed together and passed as second argument to readTuples. Note that SF_MultiRange has to be set if several ranges (bounds) are to be passed.


Member Function Documentation

void NdbScanOperation::close ( bool  forceSend = false,
bool  releaseOp = false 
)

Close scan

int NdbScanOperation::deleteCurrentTuple ( NdbTransaction takeOverTransaction  )  [inline]

Delete current tuple

Parameters:
takeOverTransaction Transaction that should perform the delete
Returns:
0 on success or -1 on failure

int NdbScanOperation::deleteCurrentTuple (  )  [inline]

Delete current tuple

Returns:
0 on success or -1 on failure

NdbOperation * NdbScanOperation::lockCurrentTuple ( NdbTransaction lockTrans  )  [inline]

Lock current tuple

Parameters:
lockTrans Transaction that should perform the lock
Returns:
an NdbOperation or NULL.

NdbOperation * NdbScanOperation::lockCurrentTuple (  )  [inline]

Lock current tuple

Returns:
an NdbOperation or NULL.

int NdbScanOperation::nextResult ( bool  fetchAllowed = true,
bool  forceSend = false 
)

Get the next tuple in a scan transaction.

After each call to nextResult the buffers and NdbRecAttr objects defined in NdbOperation::getValue are updated with values from the scanned tuple.

Parameters:
fetchAllowed If set to false, then fetching is disabled
forceSend If true send will occur immediately (see Adaptive Send Algorithm)
The NDB API will contact the NDB Kernel for more tuples when necessary to do so unless you set the fetchAllowed to false. This will force NDB to process any records it already has in it's caches. When there are no more cached records it will return 2. You must then call nextResult with fetchAllowed = true in order to contact NDB for more records.

fetchAllowed = false is useful when you want to update or delete all the records fetched in one transaction(This will save a lot of round trip time and make updates or deletes of scanned records a lot faster). While nextResult(false) returns 0 take over the record to another transaction. When nextResult(false) returns 2 you must execute and commit the other transaction. This will cause the locks to be transferred to the other transaction, updates or deletes will be made and then the locks will be released. After that, call nextResult(true) which will fetch new records and cache them in the NdbApi.

Note:
If you don't take over the records to another transaction the locks on those records will be released the next time NDB Kernel is contacted for more records.

Please contact for examples of efficient scan updates and deletes.

See ndb/examples/ndbapi_scan_example for usage.

Returns:
  • -1: if unsuccessful,
  • 0: if another tuple was received, and
  • 1: if there are no more tuples to scan.
  • 2: if there are no more cached records in NdbApi

virtual int NdbScanOperation::readTuples ( LockMode  lock_mode = LM_Read,
Uint32  scan_flags = 0,
Uint32  parallel = 0,
Uint32  batch = 0 
) [virtual]

readTuples

Parameters:
lock_mode Lock mode
scan_flags see ScanFlag
parallel No of fragments to scan in parallel (0=max)

Reimplemented in NdbIndexScanOperation.

int NdbScanOperation::restart ( bool  forceSend = false  ) 

Restart scan with exactly the same getValues and search conditions

NdbOperation * NdbScanOperation::updateCurrentTuple ( NdbTransaction updateTrans  )  [inline]

Update current tuple

Parameters:
updateTrans Transaction that should perform the update
Returns:
an NdbOperation or NULL.

NdbOperation * NdbScanOperation::updateCurrentTuple (  )  [inline]

Update current tuple

Returns:
an NdbOperation or NULL.


Documentation generated Sun Jan 17 10:12:17 2010 from mysql source files.
© 2003-2004 MySQL AB