2.3.18 The NdbBlob Class NdbBlob::ActiveHook NdbBlob::blobsFirstBlob() NdbBlob::blobsNextBlob() NdbBlob::getBlobEventName() NdbBlob::getBlobTableName() NdbBlob::getColumn() NdbBlob::getLength() NdbBlob::getNull() NdbBlob::getNdbError() NdbBlob::getNdbOperation() NdbBlob::getPos() NdbBlob::getState() NdbBlob::getValue() NdbBlob::getVersion() NdbBlob::readData() NdbBlob::setActiveHook() NdbBlob::setNull() NdbBlob::setPos() NdbBlob::setValue() NdbBlob::State NdbBlob::truncate() NdbBlob::writeData()


This class represents a handle to a BLOB column and provides read and write access to BLOB column values. This object has a number of different states and provides several modes of access to BLOB data; these are also described in this section.

Parent class.  None

Child classes.  None

Description.  This class has no public constructor. An instance of NdbBlob is created using the NdbOperation::getBlobHandle() method during the operation preparation phase. (See Section 2.3.25, “The NdbOperation Class”.) This object acts as a handle on a BLOB column.

BLOB Data Storage.  BLOB data is stored in 2 locations:

The inline and data segment sizes can be set using the appropriate Column methods when the table is created. See Section 2.3.2, “The Column Class”, for more information about these methods.

Data Access Types.  NdbBlob supports 3 types of data access: These data access types can be applied in combination, provided that they are used in the order given above.

BLOB Operations.  BLOB operations take effect when the next transaction is executed. In some cases, NdbBlob is forced to perform implicit execution. To avoid this, you should always operate on complete blob data segments.

Use NdbTransaction::executePendingBlobOps() to flush reads and writes, which avoids any execution penalty if no operations are pending. This is not necessary following execution of operations, or after the next scan result.

NdbBlob also supports reading post- or pre-blob data from events. The handle can be read after the next event on the main table has been retrieved. The data becomes available immediately. (See Section 2.3.21, “The NdbEventOperation Class”, for more information.)

BLOBs and NdbOperations.  NdbOperation methods acting on NdbBlob objects have the following characteristics:.

Known Issues.  The following are known issues or limitations encountered when working with NdbBlob objects:

Methods.  The following table lists the public methods of this class and the purpose or use of each method:

MethodPurpose / Use
blobsFirstBlob()Gets the first blob in a list.
blobsNextBlob()Gets the next blob in a list
getBlobEventName()Gets a blob event name
getBlobTableName()Gets a blob data segment's table name.
getColumn()Gets a blob column.
getLength()Gets the length of a blob, in bytes
getNdbError()Gets an error (an NdbError object)
getNdbOperation()Get a pointer to the operation (NdbOperation object) to which this NdbBlob object belonged when created.
getNull()Checks whether a blob value is NULL
getPos()Gets the current position for reading/writing
getState()Gets the state of an NdbBlob object
getValue()Prepares to read a blob value
getVersion()Checks whether a blob is statement-based or event-based
readData()Reads data from a blob
setActiveHook()Defines a callback for blob handle activation
setNull()Sets a blob to NULL
setPos()Sets the position at which to begin reading/writing
setValue()Prepares to insert or update a blob value
truncate()Truncates a blob to a given length
writeData()Writes blob data

getBlobTableName() and getBlobEventName() are static methods.


Most NdbBlob methods (nearly all of those whose return type is int) return 0 on success and -1 in the event of failure.

Types.  The public types defined by NdbBlob are shown here:

TypePurpose / Use
ActiveHook()Callback for NdbBlob::setActiveHook()
State()Represents the states that may be assumed by the NdbBlob.

Class diagram.  This diagram shows all the available methods and types of the NdbBlob class:

Figure 2.13 NdbBlob

Public methods and types of the NdbBlob class.