Home How To Online Documentation Support Download Order
 

 

 

 

SACommand
SAConnection
SAException
SAField
SAParam

SAString
SADateTime
SANumeric

Enums and Typedefs

  

Usage

Class Members

Examples

There are four methods of SAValue class to write Long or BLob(CLob) parameters value using user defined callback:

SAString &setAsLongBinary( saLongOrLobWriter_t fnWriter = NULL, size_t nWriterSize = 0, void * pAddlData = NULL);
throw (SAException);

SAString &setAsLongChar( saLongOrLobWriter_t fnWriter = NULL, size_t nWriterSize = 0, void *pAddlData = NULL);
throw (SAException);

SAString &setAsBLob( saLongOrLobWriter_t fnWriter = NULL, size_t nWriterSize = 0, void *pAddlData = NULL);
throw (SAException);

SAString &setAsCLob( saLongOrLobWriter_t fnWriter = NULL, size_t nWriterSize = 0, void *pAddlData = NULL);
throw (SAException);

Parameters

fnWriter.    The name of user function used for Long or BLob(CLob) data writing. The function must have syntax declared by saLongOrLobWriter_t typedef. The default value is NULL. If you use the default value, SQLAPI++ Library will write Long or Lob data from internal buffer without calling user-defined callback.

nWriterSize.    Size of piece of data user want to use for piecewise writing. The default value is 0 . If you use the default value, SQLAPI++ Library will automatically use the most appropriate size for current DBMS.

pAddData.    Additional data that you want to pass to callback function.

Remarks

When you call SACommand::Execute method all input parameters are bound with their values, including Long and BLob(CLob) parameters. If you want to control piecewise writing of Long or BLob(CLob) data you should do the following: before a command execution call one of the setAs... methods (setAsLongBinary method to write Long Binary data, setAsLongChar method to write Long Character data, setAsBLob method to write BLob data, setAsCLob method to write CLob data) with fnWriter parameter which differs from the default value for Long or BLob(CLob) parameters you want to process by user defined function(s). 

Each of four methods will repeatedly call user defined function:

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

User defined function has the following parameters:

ePieceType.    Parameter defines which piece of data value was written. Can be one of the next SAPieceType_t enum values:

  • SA_FirstPiece    The first (but not the last) piece of data is to be written.
  • SA_NextPiece    The next (not the first and not the last) piece of data is to be written.
  • SA_LastPiece    The last piece of data is to be written.
  • SA_OnePiece    All parameter data is to be written as one block.

pBuf.    Pointer to the buffer that contains the data block to write to database.

nLen.    The actual size of data in bufer pBuf.

pAddData .    An additional data.

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

Server specific notes

No specific information.

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.