Library Version 12.1.6.0

Db::set_blob_threshold()
Prev | Chapter 14. Binary Large Objects | Next

## Db::set_blob_threshold()

    #include <db_cxx.h>

    int
    Db::set_blob_threshold(u_int32_t bytes, u_int32_t flags);

The `Db::set_blob_threshold()` method sets a size which is used to determine when a data item will be stored as a BLOB. Data items sized less than this threshold are stored as normal data within the database. Data items larger than this size are stored on-disk in a subdirectory set aside for the purpose.

If this threshold value is set to `0`, then BLOBs will never be used by the database.

It is illegal to set a BLOB threshold if any of the following flags were specified for the database: DB_CHKSUM, DB_ENCRYPT, DB_DUP, and DB_DUPSORT.

It is also illegal to set a BLOB threshold if compression is turned on for the database. That is, if Db::set_bt_compress() has been called for the database handle.

This method configures the underlying database. The BLOB threshold is stored in the database at database creation time. Any BLOB threshold set after creating the database is ignored.

This method may not be called after Db::open() is called.

Unless otherwise specified, the `Db::set_blob_threshold()` method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

### Parameters

#### bytes

The bytes parameter identifies the threshold size, in bytes, beyond which a data item is stored as a BLOB.

#### flags

The flags parameter must be set to 0.

### Errors

The `Db::set_blob_threshold()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

If the method was called after Db::open() was called; or if an invalid flag or parameter was specified; or if compression is turned on for the database; or if the database is configured with one or more of the following flags: DB_CHKSUM, DB_ENCRYPT, DB_DUP, and DB_DUPSORT.

### Class

Db

### See Also

BLOBs and Related Methods

Prev | Up | Next
Db::set_blob_dir() | Home | Dbc::db_stream()