rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWDBBinaryCallback Class Reference
[Open SQL]

Base class for user-defined callback methods that fetch and send binary data. More...

#include <rw/db/datacb.h>

Inheritance diagram for RWDBBinaryCallback:
RWDBDataCallback

List of all members.

Public Member Functions

 RWDBBinaryCallback (size_t entries=1)
 RWDBBinaryCallback (const RWDBBinaryCallback &cb)
RWDBBinaryCallbackoperator= (const RWDBBinaryCallback &cb)
virtual ~RWDBBinaryCallback ()
virtual bool onFetch (size_t rownum, const void *theData, size_t byteLength, RWDBNullIndicator ni, bool &lastPiece)=0
virtual bool onSend (size_t rownum, void *theData, size_t &byteLength, RWDBNullIndicator &ni, bool &lastPiece)=0

Detailed Description

RWDBBinaryCallback is a base class for user-defined callback methods for binary data. Derive from this class to implement the callback methods to send and retrieve binary data.

Examples

Please see the example in the entry for RWDBDataCallback.


Constructor & Destructor Documentation

RWDBBinaryCallback::RWDBBinaryCallback ( size_t  entries = 1  )  [inline]

Constructs an RWDBBinaryCallback with entries entries. If entries is more than one then array binding is in effect. Please see the DB Interface Module User's Guide chapter "Bulk/Array Input", in the section "Using the Open SQL Classes", for more information.

RWDBBinaryCallback::RWDBBinaryCallback ( const RWDBBinaryCallback cb  )  [inline]

Copy constructor.

virtual RWDBBinaryCallback::~RWDBBinaryCallback (  )  [inline, virtual]

Virtual destructor.


Member Function Documentation

virtual bool RWDBBinaryCallback::onFetch ( size_t  rownum,
const void *  theData,
size_t  byteLength,
RWDBNullIndicator  ni,
bool &  lastPiece 
) [pure virtual]

When data callback classes are bound to a SQL statement and RWDBOSql::fetch() is called to fetch the results, this method is invoked to receive the data.

Parameters:
rownum Which row in the current rowset this data is from (0-based indexing). Each call to RWDBOSql::fetch() retrieves the next rowset from the result set of the SQL statement execution. This method is invoked by the Access Module as many times as needed for each row in the rowset.
theData A pointer to an array containing the fetched data. The contents of theData are undefined if ni is true.
byteLength The length in bytes of the data in theData, if any.
ni The null indicator parameter. true if the fetched value is null, false otherwise.
lastPiece true if this is the last piece of data for this value, otherwise it is false. This parameter can be set to true by the callee to stop fetching data for this row's value and to move to the next row.
Returns:
Return false or throw an exception from this method to stop fetching data and terminate the operation, otherwise return true to continue.
virtual bool RWDBBinaryCallback::onSend ( size_t  rownum,
void *  theData,
size_t &  byteLength,
RWDBNullIndicator ni,
bool &  lastPiece 
) [pure virtual]

When data callback classes are bound to a SQL statement and RWDBOSql::execute() is called to execute the statement this method is invoked as needed to supply the data to send to the database. Note that the method RWDBDataCallback::getLength() may need to be be implemented in the derived class to send data to the database.

Parameters:
rownum The row for which data is needed (0-based indexing). This will always be 0 unless array binding is used. Array binding is in effect when the callback is constructed with entries greater than 1. Please see the DB Interface Module User's Guide chapter "Bulk/Array Input", in the section "Using the Open SQL Classes", for more information.
theData A pointer to an array where the callee should put the data to be sent. If ni is true this parameter is ignored.
byteLength The size of theData in bytes and should be set by the callee to the length in bytes written to theData. If ni is true this parameter is ignored.
ni Set this to true to indicate that a null value is being sent to the database. If ni is true, theData, lastPiece, and byteLength are ignored.
lastPiece When the last piece of data for rownum is being supplied this must be set to true. This parameter is ignored if ni is true.
Returns:
Return false or throw an exception to stop sending data and terminate the operation, otherwise return true.
RWDBBinaryCallback& RWDBBinaryCallback::operator= ( const RWDBBinaryCallback cb  )  [inline]

Assignment operator.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.