Documentation Home
MySQL NDB Cluster API Developer Guide
Download this Manual

2.3.30.21 NdbTransaction::readTuple()

Description.  This method reads a tuple using NdbRecord objects.

Signature. 

const NdbOperation* readTuple
    (
      const NdbRecord* key_rec,
      const char* key_row,
      const NdbRecord* result_rec,
      char* result_row,
      NdbOperation::LockMode lock_mode = NdbOperation::LM_Read,
      const unsigned char* result_mask = 0,
      const NdbOperation::OperationOptions* opts = 0,
      Uint32 sizeOfOptions = 0
    )

Parameters.  This method takes the following parameters:

  • key_rec is a pointer to an NdbRecord for either a table or an index. If on a table, then the operation uses a primary key; if on an index, then the operation uses a unique key. In either case, the key_rec must include all columns of the key.

  • The key_row passed to this method defines the primary or unique key of the affected tuple, and must remain valid until execute() is called.

    The mask, if not NULL, defines a subset of attributes to read, update, or insert. Only if (mask[attrId >> 3] & (1<<(attrId & 7))) is set is the column affected. The mask is copied by the methods, so need not remain valid after the call returns.

  • result_rec is a pointer to an NdbRecord used to hold the result

  • result_row defines a buffer for the result data.

  • lock_mode specifies the lock mode in effect for the operation. See Section 2.3.25.15, “NdbOperation::LockMode”, for permitted values and other information.

  • result_mask defines a subset of attributes to read. Only if mask[attrId >> 3] & (1<<(attrId & 7)) is set is the column affected. The mask is copied, and so need not remain valid after the method call returns.

  • OperationOptions (opts) can be used to provide more finely-grained control of operation definitions. An OperationOptions structure is passed with flags indicating which operation definition options are present. Not all operation types support all operation options; the options supported for each type of operation are shown in the following table:

    Operation type (Method) OperationOptions Flags Supported
    readTuple() OO_ABORTOPTION, OO_GETVALUE, OO_PARTITION_ID, OO_INTERPRETED
    insertTuple() OO_ABORTOPTION, OO_SETVALUE, OO_PARTITION_ID, OO_ANYVALUE
    updateTuple() OO_ABORTOPTION, OO_SETVALUE, OO_PARTITION_ID, OO_INTERPRETED, OO_ANYVALUE
    writeTuple() OO_ABORTOPTION, OO_SETVALUE, OO_PARTITION_ID, OO_ANYVALUE
    deleteTuple() OO_ABORTOPTION, OO_GETVALUE, OO_PARTITION_ID, OO_INTERPRETED, OO_ANYVALUE
  • The optional sizeOfOptions parameter is used to preserve backward compatibility of this interface with previous definitions of the OperationOptions structure. If an unusual size is detected by the interface implementation, it can use this to determine how to interpret the passed OperationOptions structure. To enable this functionality, the caller should pass sizeof(NdbOperation::OperationOptions) for the value of this argument.

Return value.  A pointer to the NdbOperation representing this read operation (this can be used to check for errors).


User Comments
Sign Up Login You must be logged in to post a comment.