DbMultipleDataBuilder

#include <db_cxx.h>

class DbMultipleDataBuilder 
{ 
public: 
    DbMultipleDataBuilder(Dbt &dbt);

    bool append(void *dbuf, size_t dlen);
    bool reserve(void *&ddest, size_t dlen);
}; 

This class builds a bulk buffer for use when the DB_MULTIPLE flag is specified to either the Db::put() or Db::del() methods. The buffer in the Dbt passed to the constructor is filled by calls to DbMultipleDataBuilder.append() or DbMultipleDataBuilder.reserve().

The constructor takes a The Dbt Handle that must be configured to contain a buffer managed by the application, with the ulen field set to the size of the buffer.

Note

All instances of the bulk retrieval classes may be used only once, and to build the bulk buffer in the forward direction only.

Parameters are:

DbMultipleDataBuilder.append()

The DbMultipleDataBuilder.append() method copies a data item to the end of the buffer.

The DbMultipleDataBuilder.append() method returns false if the data does not fit in the buffer and true otherwise.

Parameters are:

  • dbuf

    A pointer to the data to be copied into the bulk buffer.

  • dlen

    The number of bytes to be copied.

DbMultipleDataBuilder.reserve()

The DbMultipleDataBuilder.reserve() method reserves space for the next data item in the bulk buffer. Unlike the append(), no data is actually copied into the bulk buffer by reserve(): copying the data is the responsibility of the application.

The DbMultipleDataBuilder.reserve() method returns false if the data does not fit in the buffer and true otherwise.

Parameters are:

  • ddest

    Set to a pointer to the position in the bulk buffer reserved for the data item, if enough space is available.

  • dlen

    The number of bytes to reserve.

Class

Dbt

See Also

DBT and Bulk Operations