Chapter 8 Bulk Reading and Writing
8.1
The Bulk Classes
In
Section 4.4.2, “Reading Tables: Class RWDBReader,”
and
Section 5.4, “Inserting Data,”
we saw how data can be read using
RWDBReader
and inserted using
RWDBInserter
. The DB Interface Module also provides the alternative classes
RWDBBulkReader
and
RWDBBulkInserter
, which implement reading and writing directly from arrays supplied by an application. If your underlying database supports array processing and your application reads and writes large amounts of data at a time, these classes can increase your application performance relative to
RWDBReader
and
RWDBInserter
.
RWDBReader
s and
RWDBInserter
s convert the data passing through them to scalar
RWDBValue
s, which manipulate data
by value
. In contrast, classes
RWDBBulkInserter
and
RWDBBulkReader
bind the arrays of values passed through them
by reference
directly to the underlying vendor API. You must take care that the arrays shifted into
RWDBBulkInserter
s and
RWDBBulkReader
s remain in scope for the duration of the
RWDBBulkInserter
or
RWDBBulkReader
.
The DB Interface Module includes special template class
RWDBTBuffer<T>
that encapsulates arrays of data for use with
RWDBBulkInserter
s and
RWDBBulkReader
s.