Home How To Online Documentation Support Download Order

 

 

 

SACommand
SAConnection
  SAException
  SAField
SAParam

SAString
SADateTime
SANumeric
SAInterval

Enums and Typedefs

  

Usage

Class Members

Examples

SAField::ReadLongOrLob

void ReadLongOrLob( saLongOrLobReader_t fnReader , size_t nReaderWantedPieceSize , void *pAddlData );
throw (SAException);

Starts reading of Long or BLob(CLob) value using user defined callback.

Parameters

fnReader.    The name of user function used for Long or BLob(CLob) data reading. The function must have syntax declared by saLongOrLobReader_t typedef .

nReaderWantedPieceSize.    Size of piece of data user want to get to callback function.

pAddData.    Additional data, passed to callback function.  

Remarks

When you call SACommand::FetchNext method (after a command execution) all fields are updated by their values, including Long and BLob(CLob) fields. If you want to control piecewise reading of Long or BLob(CLob) data you should do the following:

  1. After a command execution set SA_LongOrLobReaderManual reading mode (see setLongOrLobReaderMode) for Long or BLob(CLob) fields you want to process by user defined function(s). After that each SACommand::FetchNext call will skip reading Long and BLob(CLob) fields that you set to be read manually.
  2. After calling SACommand::FetchNext method use ReadLongOrLob method for each field defined to be read manually.

ReadLongOrLob method will repeatedly call user defined function:

void <function Name>(SAPieceType_t ePieceType,
                                   void *pBuf,
                                   size_t nLen,
                                   size_t nBlobSize,
                                   void *pAddlData);

User defined function has the following parameters:

ePieceType.    Parameter passed to the function from SQLAPI++ Library mechanisms. It  defines which piece of data value was read. Can be one of the next SAPieceType_t enum values:

  • SA_FirstPiece    The first (but not the last) piece of data was read.
  • SA_NextPiece    The next (not the first and not the last) piece of data was read.
  • SA_LastPiece    The last piece of data was read.
  • SA_OnePiece    All field data was read as one block.

pBuf.    Pointer to the buffer that contains the data block read from database.

nLen.    The actual size of data in buffer pBuf.

nBlobSize.    Maximum size of whole Long or BLob(CLob) field (if DBMS server allows to know it before whole field was read; otherwise 0).

pAddData.    An additional data user want to pass to the function.

To get more information about reading Long and BLob(CLob) data see Query examples - Step 6.

Server specific notes

No specific information.

See also

setLongOrLobReaderMode

SACommand, saLongOrLobReader_t, SAPieceType_t

Error handling, Query examples

Problems and Questions

If you haven't found the answer to your questions or have some problems on using the Library, please, send e-mail to howto@sqlapi.com.