head 1.2; access; symbols RPM_4_2_1:1.1.1.5 RPM_4_2:1.1.1.5 RPM_4_1_1:1.1.1.5 RPM_4_1:1.1.1.4 RPM_4_0_5:1.1.1.3 RPM_4_0_4:1.1.1.2 RPM_4_0_3:1.1.1.1 RPM:1.1.1; locks; strict; comment @# @; 1.2 date 2008.01.02.09.52.48; author rse; state dead; branches; next 1.1; commitid z4cpSiAhOCXk5PLs; 1.1 date 2001.07.23.20.45.36; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.07.23.20.45.36; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 2002.01.08.00.30.08; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 2003.01.18.13.48.55; author rse; state Exp; branches; next 1.1.1.4; 1.1.1.4 date 2001.12.06.00.07.56; author rse; state Exp; branches; next 1.1.1.5; 1.1.1.5 date 2003.01.18.14.04.56; author rse; state Exp; branches; next ; desc @@ 1.2 log @remove the ancient RPM 4.2.1 source tree copy @ text @ Berkeley DB: DB->close

DB->close

APIRef

#include <db.h>

int DB->close(DB *db, u_int32_t flags);

Description

The DB->close function flushes any cached database information to disk, closes any open cursors, frees any allocated resources, and closes any underlying files. Because key/data pairs are cached in memory, failing to sync the file with the DB->close or DB->sync function may result in inconsistent or lost information.

The flags value must be set to 0 or the following value:

DB_NOSYNC
Do not flush cached information to disk. The DB_NOSYNC flag is a dangerous option. It should be set only if the application is doing logging (with transactions) so that the database is recoverable after a system or application crash, or if the database is always generated from scratch after any system or application crash.

It is important to understand that flushing cached information to disk only minimizes the window of opportunity for corrupted data. Although unlikely, it is possible for database corruption to happen if a system or application crash occurs while writing data to the database. To ensure that database corruption never occurs, applications must either: use transactions and logging with automatic recovery; use logging and application-specific recovery; or edit a copy of the database, and once all applications using the database have successfully called DB->close, atomically replace the original database with the updated copy.

When multiple threads are using the Berkeley DB handle concurrently, only a single thread may call the DB->close function.

After DB->close has been called, regardless of its return, the DB handle may not be accessed again.

The DB->close function returns a non-zero error value on failure, 0 on success, and returns DB_INCOMPLETE if the underlying database still has dirty pages in the cache. (The only reason to return DB_INCOMPLETE is if another thread of control were writing pages in the underlying database file at the same time as the DB->close function was called. For this reason, a return of DB_INCOMPLETE can normally be ignored; or, in cases where it is a possible return value, the DB_NOSYNC option should probably have been specified.)

Errors

The DB->close function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB->close function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

See Also

db_create, DB->associate, DB->close, DB->cursor, DB->del, DB->err, DB->errx DB->fd, DB->get, DB->pget, DB->get_byteswapped, DB->get_type, DB->join, DB->key_range, DB->open, DB->put, DB->remove, DB->rename, DB->set_alloc, DB->set_append_recno, DB->set_bt_compare, DB->set_bt_minkey, DB->set_bt_prefix, DB->set_cachesize, DB->set_dup_compare, DB->set_errcall, DB->set_errfile, DB->set_errpfx, DB->set_feedback, DB->set_flags, DB->set_h_ffactor, DB->set_h_hash, DB->set_h_nelem, DB->set_lorder, DB->set_pagesize, DB->set_paniccall, DB->set_q_extentsize, DB->set_re_delim, DB->set_re_len, DB->set_re_pad, DB->set_re_source, DB->stat, DB->sync, DB->truncate, DB->upgrade, and DB->verify.

APIRef

Copyright Sleepycat Software @ 1.1 log @Initial revision @ text @d1 1 a1 1 @ 1.1.1.1 log @Import: RPM 4.0.3 @ text @@ 1.1.1.2 log @Import: RPM 4.0.4 @ text @d1 1 a1 1 d55 1 a55 1 DB handle may not be accessed again. @ 1.1.1.3 log @Import: RPM 4.0.5 @ text @d1 2 a2 3 a3 1 d28 1 a28 1

The DB->close method flushes any cached database information to disk, d31 1 a31 1 to sync the file with the DB->close or DB->sync method may d33 2 a34 2

The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values: d52 13 a64 5

When multiple threads are using the DB concurrently, only a single thread may call the DB->close method.

The DB handle may not be accessed again after DB->close is called, regardless of its return.

The DB->close method returns a non-zero error value on failure and 0 on success. d66 4 a69 10

The DB->close method may fail and return a non-zero error for the following conditions:

EINVAL
An invalid flag value or parameter was specified.

The DB->close method may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB->close method may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

Class

DB d71 46 a116 1 Databases and Related Methods @ 1.1.1.4 log @Import: RPM 4.1 @ text @d1 3 a3 2 d5 1 d30 1 a30 1

The DB->close function flushes any cached database information to disk, d33 1 a33 1 to sync the file with the DB->close or DB->sync function may d35 2 a36 2

The flags value must be set to 0 or the following value: d54 5 a58 13

When multiple threads are using the Berkeley DB handle concurrently, only a single thread may call the DB->close function.

After DB->close has been called, regardless of its return, the DB handle may not be accessed again.

The DB->close function returns a non-zero error value on failure, 0 on success, and returns DB_INCOMPLETE if the underlying database still has dirty pages in the cache. (The only reason to return DB_INCOMPLETE is if another thread of control were writing pages in the underlying database file at the same time as the DB->close function was called. For this reason, a return of DB_INCOMPLETE can normally be ignored; or, in cases where it is a possible return value, the DB_NOSYNC option should probably have been specified.) d60 10 a69 4

The DB->close function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB->close function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way. d71 1 a71 46 db_create, DB->associate, DB->close, DB->cursor, DB->del, DB->err, DB->errx DB->fd, DB->get, DB->pget, DB->get_byteswapped, DB->get_type, DB->join, DB->key_range, DB->open, DB->put, DB->remove, DB->rename, DB->set_alloc, DB->set_append_recno, DB->set_bt_compare, DB->set_bt_minkey, DB->set_bt_prefix, DB->set_cachesize, DB->set_dup_compare, DB->set_errcall, DB->set_errfile, DB->set_errpfx, DB->set_feedback, DB->set_flags, DB->set_h_ffactor, DB->set_h_hash, DB->set_h_nelem, DB->set_lorder, DB->set_pagesize, DB->set_paniccall, DB->set_q_extentsize, DB->set_re_delim, DB->set_re_len, DB->set_re_pad, DB->set_re_source, DB->stat, DB->sync, DB->truncate, DB->upgrade, and DB->verify. @ 1.1.1.5 log @Import: RPM 4.1.1 @ text @d1 2 a2 3 a3 1 d28 1 a28 1

The DB->close method flushes any cached database information to disk, d31 1 a31 1 to sync the file with the DB->close or DB->sync method may d33 2 a34 2

The flags value must be set to 0 or by bitwise inclusively OR'ing together one or more of the following values: d52 13 a64 5

When multiple threads are using the DB concurrently, only a single thread may call the DB->close method.

The DB handle may not be accessed again after DB->close is called, regardless of its return.

The DB->close method returns a non-zero error value on failure and 0 on success. d66 4 a69 10

The DB->close method may fail and return a non-zero error for the following conditions:

EINVAL
An invalid flag value or parameter was specified.

The DB->close method may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB->close method may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

Class

DB d71 46 a116 1 Databases and Related Methods @