Module: DB Interface Module Group: Open SQL Classes
RWDBTBuffer<T> ...... RWDBAbstractBuffer
entries() isNull() operator[]() |
paramType() RWDBTBuffer() setData() |
setNull() unsetNull() ~RWDBTBuffer() |
#include <rw/db/tbuffer.h>
Class RWDBTBuffer<T> encapsulates a fixed-size array of Types. Memory for these Types can be managed by the user or by an RWDBTBuffer<T> itself. In addition, this class keeps a null indicator vector that indicates whether any item in the array is null. The class also provides mechanisms for converting buffer items to and from RWDBValues, if the chosen Type can be converted.
The parameter Type represents the type of object to be inserted into the Type array, either a class or a fundamental data type. The class Type must have:
Well-defined copy semantics, meaning T::T(const T&) or the equivalent
Well-defined assignment semantics, meaning
T::operator=(const T&) or the equivalent
NOTE -- To create an instance of RWDBTBuffer with the data type RWUString from the Internationalization Module, you must include the header file <rw/db/tbuffer_ustr.h> instead of <rw/db/tbuffer.h>.
Please see Example 1 in the entry for RWDBOSql.
RWDBTBuffer(RWSize_T entries=1, RWSize_T width=0);
Constructs an RWDBTBuffer<T> with entries entries, and width width. Allocates the array of Types of length entries, whose memory is managed by self. entries is forced to be greater than or equal to 1. Allocates the array of null indicators, of length entries, and sets them to false. Memory for the null indicator array is managed by self. If width = 0, the object uses the default width for the Type.
NOTE -- If an invalid value is entered for width, this constructor will ignore it and substitute the default value.
RWDBTBuffer(Type *data, RWSize_T entries=1, RWSize_T width = 0);
Same as above, but the RWDBTBuffer<T> uses data and does not allocate or manage memory for the array. Also, the null indicator array is set to false, and its memory is managed by self.
RWDBTBuffer(Type *data, RWDBNullIndicator *ni, RWSize_T entries=1, RWSize_T width = 0);
Same as above, but the RWDBTBuffer<T> uses the null indicator passed as ni, and does not allocate or manage memory for the null indicator array.
~RWDBTBuffer();
Deletes all data owned by self.
Type& operator[](size_t index);
Performs a bounds check on index in debug mode. Returns a reference to the indexth entry in the Type array. The returned reference may be used as an lvalue. If using this method to assign new value to this entry, an explicit call of unsetNull(index) is needed.
Type operator[](size_t index) const;
Performs a bounds check on index in debug mode. Returns the indexth entry in the array by value. The returned reference may be used as an rvalue.
size_t entries() const;
Returns the number of entries.
bool isNull(size_t index) const;
Performs a bounds check on index in debug mode. Returns true if the indexth entry is NULL.
RWDBColumn::ParamType paramType() const;
Returns a value indicating the parameter type of the column.
void paramType(RWDBColumn::ParamType newType);
Changes the paramType attribute of self to newType. Note that this does not change the definition of the parameter in the database. Returns a reference to self.
void setData(const Type& newData);
Sets all the contents of the Type array to be newData. Unsets NULL for each entry.
void setData(size_t index, const Type& newData);
Sets the indexth entry of the Type array to be newData. Unsets NULL for each entry.
void setNull();
Sets NULL for all entries.
void setNull(size_t index);
Sets NULL at the indexth entry.
void unsetNull();
Unsets NULL for all entries.
void unsetNull(size_t index);
Unsets NULL at the indexth entry.
© 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.