Library Version 12.1.6.0

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

## DbEnv::set_blob_threshold()

    #include <db_cxx.h>

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

The `DbEnv::set_blob_threshold()` method sets a default size for the environment 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 BLOB support is turned off by default for databases created in the environment. If this method is never called, then the default BLOB threshold is `0`.

This method only sets the default BLOB threshold for the environment. The BLOB threshold can be set for individual databases created within the environment using Db::set_blob_threshold().

It is illegal to set a BLOB threshold if replication is enabled for the environment. That is, if the DB_INIT_REP flag is specified to DbEnv::open().

This method configures operations performed using the specified DbEnv handle, not all operations performed on the underlying database environment.

You may call this method at any time after the DbEnv handle has been created.

Unless otherwise specified, the `DbEnv::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 `DbEnv::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 an invalid flag or parameter was specified.

### Class

DbEnv

### See Also

BLOBs and Related Methods

Prev | Up | Next
DbEnv::set_blob_dir() | Home | Appendix A. Berkeley DB Command Line Utilities