Bulk Reading and Writing
The Bulk Classes
In
Reading Tables: Class RWDBReader and
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.
RWDBReaders and RWDBInserters convert the data passing through them to scalar RWDBValues, 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 RWDBBulkInserters and RWDBBulkReaders 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
RWDBBulkInserters and
RWDBBulkReaders.