Home How To Online Documentation Support Download Order

 

 

 

SACommand
SAConnection
SAException
SAField
SAParam

SAString
SADateTime
SANumeric
SAInterval

Enums and Typedefs

  

Usage

Class Members

Examples

SAParam::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

After a command execution all output parameters are updated by their values, including Long and BLob(CLob) parameters. If you want to control piecewise reading of Long or BLob(CLob) data you should do the following:

  1. Before a command execution set SA_LongOrLobReaderManual reading mode (see setLongOrLobReaderMode) for Long or BLob(CLob) parameters you want to process by user defined function(s). After that SQLAPI++ will skip reading output Long and BLob(CLob) parameters that you set to be read manually.
  2. After command execution use ReadLongOrLob method for each output parameter defined to be read manually.

Note, that if the command has result set(s) (it is possible in some servers, see Server specific notes ) then output parameters are available only after all result sets are completely processed using SACommand::FetchNext method.

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 parameter 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.    A size of whole Long or BLob(CLob) parameter (if DBMS server allows to know it before whole parameter 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

See Server specific information concerning your SQL server.

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.