Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual NdbScanOperation::readTuples()

Description.  This method is used to perform a scan.


virtual int readTuples
      LockMode mode = LM_Read,
      Uint32   flags = 0,
      Uint32   parallel = 0,
      Uint32   batch = 0

Parameters.  This method takes the four parameters listed here:

  • The lock mode; this is a LockMode value.

    Scans with exclusive locks.  When scanning with an exclusive lock, extra care must be taken due to the fact that, if two threads perform this scan simultaneously over the same range, then there is a significant probability of causing a deadlock. The likelihood of a deadlock is increased if the scan is also ordered (that is, using SF_OrderBy or SF_Descending).

    The NdbScanOperation::close() method is also affected by this deadlock, since all outstanding requests are serviced before the scan is actually closed.

  • One or more ScanFlag values. Multiple values are OR'ed together

  • The number of fragments to scan in parallel; use 0 to require that the maximum possible number be used.

  • The batch parameter specifies how many records will be returned to the client from the server by the next NdbScanOperation::nextResult(true) method call. Use 0 to specify the maximum automatically.


    This parameter was ignored prior to MySQL 5.1.12, and the maximum was used (see Bug #20252).

Return value.  Returns 0 on success, -1 on failure.