Library Version 12.1.6.2

DbMultipleRecnoDataBuilder
Prev | Chapter 4. The Dbt Handle | Next

## DbMultipleRecnoDataBuilder

    #include <db_cxx.h>

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

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

This class builds a bulk buffer for use when the DB_MULTIPLE_KEY flag is specified to either the Db::put() or Db::del() methods with the recno or queue access methods, or for the `key` when the DB_MULTIPLE flag is used. The buffer in the Dbt passed to the constructor is filled by calls to DbMultipleRecnoDataBuilder.append() or DbMultipleRecnoDataBuilder.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:

- `dbt`

  The dbt parameter is a The Dbt Handle that must already be configured to contain a buffer managed by the application, with the `ulen` field set to the size of the buffer, which must be a multiple of 4.

bool append(db_recno_t recno, void *dbuf, size_t dlen);

### DbMultipleRecnoDataBuilder.append()

The `DbMultipleRecnoDataBuilder.append()` method copies a record number / data pair to the end of the buffer.

The `DbMultipleRecnoDataBuilder.append()` method returns `false` if the record number / data pair does not fit in the buffer and `true` otherwise.

Parameters are:

- `recno`

  The record number to append.

- `dbuf`

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

- `dlen`

  The number of bytes of the data item to be copied.

### DbMultipleRecnoDataBuilder.reserve()

The `DbMultipleRecnoDataBuilder.reserve()` method reserves space for the next record number / data pair in the bulk buffer. The record number is appended, but unlike the `append()`, the data is not copied into the bulk buffer by `reserve()`: copying the data is the responsibility of the application.

The `DbMultipleRecnoDataBuilder.reserve()` method returns `false` if the record does not fit in the buffer and `true` otherwise.

Parameters are:

- `recno`

  The record number to append.

- `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 for the data item.

### Class

DbMultipleBuilder

### See Also

DBT and Bulk Operations

Prev | Up | Next
DbMultipleKeyDataBuilder | Home | Chapter 5. The DbEnv Handle