SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Used to insert an RWDBTBuffer array into a database table. (To insert scalar values, use RWDBInserter.) More...
#include <rw/db/bkins.h>
Public Member Functions | |
RWDBBulkInserter () | |
RWDBBulkInserter (const RWDBBulkInserter &ins) | |
RWDBResult | execute () |
RWDBResult | execute (size_t iters) |
bool | isValid () const |
RWDBBulkInserter & | operator<< (const RWDBAbstractBuffer &val) |
RWDBBulkInserter & | operator<< (const RWDBDateVector &dateVector) |
RWDBBulkInserter & | operator= (const RWDBBulkInserter &ins) |
RWDBBulkInserter & | operator[] (size_t index) |
RWDBBulkInserter & | operator[] (const RWCString &columnName) |
RWDBBulkInserter & | operator[] (const RWDBColumn &column) |
size_t | position () const |
RWDBStatus | status () const |
Like RWDBInserter, RWDBBulkInserter is a class designed to insert data into database tables. The main difference between RWDBBulkInserter and RWDBInserter is that arrays of values are shifted into RWDBBulkInserter for each column in the table, while scalar values are shifted into RWDBInserter. These arrays are passed by reference and need to stay in scope for the duration of the inserter. The class RWDBTBuffer is used for inserting all types of data, including numeric types, dates, strings and binary data.
RWDBBulkInserter is designed around the Interface/Implementation paradigm. An RWDBBulkInserter instance is an interface to a reference-counted implementation; copy constructors and assignment operators produce additional references to a shared implementation. An RWDBBulkInserter implementation is a base class from which a family of database-specific implementations is derived.
The following example uses an RWDBBulkInserter to insert an array of strings and integers into a table.
RWDBBulkInserter::RWDBBulkInserter | ( | ) |
Default constructor. Creates an RWDBBulkInserter whose status is RWDBStatus::notInitialized. This constructor is provided as a convenience; for example, to declare an array of RWDBBulkInserter instances. Usable RWDBBulkInserter objects are obtained from valid RWDBTable objects.
RWDBBulkInserter::RWDBBulkInserter | ( | const RWDBBulkInserter & | ins | ) |
Copy constructor. The created RWDBBulkInserter shares an implementation with ins.
RWDBResult RWDBBulkInserter::execute | ( | ) |
Causes each of the values associated with each of the arrays shifted into self to be inserted into the table associated with self. Returns an RWDBResult.
RWDBResult RWDBBulkInserter::execute | ( | size_t | iters | ) |
Causes the first iters values associated with each of the arrays shifted into self to be inserted into the table associated with self. Returns an RWDBResult.
bool RWDBBulkInserter::isValid | ( | ) | const |
Returns true
if self's status is RWDBStatus::ok, otherwise returns false
.
RWDBBulkInserter& RWDBBulkInserter::operator<< | ( | const RWDBAbstractBuffer & | val | ) |
Shifts in the val to be associated with the column at the current position. Increments the current position. Returns a reference to self.
This operator is capable of taking RWDBTBuffer.
RWDBBulkInserter& RWDBBulkInserter::operator<< | ( | const RWDBDateVector & | dateVector | ) |
Shifts in the dateVector to be associated with the column at the current position. Increments the current position. Returns a reference to self.
RWDBBulkInserter& RWDBBulkInserter::operator= | ( | const RWDBBulkInserter & | ins | ) |
Assignment operator. Self shares an implementation with ins.
RWDBBulkInserter& RWDBBulkInserter::operator[] | ( | size_t | index | ) |
Changes the current column position to index. If index is out of range, self's status is set to RWDBStatus::invalidPosition. Returns a reference to self.
RWDBBulkInserter& RWDBBulkInserter::operator[] | ( | const RWCString & | columnName | ) |
Changes the current column position to columnName and sets the column list.
RWDBBulkInserter& RWDBBulkInserter::operator[] | ( | const RWDBColumn & | column | ) |
Changes the current column position to column and sets the column list.
size_t RWDBBulkInserter::position | ( | ) | const |
RWDBStatus RWDBBulkInserter::status | ( | ) | const |
Returns the status of self.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |