SourcePro 11.1 |
SourcePro® C++ API Reference Guide |
SourcePro C++ Documentation Home |
Provides a mechanism by which a collection of bindable objects can be used with the RWDBValue and RWDBRow interface. More...
#include <rw/db/multirow.h>
Public Member Functions | |
RWDBMultiRow () | |
RWDBMultiRow (const RWDBMultiRow &rhs) | |
RWDBMultiRow (const RWDBSchema &s, size_t rows=1) | |
~RWDBMultiRow () | |
RWDBMultiRow & | operator= (const RWDBMultiRow &r) |
RWDBRow | operator[] (size_t i) const |
RWDBMultiRow & | operator>> (RWDBAbstractBuffer &b) |
RWDBAbstractBuffer & | bufferAt (size_t index) const |
void | append (RWDBAbstractBuffer *item, bool ownership=true) |
size_t | entries () const |
size_t | numberOfColumns () const |
RWDBSchema | schema () const |
Class RWDBMultiRow provides a mechanism by which a collection of bindable objects can be used with the RWDBValue and RWDBRow interface. These bindable objects are subclasses of RWDBAbstractBuffer, typically RWDBTBuffer objects. They can be manually created and appended to the RWDBMultiRow, or the RWDBMultiRow can create appropriate RWDBAbstractBuffer objects when given an RWDBSchema.
Although the internals may differ, you can think of RWDBMultiRow as possessing the following attributes:
true
if the RWDBMultiRow is considered to own the corresponding RWDBAbstractBuffer. #include <rw/db/multirow.h>
Please see Example 2 in the entry for RWDBOSql.
RWDBMultiRow::RWDBMultiRow | ( | ) |
Default constructor. Creates an RWDBMultiRow with no bindable objects or ownership indicators; in other words, an empty instance. Internally, RWDBMultiRow is a handle class that refers to a body that contains the state. The constructor creates a new implementation object for the body.
RWDBMultiRow::RWDBMultiRow | ( | const RWDBMultiRow & | rhs | ) |
Copy constructor. Creates an RWDBMultiRow that shares an implementation with rhs.
RWDBMultiRow::RWDBMultiRow | ( | const RWDBSchema & | s, | |
size_t | rows = 1 | |||
) |
Creates an RWDBMultiRow and populates it with multiple RWDBTBuffer instances, each corresponding to, and type-compatible with, the columns from s. Each created RWDBTBuffer is of length rows. Each created RWDBTBuffer is owned by the RWDBMultiRow.
RWDBMultiRow::~RWDBMultiRow | ( | ) |
Standard handle/body destructor. The destructor of the body object deletes all Type arrays that are owned by the RWDBMultiRow.
void RWDBMultiRow::append | ( | RWDBAbstractBuffer * | item, | |
bool | ownership = true | |||
) |
Appends this bindable object to the collection of bindable objects and appends ownership to the ownership indicator collection.
RWDBAbstractBuffer& RWDBMultiRow::bufferAt | ( | size_t | index | ) | const |
Returns a reference to the index th RWDBAbstractBuffer. Bounds checking is performed on index in debug versions of the library.
size_t RWDBMultiRow::entries | ( | ) | const |
Returns the number of rows. If bindable objects of varying lengths were appended, returns the minimum of the lengths of the contained bindable objects.
size_t RWDBMultiRow::numberOfColumns | ( | ) | const |
Returns the number of columns in the RWDBMultiRow, that is, the number of bindable objects appended to it.
RWDBMultiRow& RWDBMultiRow::operator= | ( | const RWDBMultiRow & | r | ) |
Assignment operator. Discards self's current implementation and shares that of r.
RWDBMultiRow& RWDBMultiRow::operator>> | ( | RWDBAbstractBuffer & | b | ) |
Appends b to the collection of RWDBAbstractBuffer objects. b is not considered to be owned by the RWDBMultiRow. This operator is overloaded to allow the following syntax:
RWDBOSql aSql ("SELECT INTCOL FROM MYTABLE"); RWDBTBuffer<int> aBuffer(10); aSql[0] >> aBuffer; aSql.execute(aConnection); aSql.fetch();
In this example, aBuffer
is appended to the output RWDBMultiRow for the 0
th result set, and the result data for INTCOL
is fetched into aBuffer
. Also see RWDBOSql::operator[](size_t).
RWDBRow RWDBMultiRow::operator[] | ( | size_t | i | ) | const |
Returns an RWDBRow by value for the data in all the contained RWDBAbstractBuffer instances at row i. In debug mode libraries, bounds checking is performed on i. Note that changes made to the returned RWDBRow are not reflected in the RWDBAbstractBuffer instances held by the RWDBMultiRow.
RWDBSchema RWDBMultiRow::schema | ( | ) | const |
Returns the RWDBSchema passed in during construction if the relevant constructor was chosen. Otherwise, creates and returns a schema representing the metadata of the contained RWDBAbstractBuffer instances.
© 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.