MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbQuery Class Reference

Public Types

enum  NextResultOutcome { NextResult_error = -1, NextResult_gotRow = 0, NextResult_scanComplete = 1, NextResult_bufferEmpty = 2 }

Public Member Functions

Uint32 getNoOfOperations () const
NdbQueryOperationgetQueryOperation (const char *ident) const
NdbQueryOperationgetQueryOperation (Uint32 index) const
Uint32 getNoOfParameters () const
const NdbParamOperandgetParameter (const char *name) const
const NdbParamOperandgetParameter (Uint32 num) const
int setBound (const NdbRecord *keyRecord, const struct NdbIndexScanOperation::IndexBound *bound)
NextResultOutcome nextResult (bool fetchAllowed=true, bool forceSend=false)
NdbTransactiongetNdbTransaction () const
void close (bool forceSend=false)

Friends

class NdbQueryImpl

Error Handling

const NdbErrorgetNdbError () const
NdbQueryImplgetImpl () const
int isPrunable (bool &pruned) const

Detailed Description

Definition at line 106 of file NdbQueryOperation.hpp.

Member Enumeration Documentation

Possible return values from nextResult().

Definition at line 116 of file NdbQueryOperation.hpp.

Member Function Documentation

void NdbQuery::close ( bool  forceSend = false)

Close query.

Will release most of the internally allocated objects owned by this NdbQuery and detach itself from the NdbQueryDef used to instantiate it.

The application may destruct the NdbQueryDef after ::close() has been called on all NdbQuery objects instantiated from it.

Definition at line 1387 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

NdbQueryImpl& NdbQuery::getImpl ( ) const
inline

Get object implementing NdbQuery interface.

Definition at line 208 of file NdbQueryOperation.hpp.

const NdbError & NdbQuery::getNdbError ( ) const

Get error object with information about the latest error.

Returns
An error object with information about the latest error.

Definition at line 1399 of file NdbQueryOperation.cpp.

Here is the caller graph for this function:

NdbTransaction * NdbQuery::getNdbTransaction ( ) const

Get NdbTransaction object for this query operation

Definition at line 1393 of file NdbQueryOperation.cpp.

int NdbQuery::isPrunable ( bool &  pruned) const

Check if this is a pruned range scan. A range scan is pruned if the ranges are such that only a subset of the fragments need to be scanned for matching tuples.

Parameters
prunedThis will be set to true if the operation is a pruned range scan.
Returns
0 if ok, -1 in case of error (call getNdbError() for details.)

Definition at line 1403 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

NdbQuery::NextResultOutcome NdbQuery::nextResult ( bool  fetchAllowed = true,
bool  forceSend = false 
)

Get the next tuple(s) from the global cursor on the query.

Result row / columns will be updated in the respective result handlers as previously specified on each NdbQueryOperation either by assigning a NdbRecord/rowBuffer or assigning NdbRecAttr to each column to be retrieved.

Parameters
fetchAllowedIf set to false, then fetching is disabled
forceSendIf true send will occur immediately (see Adaptive Send Algorithm)

When fetchAllowed is set to false, the NDB API will not request new batches from the NDB Kernel when all received rows have been exhausted, but will instead return 2 from nextResult(), indicating that new batches must be requested. You must then call nextResult with fetchAllowed = true in order to contact the NDB Kernel for more records, after taking over locks as appropriate.

Note
: All result returned from a NdbQuery are handled as scan results in a cursor like interface.(Even single tuple 'lookup' operations!)
  • After ::execute() the current position of the result set is 'before' the first row. There is no valid data yet in the 'RecAttr' or NdbRecord associated with the NdbQueryOperation!
  • ::nextResult() is required to retrieve the first row. This may also cause any error / status info assicioated with the result set iself to be returned (Like 'NoData', posible type conversion errors, or constraint violations associated with each specific row in the result set.)
Returns
  • NextResult_error (-1): if unsuccessful,
  • NextResult_gotRow (0): if another tuple was received, and
  • NextResult_scanComplete (1): if there are no more tuples to scan.
  • NextResult_bufferEmpty (2): if there are no more cached records in NdbApi

Definition at line 1381 of file NdbQueryOperation.cpp.

Here is the call graph for this function:


The documentation for this class was generated from the following files: