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

Public Member Functions

Uint32 getNoOfParentOperations () const
NdbQueryOperationgetParentOperation (Uint32 parentNo) const
Uint32 getNoOfChildOperations () const
NdbQueryOperationgetChildOperation (Uint32 childNo) const
const NdbQueryOperationDefgetQueryOperationDef () const
NdbQuerygetQuery () const
NdbRecAttrgetValue (const char *anAttrName, char *resultBuffer=0)
NdbRecAttrgetValue (Uint32 anAttrId, char *resultBuffer=0)
NdbRecAttrgetValue (const NdbDictionary::Column *column, char *resultBuffer=0)
int setResultRowBuf (const NdbRecord *rec, char *resBuffer, const unsigned char *result_mask=0)
int setResultRowRef (const NdbRecord *rec, const char *&bufRef, const unsigned char *result_mask=0)
NdbQueryOperationImplgetImpl () const
int setOrdering (NdbQueryOptions::ScanOrdering ordering)
NdbQueryOptions::ScanOrdering getOrdering () const
int setParallelism (Uint32 parallelism)
int setMaxParallelism ()
int setAdaptiveParallelism ()
int setBatchSize (Uint32 batchSize)
int setInterpretedCode (const NdbInterpretedCode &code) const
NdbQuery::NextResultOutcome firstResult ()
NdbQuery::NextResultOutcome nextResult (bool fetchAllowed=true, bool forceSend=false)
bool isRowNULL () const
bool isRowChanged () const

Friends

class NdbQueryOperationImpl

Detailed Description

Definition at line 231 of file NdbQueryOperation.hpp.

Member Function Documentation

NdbQuery::NextResultOutcome NdbQueryOperation::firstResult ( )

Local cursor:

Navigate to first result row in this batch of results which depends on the current row(s) from all its ancestors.

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 1530 of file NdbQueryOperation.cpp.

NdbQueryOperationImpl& NdbQueryOperation::getImpl ( ) const
inline

Get object implementing NdbQueryOperation interface.

Definition at line 322 of file NdbQueryOperation.hpp.

NdbQueryOptions::ScanOrdering NdbQueryOperation::getOrdering ( ) const

Get the result ordering for this operation.

Definition at line 1503 of file NdbQueryOperation.cpp.

NdbRecAttr * NdbQueryOperation::getValue ( const char *  anAttrName,
char *  resultBuffer = 0 
)

Defines a retrieval operation of an attribute value. The NDB API allocate memory for the NdbRecAttr object that will hold the returned attribute value.

Note
Note that it is the applications responsibility to allocate enough memory for resultBuffer (if non-NULL). The buffer resultBuffer supplied by the application must be aligned appropriately. The buffer is used directly (avoiding a copy penalty) only if it is aligned on a 4-byte boundary and the attribute size in bytes (i.e. NdbRecAttr::attrSize times NdbRecAttr::arraySize is a multiple of 4).
There are three versions of NdbQueryOperation::getValue with slightly different parameters.
This method does not fetch the attribute value from the database! The NdbRecAttr object returned by this method is not readable/printable before the transaction has been executed with NdbTransaction::execute.
Parameters
anAttrNameAttribute name
resultBufferIf this is non-NULL, then the attribute value will be returned in this parameter.
If NULL, then the attribute value will only be stored in the returned NdbRecAttr object.
Returns
An NdbRecAttr object to hold the value of the attribute, or a NULL pointer (indicating error).

Definition at line 1450 of file NdbQueryOperation.cpp.

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

Local cursor:

Get the next tuple(s) from this operation (and all its descendants?) which depends on the current row(s) from all its ancestors.

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.

If the set of cached records in the NdbApi has been consumed, more will be requested from the datanodes only iff:

The arguments fetchAllowed and forceSend are ignored if this operation is not the root of the pushed query.

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 1536 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

int NdbQueryOperation::setAdaptiveParallelism ( )

Let the system dynamically choose the number of fragments to scan in parallel. The system will try to choose a value that gives optimal performance. This is the default for all scans but the root scan. This method only implemented for non-root scan operations.

Returns
0 if ok, -1 in case of error (call getNdbError() for details.)

Definition at line 1516 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

int NdbQueryOperation::setBatchSize ( Uint32  batchSize)

Set the batch size (max rows per batch) for this operation. This only applies to scan operations, as lookup operations always will have the same batch size as its parent operation, or 1 if it is the root operation.

Parameters
batchSizeBatch size (in number of rows). A value of 0 means use the default batch size.
Returns
0 if ok, -1 in case of error (call getNdbError() for details.)

Definition at line 1520 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

int NdbQueryOperation::setInterpretedCode ( const NdbInterpretedCode code) const

Set the NdbInterpretedCode needed for defining a conditional filter (aka: predicate) for this operation. Might be used both on scan and lookup operations.

Typically, one would create NdbScanFilter and NdbInterpretedCode objects on the stack, e.g.: NdbInterpretedCode code(table); NdbScanFilter filter(code); filter.begin(); filter.ge(0, 5U); // Check if column 1 is greater of equal to 5. filter.end(); queryOp->setInterpretedCode(code);

Parameters
codeThe interpreted code. This object is copied internally, meaning that 'code' may be destroyed as soon as this method returns.
Returns
0 if ok, -1 in case of error (call getNdbError() for details.)

Definition at line 1524 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbQueryOperation::setMaxParallelism ( )

Set the number of fragments to be scanned in parallel to the maximum possible value. This is the default for the root scan operation.

Returns
0 if ok, -1 in case of error (call getNdbError() for details.)

Definition at line 1512 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

int NdbQueryOperation::setOrdering ( NdbQueryOptions::ScanOrdering  ordering)

Define result ordering for ordered index scan. It is an error to call this method on an operation that is not a scan, or to call it if an ordering was already set on the operation defintion by calling NdbQueryOperationDef::setOrdering().

Parameters
orderingThe desired ordering of results.
Returns
0 if ok, -1 in case of error (call getNdbError() for details.)

Definition at line 1497 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbQueryOperation::setParallelism ( Uint32  parallelism)

Set the number of fragments to be scanned in parallel. This only applies to table scans and non-sorted scans of ordered indexes. This method is only implemented for then root scan operation.

Returns
0 if ok, -1 in case of error (call getNdbError() for details.)

Definition at line 1508 of file NdbQueryOperation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

int NdbQueryOperation::setResultRowBuf ( const NdbRecord rec,
char *  resBuffer,
const unsigned char *  result_mask = 0 
)

Retrieval of entire or partial rows may also be specified. For partial retrieval a bitmask should supplied.

The behaviour of mixing NdbRecord retrieval style with NdbRecAttr is is undefined - It should probably not be allowed.

Parameters
recIs a pointer to a NdbRecord specifying the byte layout of the result row.

Defines a buffer sufficient large to hold the result row.

Refers a pointer which will be updated to refer the current result row for this operand.

Parameters
result_maskdefines as subset of attributes to read. The column is only affected if 'mask[attrId >> 3] & (1<<(attrId & 7))' is set
Returns
0 on success, -1 otherwise (call getNdbError() for details).

Definition at line 1475 of file NdbQueryOperation.cpp.

Here is the call graph for this function:


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