Library Version 12.1.6.0

DbMultipleKeyDataBuilder
Prev | Chapter 4. The Dbt Handle | Next

## DbMultipleKeyDataBuilder

    #include <db_cxx.h>

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

        bool append(void *kbuf, size_t klen, void *dbuf, size_t dlen);
        bool reserve(void *&kdest, size_t klen, 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 btree or hash access methods. The buffer in the Dbt passed to the constructor is filled by calls to DbMultipleKeyDataBuilder.append() or DbMultipleKeyDataBuilder.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.

### DbMultipleKeyDataBuilder.append()

The `DbMultipleKeyDataBuilder.append()` method copies a key/data pair to the end of the buffer.

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

Parameters are:

- `kbuf`

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

- `klen`

  The number of bytes of the key to be copied.

- `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.

### DbMultipleKeyDataBuilder.reserve()

The `DbMultipleKeyDataBuilder.reserve()` method reserves space for the next key/data pair 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 `DbMultipleKeyDataBuilder.reserve()` method returns `false` if the data does not fit in the buffer and `true` otherwise.

Parameters are:

- `kdest`

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

- `klen`

  The number of bytes to reserve for the key.

- `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
DbMultipleDataBuilder | Home | DbMultipleRecnoDataBuilder