/* * ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version: 1.3.19 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ package com.sleepycat.db; /** * The Db handle is the handle for a Berkeley DB database, which may * or may not be part of a database environment.

* * The handle should not be closed while any other handle that refers * to the database is in use; for example, database handles must not * be closed while cursor handles into the database remain open, or * transactions that include operations on the database have not yet * been committed or aborted. Once the {@link * com.sleepycat.db.Db#close Db.close}, {@link * com.sleepycat.db.Db#remove Db.remove}, or {@link * com.sleepycat.db.Db#rename Db.rename} methods are called, the * handle may not be accessed again, regardless of the method's * return.

*/ public class Db { private long swigCPtr; protected boolean swigCMemOwn; protected Db(long cPtr, boolean cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = cPtr; } protected Db() { this(0, false); } protected void delete() { if (swigCPtr != 0 && swigCMemOwn) { swigCMemOwn = false; } swigCPtr = 0; } protected static long getCPtr(Db obj) { return (obj == null) ? 0 : obj.swigCPtr; } final static int GIGABYTE = 1 << 30; // Internally, the JNI layer creates a global reference to each Db, // which can potentially be different to this. We keep a copy here so // we can clean up after destructors. private Object db_ref; private DbEnv dbenv; private boolean private_dbenv; private DbAppendRecno append_recno_handler; private DbBtreeCompare bt_compare_handler; private DbBtreePrefix bt_prefix_handler; private DbDupCompare dup_compare_handler; private DbFeedbackHandler db_feedback_handler; private DbHash h_hash_handler; private DbSecondaryKeyCreate seckey_create_handler; // Called by the Db constructor private void initialize(DbEnv dbenv) { if (dbenv == null) { private_dbenv = true; dbenv = db_java.getDbEnv0(this); dbenv.initialize(); } this.dbenv = dbenv; db_ref = db_java.initDbRef0(this, this); } private void cleanup() { swigCPtr = 0; db_java.deleteRef0(db_ref); db_ref = null; if (private_dbenv) { dbenv.cleanup(); } dbenv = null; } /** * The Db.close method flushes any cached database information to * disk, closes any open cursors, frees any allocated resources, * and closes any underlying files.

* * The {@link com.sleepycat.db.Db Db} handle should not be closed * while any other handle that refers to it is not yet closed; * for example, database handles must not be closed while cursor * handles into the database remain open, or transactions that * include operations on the database have not yet been committed * or aborted. Specifically, this includes {@link * com.sleepycat.db.Dbc Dbc} and {@link com.sleepycat.db.DbTxn * DbTxn} handles.

* * Because key/data pairs are cached in memory, failing to sync * the file with the Db.close or {@link com.sleepycat.db.Db#sync * Db.sync} method may result in inconsistent or lost * information.

* * When called on a database that is the primary database for a * secondary index, the primary database should be closed only * after all secondary indices which reference it have been * closed.

* * When multiple threads are using the {@link com.sleepycat.db.Db * Db} concurrently, only a single thread may call the Db.close * method.

* * The {@link com.sleepycat.db.Db Db} handle may not be accessed * again after Db.close is called, regardless of its return.

* * @param flags must be set to 0 or by * bitwise inclusively OR 'ing together one or more of * the following values: * * * @throws IllegalArgumentException The Db.close method will * fail and throw a IllegalArgumentException exception if an * invalid flag value or parameter was specified. */ public synchronized void close(int flags) throws DbException { try { close0(flags); } finally { cleanup(); } } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getDbEnv()} */ public DbEnv get_env() throws DbException { return getDbEnv(); } /** * The Db.getDbEnv method returns the handle for the database * environment underlying the database.

* * The Db.getDbEnv method may be called at any time during the * life of the application.

* * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getDbEnv method returns the handle * for the database environment underlying the database.

*/ public DbEnv getDbEnv() throws DbException { return dbenv; } private final void handle_append_recno(Dbt data, int recno) throws DbException { append_recno_handler.dbAppendRecno(this, data, recno); } private final int handle_bt_compare(Dbt dbt1, Dbt dbt2) { return bt_compare_handler.compare(this, dbt1, dbt2); } private final int handle_bt_prefix(Dbt dbt1, Dbt dbt2) { return bt_prefix_handler.prefix(this, dbt1, dbt2); } private final void handle_db_feedback(int opcode, int percent) { db_feedback_handler.feedback(this, opcode, percent); } private final int handle_dup_compare(Dbt dbt1, Dbt dbt2) { return dup_compare_handler.compareDuplicates(this, dbt1, dbt2); } private final int handle_h_hash(byte[] data, int len) { return h_hash_handler.hash(this, data, len); } private final int handle_seckey_create(Dbt key, Dbt data, Dbt result) throws DbException { return seckey_create_handler.secondaryKeyCreate( this, key, data, result); } /** * The {@link com.sleepycat.db.Db#isEncrypted Db.isEncrypted} * method returns false if the underlying database files are * encrypted and true if they are not.

* * The {@link com.sleepycat.db.Db#isEncrypted Db.isEncrypted} * method may not be called before the {@link * com.sleepycat.db.Db#open Db.open} method has been called.

* * @throws DbException Signals that an exception of some sort * has occurred. * @return The {@link com.sleepycat.db.Db#isEncrypted * Db.isEncrypted} method returns false if the underlying * database files are encrypted and true if they are not.

*/ public boolean isEncrypted() throws DbException { return (get_encrypt_flags() != 0); } /** * The Db.open method opens the database represented by the * file and database parameters for both reading and * writing.

* * The currently supported Berkeley DB file formats (or access * methods ) are Btree, Hash, Queue, and Recno. The Btree * format is a representation of a sorted, balanced tree * structure. The Hash format is an extensible, dynamic hashing * scheme. The Queue format supports fast access to fixed-length * records accessed sequentially or by logical record number. The * Recno format supports fixed- or variable-length records, * accessed sequentially or by logical record number, and * optionally backed by a flat text file.

* * Storage and retrieval for the Berkeley DB access methods are * based on key/data pairs; see {@link com.sleepycat.db.Dbt Dbt} * for more information.

* * Calling Db.open is a relatively expensive operation, and * maintaining a set of open databases will normally be * preferable to repeatedly opening and closing the database for * each new query.

Environment Variables

* * If the database was opened within a database environment, the * environment variable DB_HOME may be used as the path of * the database environment home.

* * Db.open is affected by any database directory specified using * the {@link com.sleepycat.db.DbEnv#setDataDir DbEnv.setDataDir} * method, or by setting the "set_data_dir" string in the * environment's DB_CONFIG file.

* * If the file and dbenv parameters to Db.open are * null, the environment variable TMPDIR may be used as a * directory in which to create temporary backing files * * @param database optional, and allows * applications to have multiple databases in a single file. * Although no database parameter needs to be * specified, it is an error to attempt to open a second * database in a file that was not initially created * using a database name. Further, the database * parameter is not supported by the Queue format. Finally, * when opening multiple databases in the same physical file, * it is important to consider locking and memory cache * issues; see * Opening multiple databases in a single file for more * information.

* * In-memory databases never intended to be preserved on disk * may be created by setting both the file and * database parameters to null. Note that in-memory * databases can only ever be shared by sharing the single * database handle that created them, in circumstances where * doing so is safe.

* @param file used as the name of an * underlying file that will be used to back the database. *

* * In-memory databases never intended to be preserved on disk * may be created by setting both the file and * database parameters to null. Note that in-memory * databases can only ever be shared by sharing the single * database handle that created them, in circumstances where * doing so is safe.

* @param flags must be set to 0 or by * bitwise inclusively OR 'ing together one or more of * the following values: * * * * * * * * * * * * * * * * * @param mode On UNIX systems or in * IEEE/ANSI Std 1003.1 (POSIX) environments, all files * created by the database open are created with mode mode * (as described in chmod (2)) and modified by * the process' umask value at the time of creation (see * umask (2)). If mode is 0, the database open * will use a default mode of readable and writable by both * owner and group. On Windows systems, the mode parameter is * ignored. The group ownership of created files is based on * the system and directory defaults, and is not further * specified by Berkeley DB. * @param txnid If the operation is to be * transaction-protected, (other than by specifying the * Db.DB_AUTO_COMMIT flag), the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. Note that transactionally protected * operations on a {@link com.sleepycat.db.Db Db} handle * requires the {@link com.sleepycat.db.Db Db} handle itself * be transactionally protected during its open. * @param type must be set to one of * Db.DB_BTREE, Db.DB_HASH, Db.DB_QUEUE, Db.DB_RECNO, or * Db.DB_UNKNOWN. If type is Db.DB_UNKNOWN, the * database must already exist and Db.open will automatically * determine its type. The {@link * com.sleepycat.db.Db#getDbType Db.getDbType} method may be * used to determine the underlying type of databases opened * using Db.DB_UNKNOWN. * @throws DbException The Db.open method may fail * and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • The database cannot be opened without being first * upgraded. *
  • Db.DB_CREATE and Db.DB_EXCL were specified and the * database exists. *
  • A nonexistent re_source file was specified. * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the Db.open method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the Db.open method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws FileNotFoundException If the file or directory * does not exist, the Db.open method will fail and throw a * FileNotFoundException exception. * @throws IllegalArgumentException The Db.open method will * fail and throw a IllegalArgumentException exception if an * unknown database type, page size, hash function, pad byte, * byte order, or a flag value or parameter that is * incompatible with the specified database was specified; * the {@link com.sleepycat.db.Db#DB_THREAD Db.DB_THREAD} * flag was specified and fast mutexes are not available for * this architecture; the {@link * com.sleepycat.db.Db#DB_THREAD Db.DB_THREAD} flag was * specified to Db.open, but was not specified to the {@link * com.sleepycat.db.DbEnv#open DbEnv.open} call for the * environment in which the {@link com.sleepycat.db.Db Db} * handle was created; a backing flat text file was specified * with either the {@link com.sleepycat.db.Db#DB_THREAD * Db.DB_THREAD} flag or the provided database environment * supports transaction processing; or if an invalid flag * value or parameter was specified. */ public void open(DbTxn txnid, String file, String database, int type, int flags, int mode) throws DbException, java.io.FileNotFoundException, DbDeadlockException, DbLockNotGrantedException { /* * Java is always threaded */ flags |= Db.DB_THREAD; open0(txnid, file, database, type, flags, mode); } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #get(DbTxn,Dbt,Dbt,Dbt,int)} */ public int pget(DbTxn txnid, Dbt key, Dbt pkey, Dbt data, int flags) throws DbException { return get(txnid, key, pkey, data, flags); } /** * The Db.remove method removes the database specified by the * file and database parameters. If no database * is specified, the underlying file represented by file * is removed, incidentally removing all of the databases it * contained.

    * * Applications should never remove databases with open {@link * com.sleepycat.db.Db Db} handles, or in the case of removing a * file, when any database in the file has an open handle. For * example, some architectures do not permit the removal of files * with open system handles. On these architectures, attempts to * remove databases currently in use by any thread of control in * the system will fail.

    * * The Db.remove method may not be called after calling the * {@link com.sleepycat.db.Db#open Db.open} method on any {@link * com.sleepycat.db.Db Db} handle. If the {@link * com.sleepycat.db.Db#open Db.open} method has already been * called on a {@link com.sleepycat.db.Db Db} handle, close the * existing handle and create a new one before calling Db.remove. *

    * * The {@link com.sleepycat.db.Db Db} handle may not be accessed * again after Db.remove is called, regardless of its return.

    *

    Environment Variables

    * * If the database was opened within a database environment, the * environment variable DB_HOME may be used as the path of * the database environment home.

    * * Db.remove is affected by any database directory specified * using the {@link com.sleepycat.db.DbEnv#setDataDir * DbEnv.setDataDir} method, or by setting the "set_data_dir" * string in the environment's DB_CONFIG file.

    * * @param database the database to be removed. * @param file the physical file which * contains the database(s) to be removed. * @param flags currently unused, and must * be set to 0. * @throws DbException The Db.remove method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • An attempt was made to remove the underlying file and * a database in the file was currently open. * @throws IllegalArgumentException The Db.remove method will * fail and throw a IllegalArgumentException exception if * Db.remove called after {@link com.sleepycat.db.Db#open * Db.open} was called; or if an invalid flag value or * parameter was specified. * @throws FileNotFoundException If the file or directory * does not exist, the Db.remove method will fail and throw a * FileNotFoundException exception. */ public synchronized void remove(String file, String database, int flags) throws DbException, java.io.FileNotFoundException { try { remove0(file, database, flags); } finally { cleanup(); } } /** * The Db.rename method renames the database specified by the * file and database parameters to newname . If * no database is specified, the underlying file * represented by file is renamed, incidentally renaming * all of the databases it contained.

    * * Applications should not rename databases that are currently in * use. If an underlying file is being renamed and logging is * currently enabled in the database environment, no database in * the file may be open when the Db.rename method is called. In * particular, some architectures do not permit renaming files * with open handles. On these architectures, attempts to rename * databases that are currently in use by any thread of control * in the system will fail.

    * * The Db.rename method may not be called after calling the * {@link com.sleepycat.db.Db#open Db.open} method on any {@link * com.sleepycat.db.Db Db} handle. If the {@link * com.sleepycat.db.Db#open Db.open} method has already been * called on a {@link com.sleepycat.db.Db Db} handle, close the * existing handle and create a new one before calling Db.rename. *

    * * The {@link com.sleepycat.db.Db Db} handle may not be accessed * again after Db.rename is called, regardless of its return.

    *

    Environment Variables

    * * If the database was opened within a database environment, the * environment variable DB_HOME may be used as the path of * the database environment home.

    * * Db.rename is affected by any database directory specified * using the {@link com.sleepycat.db.DbEnv#setDataDir * DbEnv.setDataDir} method, or by setting the "set_data_dir" * string in the environment's DB_CONFIG file.

    * * @param database the database to be removed. * @param file the physical file which * contains the database(s) to be removed. * @param flags currently unused, and must * be set to 0. * @param newname the new name of the database * or file. * @throws DbException The Db.rename method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • An attempt was made to rename the underlying file and * a database in the file was currently open. * @throws IllegalArgumentException The Db.rename method will * fail and throw a IllegalArgumentException exception if * Db.rename called after {@link com.sleepycat.db.Db#open * Db.open} was called; or if an invalid flag value or * parameter was specified. * @throws FileNotFoundException If the file or directory * does not exist, the Db.rename method will fail and throw a * FileNotFoundException exception. */ public synchronized void rename(String file, String database, String newname, int flags) throws DbException, java.io.FileNotFoundException { try { rename0(file, database, newname, flags); } finally { cleanup(); } } /** * The Db.verify method verifies the integrity of all databases * in the file specified by the file parameter, and * optionally outputs the databases' key/data pairs to the file * stream specified by the outfile parameter.

    * * The Db.verify method does not perform any locking, even in * Berkeley DB environments that are configured with a locking * subsystem. As such, it should only be used on files that are * not being modified by another thread of control.

    * * The Db.verify method may not be called after the {@link * com.sleepycat.db.Db#open Db.open} method is called.

    * * The {@link com.sleepycat.db.Db Db} handle may not be accessed * again after Db.verify is called, regardless of its return.

    *

    Environment Variables

    * * If the database was opened within a database environment, the * environment variable DB_HOME may be used as the path of * the database environment home.

    * * Db.verify is affected by any database directory specified * using the {@link com.sleepycat.db.DbEnv#setDataDir * DbEnv.setDataDir} method, or by setting the "set_data_dir" * string in the environment's DB_CONFIG file.

    * * @param database the database in file * on which the database checks for btree and duplicate sort * order and for hashing are to be performed. See the * Db.DB_ORDERCHKONLY flag for more information.

    * * The database parameter must be set to null except when the * Db.DB_ORDERCHKONLY flag is set.

    * @param file the physical file in which * the databases to be verified are found. * @param flags must be set to 0 or the * following value: * * In addition, the following flags may be set by bitwise * inclusively OR 'ing them into the flags * parameter:

    * * * * * * * * * @param outfile an optional file stream to * which the databases' key/data pairs are written. * @throws FileNotFoundException If the file or directory * does not exist, the Db.verify method will fail and throw a * FileNotFoundException exception. * @throws IllegalArgumentException The Db.verify method will * fail and throw a IllegalArgumentException exception if * Db.verify was called after {@link com.sleepycat.db.Db#open * Db.open}; or if an invalid flag value or parameter was * specified. */ public synchronized void verify(String file, String database, java.io.OutputStream outfile, int flags) throws DbException, java.io.FileNotFoundException { try { verify0(file, database, outfile, flags); } finally { cleanup(); } } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #setCacheSize(long,int)} */ public void set_cachesize(int gbytes, int bytes, int ncache) throws DbException { set_cachesize((long) gbytes * Db.GIGABYTE + bytes, ncache); } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #setErrorHandler(DbErrorHandler)} */ public void set_errcall(DbErrcall db_errcall_fcn) { final DbErrcall ferrcall = db_errcall_fcn; try { dbenv.setErrorHandler( new DbErrorHandler() { public void error(String prefix, String str) { ferrcall.errcall(prefix, str); } }); } catch (DbException dbe) { // setErrorHandler throws an exception, // but set_errcall does not. // If it does happen, report it. System.err.println("Exception during DbEnv.setErrorHandler: " + dbe); dbe.printStackTrace(System.err); } } /** * When an error occurs in the Berkeley DB library, an exception * is thrown. In some cases, however, the errno value may * be insufficient to completely describe the cause of the error, * especially during initial application debugging.

    * * The {@link com.sleepycat.db.DbEnv#setErrorHandler * DbEnv.setErrorHandler} and Db.setOnError methods are used to * enhance the mechanism for reporting error messages to the * application. The {@link com.sleepycat.db.DbEnv#setErrorHandler * DbEnv.setErrorHandler} and Db.setOnError methods must be * called with a single object parameter. The object's class must * implement the DbErrorHandler interface.

    * * In some cases, when an error occurs, Berkeley DB will invoke * the object's errcall() method with two parameters; the first * is the prefix string (as previously set by {@link * com.sleepycat.db.Db#setErrorPrefix Db.setErrorPrefix} or * {@link com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}), the second will be an error message * string. It is up to this method to display the message in an * appropriate manner.

    * * Alternatively, you can use the {@link * com.sleepycat.db.DbEnv#setErrorStream DbEnv.setErrorStream} * and {@link com.sleepycat.db.Db#setErrorStream * Db.setErrorStream} methods to display the additional * information via an output stream. You should not mix these * approaches.

    * * This error-logging enhancement does not slow performance or * significantly increase application size, and may be run during * normal operation as well as during application debugging.

    *

    * * For {@link com.sleepycat.db.Db Db} handles opened inside of * Berkeley DB environments, calling the Db.setOnError method * affects the entire environment and is equivalent to calling * the {@link com.sleepycat.db.DbEnv#setErrorHandler * DbEnv.setErrorHandler} method.

    * * The Db.setOnError method may be called at any time during the * life of the application.

    * * @param db_errcall_fcn the application-specified error * reporting function. The function takes two parameters:

    * * The errpfx parameter is the prefix string (as * previously set by {@link com.sleepycat.db.Db#setErrorPrefix * Db.setErrorPrefix} or {@link * com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}).

    * * The msg parameter is the error message string. * @throws DbException Signals that an exception of some sort * has occurred. */ public void setErrorHandler(DbErrorHandler db_errcall_fcn) throws DbException { dbenv.setErrorHandler(db_errcall_fcn); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getErrorPrefix()} */ public String get_errpfx() { return getErrorPrefix(); } /** * The Db.getErrorPrefix method returns the error prefix.

    * * The Db.getErrorPrefix method may be called at any time during * the life of the application.

    * * @return The Db.getErrorPrefix method returns the error * prefix.

    */ public String getErrorPrefix() { return dbenv.get_errpfx(); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setErrorPrefix(String)} */ public void set_errpfx(String errpfx) { setErrorPrefix(errpfx); } /** * Set the prefix string that appears before error messages * issued by Berkeley DB.

    * * For {@link com.sleepycat.db.Db Db} handles opened inside of * Berkeley DB environments, calling the Db.setErrorPrefix method * affects the entire environment and is equivalent to calling * the {@link com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix} method.

    * * The Db.setErrorPrefix method may be called at any time during * the life of the application.

    * * @param errpfx the application-specified error prefix for * additional error messages. */ public void setErrorPrefix(String errpfx) { dbenv.set_errpfx(errpfx); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setErrorStream(java.io.OutputStream)} */ public void set_error_stream(java.io.OutputStream stream) { setErrorStream(stream); } /** * When an error occurs in the Berkeley DB library, an exception * is thrown. In some cases, however, the error information known * to the Java layer may be insufficient to completely describe * the cause of the error, especially during initial application * debugging.

    * * The {@link com.sleepycat.db.DbEnv#setErrorStream * DbEnv.setErrorStream} and Db.setErrorStream methods are used * to enhance the mechanism for reporting error messages to the * application by setting a OutputStream to be used for * displaying additional Berkeley DB error messages. In some * cases, when an error occurs, Berkeley DB will output an * additional error message to the specified stream.

    * * The error message will consist of the prefix string and a * colon (": ") (if a prefix string was previously * specified using {@link com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}), an error string, and a trailing * <newline> character.

    * * Alternatively, you can use the {@link * com.sleepycat.db.DbEnv#setErrorHandler DbEnv.setErrorHandler} * method to capture the additional error information in a way * that does not use output streams. You should not mix these * approaches.

    * * This error-logging enhancement does not slow performance or * significantly increase application size, and may be run during * normal operation as well as during application debugging.

    *

    * * For {@link com.sleepycat.db.Db Db} handles opened inside of * Berkeley DB environments, calling the Db.setErrorStream method * affects the entire environment and is equivalent to calling * the {@link com.sleepycat.db.DbEnv#setErrorStream * DbEnv.setErrorStream} method.

    * * @param stream the application-specified output stream to be * used for additional error information. */ public void setErrorStream(java.io.OutputStream stream) { dbenv.set_error_stream(stream); } /** * @deprecated Replaced in Berkeley DB 4.2 by {@link * #setFeedbackHandler(DbFeedbackHandler)} */ public void set_feedback(DbFeedback feedback) throws DbException { final DbFeedback ffeedback = feedback; setFeedbackHandler( new DbFeedbackHandler() { public void feedback(Db db, int opcode, int percent) { ffeedback.feedback(db, opcode, percent); } }); } /** * Errors can occur in the Berkeley DB library where the only * solution is to shut down the application and run recovery (for * example, if Berkeley DB is unable to allocate heap memory). In * such cases, the Berkeley DB methods will throw a {@link * com.sleepycat.db.DbRunRecoveryException * DbRunRecoveryException}. It is often easier to simply exit the * application when such errors occur rather than gracefully * return up the stack. The Db.setPanic method specifies a * function to be called when {@link * com.sleepycat.db.DbRunRecoveryException * DbRunRecoveryException} is about to be thrown from a Berkeley * DB method.

    * * For {@link com.sleepycat.db.Db Db} handles opened inside of * Berkeley DB environments, calling the Db.setPanic method * affects the entire environment and is equivalent to calling * the {@link com.sleepycat.db.DbEnv#setPanicHandler * DbEnv.setPanicHandler} method.

    * * The Db.setPanic method may be called at any time during the * life of the application.

    * * @param db_panic_fcn the application-specified function called * in the case of a database environment panic. The function * takes two arguments:

    * * The dbenv parameter is the enclosing database * environment handle.

    * * The e parameter is the DbException that would have * been thrown to the calling method. * @throws DbException Signals that an exception of some sort * has occurred. */ public void setPanicHandler(DbPanicHandler db_panic_fcn) throws DbException { dbenv.setPanicHandler(db_panic_fcn); } // Don't remove these - special comments used by s_java to add constants // BEGIN-JAVA-SPECIAL-CONSTANTS /* * DO NOT EDIT: automatically built by dist/s_java_const. */ /** * A constant used to configure the system. It is used in the * following locations: *

    * */ public final static int DB_BTREE = 1; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DONOTINDEX = -30999; public final static int DB_FILEOPEN = -30998; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_HASH = 2; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_KEYEMPTY = -30997; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_KEYEXIST = -30996; public final static int DB_LOCK_DEADLOCK = -30995; public final static int DB_LOCK_NOTGRANTED = -30994; public final static int DB_NOSERVER = -30993; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOSERVER_HOME = -30992; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOSERVER_ID = -30991; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOTFOUND = -30990; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_OLD_VERSION = -30989; public final static int DB_PAGE_NOTFOUND = -30988; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_QUEUE = 4; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RECNO = 3; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_DUPMASTER = -30987; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_HANDLE_DEAD = -30986; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_HOLDELECTION = -30985; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_NEWMASTER = -30983; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_NEWSITE = -30982; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_OUTDATED = -30980; public final static int DB_RUNRECOVERY = -30978; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SECONDARY_BAD = -30977; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_ABORT = 0; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_APPLY = 1; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_BACKWARD_ROLL = 3; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_FORWARD_ROLL = 4; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_PRINT = 8; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_UNKNOWN = 5; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_VERIFY_BAD = -30976; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_AFTER; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_AGGRESSIVE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_APPEND; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_ARCH_ABS; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_ARCH_DATA; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_ARCH_LOG; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_ARCH_REMOVE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_AUTO_COMMIT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_BEFORE; public final static int DB_CACHED_COUNTS; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_CDB_ALLDB; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_CHKSUM; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_CONSUME; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_CONSUME_WAIT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_CREATE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_CURRENT; public final static int DB_CXX_NO_EXCEPTIONS; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DBT_MALLOC; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DBT_PARTIAL; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DBT_REALLOC; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DBT_USERMEM; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DIRECT_DB; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DIRECT_LOG; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DIRTY_READ; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DUP; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_DUPSORT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_EID_BROADCAST; public final static int DB_EID_INVALID; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_ENCRYPT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_ENCRYPT_AES; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_EXCL; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_FAST_STAT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_FIRST; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_FLUSH; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_FORCE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_GET_BOTH; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_GET_BOTH_RANGE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_GET_RECNO; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_INIT_CDB; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_INIT_LOCK; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_INIT_LOG; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_INIT_MPOOL; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_INIT_REP; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_INIT_TXN; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_JOINENV; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_JOIN_ITEM; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_JOIN_NOSORT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_KEYFIRST; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_KEYLAST; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LAST; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCKDOWN; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_DEFAULT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_EXPIRE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_GET; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_GET_TIMEOUT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_IREAD; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_IWR; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_IWRITE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_MAXLOCKS; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_MINLOCKS; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_MINWRITE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_NOWAIT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_OLDEST; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_PUT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_PUT_ALL; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_PUT_OBJ; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_RANDOM; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_READ; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_TIMEOUT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_WRITE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOCK_YOUNGEST; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_LOG_AUTOREMOVE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_MPOOL_NOFILE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_MULTIPLE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_MULTIPLE_KEY; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NEXT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NEXT_DUP; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NEXT_NODUP; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NODUPDATA; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOLOCKING; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOMMAP; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOORDERCHK; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOOVERWRITE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOPANIC; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_NOSYNC; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_ORDERCHKONLY; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_OVERWRITE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PANIC_ENVIRONMENT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_POSITION; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PREV; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PREV_NODUP; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PRINTABLE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PRIORITY_DEFAULT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PRIORITY_HIGH; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PRIORITY_LOW; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PRIORITY_VERY_HIGH; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PRIORITY_VERY_LOW; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_PRIVATE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RDONLY; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RECNUM; public final static int DB_RECORDCOUNT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RECOVER; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RECOVER_FATAL; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REGION_INIT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RENUMBER; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_CLIENT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_ISPERM; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_LOGSONLY; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_MASTER; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_NOBUFFER; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_NOTPERM; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_PERMANENT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REP_UNAVAIL; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_REVSPLITOFF; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RMW; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_RPCCLIENT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SALVAGE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SET; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SET_LOCK_TIMEOUT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SET_RANGE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SET_RECNO; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SET_TXN_TIMEOUT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SNAPSHOT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_STAT_CLEAR; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_SYSTEM_MEM; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_THREAD; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TIME_NOTGRANTED; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TRUNCATE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_NOSYNC; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_NOT_DURABLE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_NOWAIT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_SYNC; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_TXN_WRITE_NOSYNC; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_UPGRADE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_USE_ENVIRON; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_USE_ENVIRON_ROOT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_VERB_CHKPOINT; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_VERB_DEADLOCK; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_VERB_RECOVERY; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_VERB_REPLICATION; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_VERB_WAITSFOR; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_VERIFY; public final static int DB_VERSION_MAJOR; public final static int DB_VERSION_MINOR; public final static int DB_VERSION_PATCH; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_WRITECURSOR; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_XA_CREATE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_XIDDATASIZE; /** * A constant used to configure the system. It is used in the * following locations: * * */ public final static int DB_YIELDCPU; // END-JAVA-SPECIAL-CONSTANTS static { // BEGIN-JAVA-CONSTANT-INITIALIZATION /* * DO NOT EDIT: automatically built by dist/s_java_const. */ DB_AFTER = DbConstants.DB_AFTER; DB_AGGRESSIVE = DbConstants.DB_AGGRESSIVE; DB_APPEND = DbConstants.DB_APPEND; DB_ARCH_ABS = DbConstants.DB_ARCH_ABS; DB_ARCH_DATA = DbConstants.DB_ARCH_DATA; DB_ARCH_LOG = DbConstants.DB_ARCH_LOG; DB_ARCH_REMOVE = DbConstants.DB_ARCH_REMOVE; DB_AUTO_COMMIT = DbConstants.DB_AUTO_COMMIT; DB_BEFORE = DbConstants.DB_BEFORE; DB_CACHED_COUNTS = DbConstants.DB_CACHED_COUNTS; DB_CDB_ALLDB = DbConstants.DB_CDB_ALLDB; DB_CHKSUM = DbConstants.DB_CHKSUM; DB_CONSUME = DbConstants.DB_CONSUME; DB_CONSUME_WAIT = DbConstants.DB_CONSUME_WAIT; DB_CREATE = DbConstants.DB_CREATE; DB_CURRENT = DbConstants.DB_CURRENT; DB_CXX_NO_EXCEPTIONS = DbConstants.DB_CXX_NO_EXCEPTIONS; DB_DBT_MALLOC = DbConstants.DB_DBT_MALLOC; DB_DBT_PARTIAL = DbConstants.DB_DBT_PARTIAL; DB_DBT_REALLOC = DbConstants.DB_DBT_REALLOC; DB_DBT_USERMEM = DbConstants.DB_DBT_USERMEM; DB_DIRECT_DB = DbConstants.DB_DIRECT_DB; DB_DIRECT_LOG = DbConstants.DB_DIRECT_LOG; DB_DIRTY_READ = DbConstants.DB_DIRTY_READ; DB_DUP = DbConstants.DB_DUP; DB_DUPSORT = DbConstants.DB_DUPSORT; DB_EID_BROADCAST = DbConstants.DB_EID_BROADCAST; DB_EID_INVALID = DbConstants.DB_EID_INVALID; DB_ENCRYPT = DbConstants.DB_ENCRYPT; DB_ENCRYPT_AES = DbConstants.DB_ENCRYPT_AES; DB_EXCL = DbConstants.DB_EXCL; DB_FAST_STAT = DbConstants.DB_FAST_STAT; DB_FIRST = DbConstants.DB_FIRST; DB_FLUSH = DbConstants.DB_FLUSH; DB_FORCE = DbConstants.DB_FORCE; DB_GET_BOTH = DbConstants.DB_GET_BOTH; DB_GET_BOTH_RANGE = DbConstants.DB_GET_BOTH_RANGE; DB_GET_RECNO = DbConstants.DB_GET_RECNO; DB_INIT_CDB = DbConstants.DB_INIT_CDB; DB_INIT_LOCK = DbConstants.DB_INIT_LOCK; DB_INIT_LOG = DbConstants.DB_INIT_LOG; DB_INIT_MPOOL = DbConstants.DB_INIT_MPOOL; DB_INIT_REP = DbConstants.DB_INIT_REP; DB_INIT_TXN = DbConstants.DB_INIT_TXN; DB_JOINENV = DbConstants.DB_JOINENV; DB_JOIN_ITEM = DbConstants.DB_JOIN_ITEM; DB_JOIN_NOSORT = DbConstants.DB_JOIN_NOSORT; DB_KEYFIRST = DbConstants.DB_KEYFIRST; DB_KEYLAST = DbConstants.DB_KEYLAST; DB_LAST = DbConstants.DB_LAST; DB_LOCKDOWN = DbConstants.DB_LOCKDOWN; DB_LOCK_DEFAULT = DbConstants.DB_LOCK_DEFAULT; DB_LOCK_EXPIRE = DbConstants.DB_LOCK_EXPIRE; DB_LOCK_GET = DbConstants.DB_LOCK_GET; DB_LOCK_GET_TIMEOUT = DbConstants.DB_LOCK_GET_TIMEOUT; DB_LOCK_IREAD = DbConstants.DB_LOCK_IREAD; DB_LOCK_IWR = DbConstants.DB_LOCK_IWR; DB_LOCK_IWRITE = DbConstants.DB_LOCK_IWRITE; DB_LOCK_MAXLOCKS = DbConstants.DB_LOCK_MAXLOCKS; DB_LOCK_MINLOCKS = DbConstants.DB_LOCK_MINLOCKS; DB_LOCK_MINWRITE = DbConstants.DB_LOCK_MINWRITE; DB_LOCK_NOWAIT = DbConstants.DB_LOCK_NOWAIT; DB_LOCK_OLDEST = DbConstants.DB_LOCK_OLDEST; DB_LOCK_PUT = DbConstants.DB_LOCK_PUT; DB_LOCK_PUT_ALL = DbConstants.DB_LOCK_PUT_ALL; DB_LOCK_PUT_OBJ = DbConstants.DB_LOCK_PUT_OBJ; DB_LOCK_RANDOM = DbConstants.DB_LOCK_RANDOM; DB_LOCK_READ = DbConstants.DB_LOCK_READ; DB_LOCK_TIMEOUT = DbConstants.DB_LOCK_TIMEOUT; DB_LOCK_WRITE = DbConstants.DB_LOCK_WRITE; DB_LOCK_YOUNGEST = DbConstants.DB_LOCK_YOUNGEST; DB_LOG_AUTOREMOVE = DbConstants.DB_LOG_AUTOREMOVE; DB_MPOOL_NOFILE = DbConstants.DB_MPOOL_NOFILE; DB_MULTIPLE = DbConstants.DB_MULTIPLE; DB_MULTIPLE_KEY = DbConstants.DB_MULTIPLE_KEY; DB_NEXT = DbConstants.DB_NEXT; DB_NEXT_DUP = DbConstants.DB_NEXT_DUP; DB_NEXT_NODUP = DbConstants.DB_NEXT_NODUP; DB_NODUPDATA = DbConstants.DB_NODUPDATA; DB_NOLOCKING = DbConstants.DB_NOLOCKING; DB_NOMMAP = DbConstants.DB_NOMMAP; DB_NOORDERCHK = DbConstants.DB_NOORDERCHK; DB_NOOVERWRITE = DbConstants.DB_NOOVERWRITE; DB_NOPANIC = DbConstants.DB_NOPANIC; DB_NOSYNC = DbConstants.DB_NOSYNC; DB_ORDERCHKONLY = DbConstants.DB_ORDERCHKONLY; DB_OVERWRITE = DbConstants.DB_OVERWRITE; DB_PANIC_ENVIRONMENT = DbConstants.DB_PANIC_ENVIRONMENT; DB_POSITION = DbConstants.DB_POSITION; DB_PREV = DbConstants.DB_PREV; DB_PREV_NODUP = DbConstants.DB_PREV_NODUP; DB_PRINTABLE = DbConstants.DB_PRINTABLE; DB_PRIORITY_DEFAULT = DbConstants.DB_PRIORITY_DEFAULT; DB_PRIORITY_HIGH = DbConstants.DB_PRIORITY_HIGH; DB_PRIORITY_LOW = DbConstants.DB_PRIORITY_LOW; DB_PRIORITY_VERY_HIGH = DbConstants.DB_PRIORITY_VERY_HIGH; DB_PRIORITY_VERY_LOW = DbConstants.DB_PRIORITY_VERY_LOW; DB_PRIVATE = DbConstants.DB_PRIVATE; DB_RDONLY = DbConstants.DB_RDONLY; DB_RECNUM = DbConstants.DB_RECNUM; DB_RECORDCOUNT = DbConstants.DB_RECORDCOUNT; DB_RECOVER = DbConstants.DB_RECOVER; DB_RECOVER_FATAL = DbConstants.DB_RECOVER_FATAL; DB_REGION_INIT = DbConstants.DB_REGION_INIT; DB_RENUMBER = DbConstants.DB_RENUMBER; DB_REP_CLIENT = DbConstants.DB_REP_CLIENT; DB_REP_ISPERM = DbConstants.DB_REP_ISPERM; DB_REP_LOGSONLY = DbConstants.DB_REP_LOGSONLY; DB_REP_MASTER = DbConstants.DB_REP_MASTER; DB_REP_NOBUFFER = DbConstants.DB_REP_NOBUFFER; DB_REP_NOTPERM = DbConstants.DB_REP_NOTPERM; DB_REP_PERMANENT = DbConstants.DB_REP_PERMANENT; DB_REP_UNAVAIL = DbConstants.DB_REP_UNAVAIL; DB_REVSPLITOFF = DbConstants.DB_REVSPLITOFF; DB_RMW = DbConstants.DB_RMW; DB_RPCCLIENT = DbConstants.DB_RPCCLIENT; DB_SALVAGE = DbConstants.DB_SALVAGE; DB_SET = DbConstants.DB_SET; DB_SET_LOCK_TIMEOUT = DbConstants.DB_SET_LOCK_TIMEOUT; DB_SET_RANGE = DbConstants.DB_SET_RANGE; DB_SET_RECNO = DbConstants.DB_SET_RECNO; DB_SET_TXN_TIMEOUT = DbConstants.DB_SET_TXN_TIMEOUT; DB_SNAPSHOT = DbConstants.DB_SNAPSHOT; DB_STAT_CLEAR = DbConstants.DB_STAT_CLEAR; DB_SYSTEM_MEM = DbConstants.DB_SYSTEM_MEM; DB_THREAD = DbConstants.DB_THREAD; DB_TIME_NOTGRANTED = DbConstants.DB_TIME_NOTGRANTED; DB_TRUNCATE = DbConstants.DB_TRUNCATE; DB_TXN_NOSYNC = DbConstants.DB_TXN_NOSYNC; DB_TXN_NOT_DURABLE = DbConstants.DB_TXN_NOT_DURABLE; DB_TXN_NOWAIT = DbConstants.DB_TXN_NOWAIT; DB_TXN_SYNC = DbConstants.DB_TXN_SYNC; DB_TXN_WRITE_NOSYNC = DbConstants.DB_TXN_WRITE_NOSYNC; DB_UPGRADE = DbConstants.DB_UPGRADE; DB_USE_ENVIRON = DbConstants.DB_USE_ENVIRON; DB_USE_ENVIRON_ROOT = DbConstants.DB_USE_ENVIRON_ROOT; DB_VERB_CHKPOINT = DbConstants.DB_VERB_CHKPOINT; DB_VERB_DEADLOCK = DbConstants.DB_VERB_DEADLOCK; DB_VERB_RECOVERY = DbConstants.DB_VERB_RECOVERY; DB_VERB_REPLICATION = DbConstants.DB_VERB_REPLICATION; DB_VERB_WAITSFOR = DbConstants.DB_VERB_WAITSFOR; DB_VERIFY = DbConstants.DB_VERIFY; DB_VERSION_MAJOR = DbConstants.DB_VERSION_MAJOR; DB_VERSION_MINOR = DbConstants.DB_VERSION_MINOR; DB_VERSION_PATCH = DbConstants.DB_VERSION_PATCH; DB_WRITECURSOR = DbConstants.DB_WRITECURSOR; DB_XA_CREATE = DbConstants.DB_XA_CREATE; DB_XIDDATASIZE = DbConstants.DB_XIDDATASIZE; DB_YIELDCPU = DbConstants.DB_YIELDCPU; // END-JAVA-CONSTANT-INITIALIZATION } /** * The constructor creates a Db object that is the handle for a * Berkeley DB database. The constructor allocates memory * internally; calling the {@link com.sleepycat.db.Db#close * Db.close}, {@link com.sleepycat.db.Db#remove Db.remove} or * {@link com.sleepycat.db.Db#rename Db.rename} methods will free * that memory.

    * * @param dbenv If no dbenv value is specified, * the database is standalone; that is, it is not part of any * Berkeley DB environment.

    * * If a dbenv value is specified, the database is * created within the specified Berkeley DB environment. The * database access methods automatically make calls to the * other subsystems in Berkeley DB based on the enclosing * environment. For example, if the environment has been * configured to use locking, the access methods will * automatically acquire the correct locks when reading and * writing pages of the database.

    * @param flags must be set to 0 or by bitwise * inclusively OR 'ing together one or more of the * following values: * * * @throws DbException Signals that an exception of some sort * has occurred. */ public Db(DbEnv dbenv, int flags) throws DbException { this(db_javaJNI.new_Db(DbEnv.getCPtr(dbenv), flags), true); initialize(dbenv); } public void associate(DbTxn txnid, Db secondary, DbSecondaryKeyCreate callback, int flags) throws DbException { db_javaJNI.Db_associate(swigCPtr, DbTxn.getCPtr(txnid), Db.getCPtr(secondary), (secondary.seckey_create_handler = callback), flags); } int close0(int flags) { return db_javaJNI.Db_close0(swigCPtr, flags); } /** * The Db.cursor method returns a created database cursor. * * @param flags must be set to 0 or by * bitwise inclusively OR 'ing together one or more of * the following values: * * * * * @param txnid If the operation is to be * transaction-protected, the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. To transaction-protect cursor operations, * cursors must be opened and closed within the context of a * transaction, and the txnid parameter specifies the * transaction context in which the cursor may be used. * @throws DbException The Db.cursor method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: * @throws IllegalArgumentException The Db.cursor method will * fail and throw a IllegalArgumentException exception if an * invalid flag value or parameter was specified. * @return The Db.cursor method throws * an exception that encapsulates a non-zero error value on * failure.

    */ public Dbc cursor(DbTxn txnid, int flags) throws DbException { long cPtr = db_javaJNI.Db_cursor(swigCPtr, DbTxn.getCPtr(txnid), flags); return (cPtr == 0) ? null : new Dbc(cPtr, false); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #delete(DbTxn,Dbt,int)} */ public int del(DbTxn txnid, Dbt key, int flags) throws DbException { return delete(txnid, key, flags); } /** * The Db.delete method removes key/data pairs from the database. * The key/data pair associated with the specified key is * discarded from the database. In the presence of duplicate key * values, all records associated with the designated key will be * discarded.

    * * When called on a database that has been made into a secondary * index using the {@link com.sleepycat.db.Db#associate * Db.associate} method, the Db.delete method deletes the * key/data pair from the primary database and all secondary * indices.

    * * @param key The key {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param flags must be set to 0 or the * following value: * * * @param txnid If the operation is to be * transaction-protected, (other than by specifying the * Db.DB_AUTO_COMMIT flag), the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. * @throws DbException The Db.delete method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: An attempt was made to modify a read-only * database. * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the Db.delete method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the Db.delete method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The Db.delete method will * fail and throw a IllegalArgumentException exception if an * invalid flag value or parameter was specified. * @return * * * * Unless otherwise specified, the Db.delete method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public int delete(DbTxn txnid, Dbt key, int flags) throws DbException { return db_javaJNI.Db_del(swigCPtr, DbTxn.getCPtr(txnid), key, flags); } /** * The {@link com.sleepycat.db.DbEnv#err DbEnv.err}, {@link * com.sleepycat.db.DbEnv#errx DbEnv.errx}, Db.err and Db.errx * methods provide error-messaging functionality for applications * written using the Berkeley DB library.

    * * The {@link com.sleepycat.db.DbEnv#err DbEnv.err} method * constructs an error message consisting of the following * elements:

    * * If no error callback function has been set using the {@link * com.sleepycat.db.DbEnv#setErrorHandler DbEnv.setErrorHandler} * method, any prefix string specified using the {@link * com.sleepycat.db.DbEnv#setErrorPrefix DbEnv.setErrorPrefix} * method, followed by two separating characters: a colon and a * <space> character.

    * *

    * * Two separating characters: a colon and a <space> * character.

    * * The standard system or Berkeley DB library error string * associated with the error value, as returned by the * {@link com.sleepycat.db.DbEnv#strerror DbEnv.strerror} method. *

    * * This constructed error message is then handled as follows:

    *

    * * If an error callback function has been set (see {@link * com.sleepycat.db.Db#setErrorHandler Db.setErrorHandler} and * {@link com.sleepycat.db.DbEnv#setErrorHandler * DbEnv.setErrorHandler}), that function is called with two * parameters: any prefix string specified (see {@link * com.sleepycat.db.Db#setErrorPrefix Db.setErrorPrefix} and * {@link com.sleepycat.db.DbEnv#setErrorPrefix * DbEnv.setErrorPrefix}) and the error message.

    * * If an OutputStream has been set (see {@link * com.sleepycat.db.DbEnv#setErrorStream DbEnv.setErrorStream} * and {@link com.sleepycat.db.Db#setErrorStream * Db.setErrorStream}), the error message is written to that * stream.

    * * If none of these output options has been configured, the error * message is written to System.err, the standard error output * stream.

    * * @param error the error value for which the {@link * com.sleepycat.db.DbEnv#err DbEnv.err} and Db.err methods * will display a explanatory string. * @param message an error message to display. */ public void err(int error, String message) { db_javaJNI.Db_err(swigCPtr, error, message); } /** * The {@link com.sleepycat.db.DbEnv#errx DbEnv.errx} and Db.errx * methods perform identically to the {@link * com.sleepycat.db.DbEnv#err DbEnv.err} and Db.err methods, * except that they do not append the final separator characters * and standard error string to the error message.

    * * @param error the error value for which the {@link * com.sleepycat.db.DbEnv#err DbEnv.err} and Db.err methods * will display a explanatory string. * @param message an error message to display. */ public void errx(String message) { db_javaJNI.Db_errx(swigCPtr, message); } /** * The Db.get method retrieves key/data pairs from the database. * The byte array and length of the data associated with the * specified key are returned in the structure to which * data refers.

    * * In the presence of duplicate key values, Db.get will return * the first data item for the designated key. Duplicates are * sorted by insert order, except where this order has been * overridden by cursor operations. Retrieval of duplicates * requires the use of cursor operations. See {@link * com.sleepycat.db.Dbc#get Dbc.get} for details.

    * * When called on a database that has been made into a secondary * index using the {@link com.sleepycat.db.Db#associate * Db.associate} method, the Db.get method returns the key from * the secondary index and the data item from the primary * database. In addition, the second method signature returns the * key from the primary database. In databases that are not * secondary indices, the second method signature will always * fail.

    * * @param data The data {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param flags must be set to 0 or one of * the following values: * * * * * * * * In addition, the following flags may be set by bitwise * inclusively OR 'ing them into the flags * parameter: * * * * * * * * * @param key The key {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param pkey the return key from the * primary database. * @param txnid If the operation is to be * transaction-protected, the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. * @throws DbException The Db.get method may fail * and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the Db.get method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the Db.get method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws DbLockNotGrantedException If the Db.DB_CONSUME_WAIT * flag was specified, lock or transaction timers were * configured and the lock could not be granted before the * wait-time expired, the Db.get method will fail and throw a * {@link com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The Db.get method will fail * and throw a IllegalArgumentException exception if a record * number of 0 was specified; the {@link * com.sleepycat.db.Db#DB_THREAD Db.DB_THREAD} flag was * specified to the {@link com.sleepycat.db.Db#open Db.open} * method and none of the {@link * com.sleepycat.db.Db#DB_DBT_MALLOC Db.DB_DBT_MALLOC}, * {@link com.sleepycat.db.Db#DB_DBT_REALLOC * Db.DB_DBT_REALLOC} or {@link * com.sleepycat.db.Db#DB_DBT_USERMEM Db.DB_DBT_USERMEM} * flags were set in the {@link com.sleepycat.db.Dbt Dbt}; * the second method signature was called with a {@link * com.sleepycat.db.Db Db} handle that does not refer to a * secondary index; or if an invalid flag value or parameter * was specified. * @throws DbMemoryException If the requested item could * not be returned due to insufficient memory, the Db.get * method will fail and throw a {@link * com.sleepycat.db.DbMemoryException DbMemoryException} * exception. * @return * * * * Unless otherwise specified, the Db.get method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public int get(DbTxn txnid, Dbt key, Dbt data, int flags) throws DbException { return db_javaJNI.Db_get__SWIG_0(swigCPtr, DbTxn.getCPtr(txnid), key, data, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #isByteSwapped()} */ public boolean get_byteswapped() throws DbException { return isByteSwapped(); } /** * The Db.isByteSwapped method returns false if the underlying * database files were created on an architecture of the same * byte order as the current one, and true if they were not (that * is, big-endian on a little-endian machine, or vice versa). * This information may be used to determine whether application * data needs to be adjusted for this architecture or not.

    *

    * * The Db.isByteSwapped method may not be called before the * {@link com.sleepycat.db.Db#open Db.open} method has been * called.

    * * @throws IllegalArgumentException The Db.isByteSwapped method * will fail and throw a IllegalArgumentException exception * if the method was called before {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. * @return The Db.isByteSwapped method * returns false if the underlying database files were * created on an architecture of the same byte order as the * current one, and true if they were not.

    */ public boolean isByteSwapped() throws DbException { return db_javaJNI.Db_get_byteswapped(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getCacheSize()} */ public long get_cachesize() throws DbException { return getCacheSize(); } /** * The Db.getCacheSize method returns the size of the cache.

    *

    * * The Db.getCacheSize method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getCacheSize method returns the * size of the cache.

    */ public long getCacheSize() throws DbException { return db_javaJNI.Db_get_cachesize(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getCacheSizeNcache()} */ public int get_cachesize_ncache() throws DbException { return getCacheSizeNcache(); } /** * The DbEnv.getCacheSizeNcache method returns the number of * caches.

    * * The DbEnv.getCacheSizeNcache method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The DbEnv.getCacheSizeNcache method * returns the number of caches.

    */ public int getCacheSizeNcache() throws DbException { return db_javaJNI.Db_get_cachesize_ncache(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getFileName()} */ public String get_filename() throws DbException { return getFileName(); } /** * The Db.getFileName method returns the current filename.

    *

    * * The Db.getFileName method may be called at any time during the * life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getFileName method returns the * current filename.

    */ public String getFileName() throws DbException { return db_javaJNI.Db_get_filename(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getDatabaseName()} */ public String get_dbname() throws DbException { return getDatabaseName(); } /** * The Db.getDatabaseName method returns the current database * name.

    * * The Db.getDatabaseName method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getDatabaseName method returns the * current database name.

    */ public String getDatabaseName() throws DbException { return db_javaJNI.Db_get_dbname(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getEncryptFlags()} */ public int get_encrypt_flags() throws DbException { return getEncryptFlags(); } /** * The Db.getEncryptFlags method returns the encryption flags. *

    * * The Db.getEncryptFlags method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getEncryptFlags method returns the * encryption flags.

    */ public int getEncryptFlags() throws DbException { return db_javaJNI.Db_get_encrypt_flags(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getFlags()} */ public int get_flags() throws DbException { return getFlags(); } /** * The Db.getFlags method returns the current flags.

    * * The Db.getFlags method may be called at any time during the * life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getFlags method returns the * current flags.

    */ public int getFlags() throws DbException { return db_javaJNI.Db_get_flags(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getByteOrder()} */ public int get_lorder() throws DbException { return getByteOrder(); } /** * The Db.getByteOrder method returns the database byte order; a * byte order of 4,321 indicates a big endian order, and a byte * order of 1,234 indicates a little endian order.

    * * The Db.getByteOrder method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getByteOrder method returns the * database byte order; a byte order of 4,321 indicates a big * endian order, and a byte order of 1,234 indicates a little * endian order.

    */ public int getByteOrder() throws DbException { return db_javaJNI.Db_get_lorder(swigCPtr); } /** * The Db.get_mpf method returns the handle for the cache file * underlying the database.

    * * The Db.get_mpf method may be called at any time during the * life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.get_mpf method returns the handle * for the cache file underlying the database.

    */ public DbMpoolFile get_mpf() throws DbException { long cPtr = db_javaJNI.Db_get_mpf(swigCPtr); return (cPtr == 0) ? null : new DbMpoolFile(cPtr, false); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getOpenFlags()} */ public int get_open_flags() throws DbException { return getOpenFlags(); } /** * The Db.getOpenFlags method returns the current open method * flags.

    * * The Db.getOpenFlags method may not be called before the * Db.open method has been called.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getOpenFlags method returns the * current open method flags.

    */ public int getOpenFlags() throws DbException { return db_javaJNI.Db_get_open_flags(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getPageSize()} */ public int get_pagesize() throws DbException { return getPageSize(); } /** * The Db.getPageSize method returns the page size.

    * * The Db.getPageSize method may be called at any time during the * life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getPageSize method returns the * page size.

    */ public int getPageSize() throws DbException { return db_javaJNI.Db_get_pagesize(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getBtreeMinKey()} */ public int get_bt_minkey() throws DbException { return getBtreeMinKey(); } /** * The Db.getBtreeMinKey method returns the minimum number of * key/data pairs intended to be stored on any single Btree leaf * page.

    * * The Db.getBtreeMinKey method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getBtreeMinKey method returns the * minimum number of key/data pairs intended to be stored on * any single Btree leaf page.

    */ public int getBtreeMinKey() throws DbException { return db_javaJNI.Db_get_bt_minkey(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getHashFillFactor()} */ public int get_h_ffactor() throws DbException { return getHashFillFactor(); } /** * The Db.getHashFillFactor method returns the hash table * density.

    * * The Db.getHashFillFactor method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getHashFillFactor method returns * the hash table density.

    */ public int getHashFillFactor() throws DbException { return db_javaJNI.Db_get_h_ffactor(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getHashNumElements()} */ public int get_h_nelem() throws DbException { return getHashNumElements(); } /** * The Db.getHashNumElements method returns the estimate of the * final size of the hash table.

    * * The Db.getHashNumElements method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getHashNumElements method returns * the estimate of the final size of the hash table.

    */ public int getHashNumElements() throws DbException { return db_javaJNI.Db_get_h_nelem(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getRecordDelimiter()} */ public int get_re_delim() throws DbException { return getRecordDelimiter(); } /** * The Db.getRecordDelimiter method returns the delimiting byte. *

    * * The Db.getRecordDelimiter method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getRecordDelimiter method returns * the delimiting byte.

    */ public int getRecordDelimiter() throws DbException { return db_javaJNI.Db_get_re_delim(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getRecordLength()} */ public int get_re_len() throws DbException { return getRecordLength(); } /** * The Db.getRecordLength method returns the record length.

    *

    * * The Db.getRecordLength method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getRecordLength method returns the * record length.

    */ public int getRecordLength() throws DbException { return db_javaJNI.Db_get_re_len(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getRecordPad()} */ public int get_re_pad() throws DbException { return getRecordPad(); } /** * The Db.getRecordPad method returns the pad character.

    * * The Db.getRecordPad method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getRecordPad method returns the * pad character.

    */ public int getRecordPad() throws DbException { return db_javaJNI.Db_get_re_pad(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getRecordSource()} */ public String get_re_source() throws DbException { return getRecordSource(); } /** * The Db.getRecordSource method returns the source file.

    * * The Db.getRecordSource method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getRecordSource method returns the * source file.

    */ public String getRecordSource() throws DbException { return db_javaJNI.Db_get_re_source(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getQueueExtentSize()} */ public int get_q_extentsize() throws DbException { return getQueueExtentSize(); } /** * The Db.getQueueExtentSize method returns the number of pages * in an extent.

    * * The Db.getQueueExtentSize method may be called at any time * during the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.getQueueExtentSize method returns * the number of pages in an extent.

    */ public int getQueueExtentSize() throws DbException { return db_javaJNI.Db_get_q_extentsize(swigCPtr); } public int get_flags_raw() throws DbException { return db_javaJNI.Db_get_flags_raw(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #isTransactional()} */ public boolean get_transactional() throws DbException { return isTransactional(); } /** * The Db.isTransactional method returns true if the {@link * com.sleepycat.db.Db Db} handle has been opened in a * transactional mode.

    * * The Db.isTransactional method may be called at any time during * the life of the application.

    * * @throws DbException Signals that an exception of some sort * has occurred. * @return The Db.isTransactional method returns * true if the {@link com.sleepycat.db.Db Db} handle has been * opened in a transactional mode.

    */ public boolean isTransactional() throws DbException { return db_javaJNI.Db_get_transactional(swigCPtr); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #getDbType()} */ public int get_type() throws DbException { return getDbType(); } /** * The Db.getDbType method returns the type of the underlying * access method (and file format). The type value is one of * Db.DB_BTREE, Db.DB_HASH, Db.DB_RECNO, or Db.DB_QUEUE. This * value may be used to determine the type of the database after * a return from {@link com.sleepycat.db.Db#open Db.open} with * the type parameter set to Db.DB_UNKNOWN.

    * * The Db.getDbType method may not be called before the {@link * com.sleepycat.db.Db#open Db.open} method has been called.

    * * @throws IllegalArgumentException The Db.getDbType method will * fail and throw a IllegalArgumentException exception if the * method was called before {@link com.sleepycat.db.Db#open * Db.open} was called; or if an invalid flag value or * parameter was specified. * @return The Db.getDbType method * returns the type of the underlying access method (and file * format).

    */ public int getDbType() throws DbException { return db_javaJNI.Db_get_type(swigCPtr); } /** * The Db.join method creates a specialized join cursor for use * in performing equality or natural joins on secondary indices. * For information on how to organize your data to use this * functionality, see * Equality join .

    * * The Db.join method method is called using the {@link * com.sleepycat.db.Db Db} handle of the primary database.

    *

    * * The join cursor supports only the {@link * com.sleepycat.db.Dbc#get Dbc.get} and dbc_close cursor * functions:

    * * Iterates over the values associated with the keys to which * each item in curslist was initialized. Any data value * that appears in all items specified by the curslist * parameter is then used as a key into the primary , and * the key/data pair found in the primary is returned. The * flags parameter must be set to 0 or the following * value: In addition, the following flag may be set by bitwise * inclusively OR 'ing it into the flags parameter: * Close the returned cursor and release all resources. (Closing * the cursors in curslist is the responsibility of the * caller.) * * @param curslist The curslist * parameter contains a null terminated array of cursors. * Each cursor must have been initialized to refer to the key * on which the underlying database should be joined. * Typically, this initialization is done by a {@link * com.sleepycat.db.Dbc#get Dbc.get} call with the {@link * com.sleepycat.db.Db#DB_SET Db.DB_SET} flag specified. Once * the cursors have been passed as part of a curslist * , they should not be accessed or modified until the newly * created join cursor has been closed, or else inconsistent * results may be returned.

    * * Joined values are retrieved by doing a sequential * iteration over the first cursor in the curslist * parameter, and a nested iteration over each secondary * cursor in the order they are specified in the curslist * parameter. This requires database traversals to * search for the current datum in all the cursors after the * first. For this reason, the best join performance normally * results from sorting the cursors from the one that refers * to the least number of data items to the one that refers * to the most. By default, Db.join does this sort on behalf * of its caller.

    * * For the returned join cursor to be used in a * transaction-protected manner, the cursors listed in * curslist must have been created within the context of * the same transaction.

    * @param flags must be set to 0 or the * following value: * * * @throws DbException The Db.join method may fail * and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: * @throws IllegalArgumentException The Db.join method will fail * and throw a IllegalArgumentException exception if cursor * methods other than {@link com.sleepycat.db.Dbc#get * Dbc.get} or {@link com.sleepycat.db.Dbc#close Dbc.close} * were called; or if an invalid flag value or parameter was * specified. * @return The Db.join method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public Dbc join(Dbc[] curslist, int flags) throws DbException { long cPtr = db_javaJNI.Db_join(swigCPtr, curslist, flags); return (cPtr == 0) ? null : new Dbc(cPtr, true); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #keyRange(DbTxn,Dbt,DbKeyRange,int)} */ public void key_range(DbTxn txnid, Dbt key, DbKeyRange key_range, int flags) throws DbException { keyRange(txnid, key, key_range, flags); } /** * The Db.keyRange method returns an estimate of the proportion * of keys that are less than, equal to, and greater than the * specified key. The underlying database must be of type Btree. *

    * * The Db.keyRange method fills in a DbKeyRange object. The * following data fields are available from the DbKeyRange * object:

    Values are in the range of 0 to 1; for example, if * the field less is 0.05, 5% of the keys in the database * are less than the key parameter. The value for equal * will be zero if there is no matching key, and will be * non-zero otherwise.

    * * @param key The key {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param key_range The estimates are returned * in the key_range parameter, which contains three * elements of type double: less , equal , and * greater . Values are in the range of 0 to 1; for * example, if the field less is 0.05, 5% of the keys * in the database are less than the key parameter. * The value for equal will be zero if there is no * matching key, and will be non-zero otherwise. * @param txnid If the operation is to be * transaction-protected, the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. The Db.keyRange method does not retain * the locks it acquires for the life of the transaction, so * estimates may not be repeatable. * @param flags currently unused, and must * be set to 0. * @throws DbException The Db.keyRange method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the Db.keyRange method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the Db.keyRange method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The Db.keyRange method will * fail and throw a IllegalArgumentException exception if the * underlying database was not of type Btree; or if an * invalid flag value or parameter was specified. */ public void keyRange(DbTxn txnid, Dbt key, DbKeyRange key_range, int flags) throws DbException { db_javaJNI.Db_key_range(swigCPtr, DbTxn.getCPtr(txnid), key, key_range, flags); } void open0(DbTxn txnid, String file, String database, int type, int flags, int mode) { db_javaJNI.Db_open0(swigCPtr, DbTxn.getCPtr(txnid), file, database, type, flags, mode); } /** * The Db.get method retrieves key/data pairs from the database. * The byte array and length of the data associated with the * specified key are returned in the structure to which * data refers.

    * * In the presence of duplicate key values, Db.get will return * the first data item for the designated key. Duplicates are * sorted by insert order, except where this order has been * overridden by cursor operations. Retrieval of duplicates * requires the use of cursor operations. See {@link * com.sleepycat.db.Dbc#get Dbc.get} for details.

    * * When called on a database that has been made into a secondary * index using the {@link com.sleepycat.db.Db#associate * Db.associate} method, the Db.get method returns the key from * the secondary index and the data item from the primary * database. In addition, the second method signature returns the * key from the primary database. In databases that are not * secondary indices, the second method signature will always * fail.

    * * @param data The data {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param flags must be set to 0 or one of * the following values: * * * * * * * * In addition, the following flags may be set by bitwise * inclusively OR 'ing them into the flags * parameter: * * * * * * * * * @param key The key {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param pkey the return key from the * primary database. * @param txnid If the operation is to be * transaction-protected, the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. * @throws DbException The Db.get method may fail * and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the Db.get method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the Db.get method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws DbLockNotGrantedException If the Db.DB_CONSUME_WAIT * flag was specified, lock or transaction timers were * configured and the lock could not be granted before the * wait-time expired, the Db.get method will fail and throw a * {@link com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The Db.get method will fail * and throw a IllegalArgumentException exception if a record * number of 0 was specified; the {@link * com.sleepycat.db.Db#DB_THREAD Db.DB_THREAD} flag was * specified to the {@link com.sleepycat.db.Db#open Db.open} * method and none of the {@link * com.sleepycat.db.Db#DB_DBT_MALLOC Db.DB_DBT_MALLOC}, * {@link com.sleepycat.db.Db#DB_DBT_REALLOC * Db.DB_DBT_REALLOC} or {@link * com.sleepycat.db.Db#DB_DBT_USERMEM Db.DB_DBT_USERMEM} * flags were set in the {@link com.sleepycat.db.Dbt Dbt}; * the second method signature was called with a {@link * com.sleepycat.db.Db Db} handle that does not refer to a * secondary index; or if an invalid flag value or parameter * was specified. * @throws DbMemoryException If the requested item could * not be returned due to insufficient memory, the Db.get * method will fail and throw a {@link * com.sleepycat.db.DbMemoryException DbMemoryException} * exception. * @return * * * * Unless otherwise specified, the Db.get method throws an * exception that encapsulates a non-zero error value on * failure.

    */ public int get(DbTxn txnid, Dbt key, Dbt pkey, Dbt data, int flags) throws DbException { return db_javaJNI.Db_get__SWIG_1(swigCPtr, DbTxn.getCPtr(txnid), key, pkey, data, flags); } /** * The Db.put method stores key/data pairs in the database. The * default behavior of the Db.put function is to enter the new * key/data pair, replacing any previously existing key if * duplicates are disallowed, or adding a duplicate data item if * duplicates are allowed. If the database supports duplicates, * the Db.put method adds the new data value at the end of the * duplicate set. If the database supports sorted duplicates, the * new data value is inserted at the correct sorted location.

    * * @param flags must be set to 0 or one of * the following values: * * * * * * In addition, the following flag may be set by bitwise * inclusively OR 'ing it into the flags * parameter: * * * @param data The data {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param key The key {@link * com.sleepycat.db.Dbt Dbt} operated on. * @param txnid If the operation is to be * transaction-protected, (other than by specifying the * Db.DB_AUTO_COMMIT flag), the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. * @throws DbException The Db.put method may fail * and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • An attempt was made to modify a read-only database. A * btree exceeded the maximum btree depth (255). * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the Db.put method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the Db.put method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The Db.put method will fail * and throw a IllegalArgumentException exception if a record * number of 0 was specified; an attempt was made to add a * record to a fixed-length database that was too large to * fit; an attempt was made to do a partial put; an attempt * was made to add a record to a secondary index; or if an * invalid flag value or parameter was specified. * @return Unless otherwise specified, * the Db.put method throws an exception that encapsulates a * non-zero error value on failure.

    * *

    * *

    */ public int put(DbTxn txnid, Dbt key, Dbt data, int flags) throws DbException { return db_javaJNI.Db_put(swigCPtr, DbTxn.getCPtr(txnid), key, data, flags); } void remove0(String file, String database, int flags) { db_javaJNI.Db_remove0(swigCPtr, file, database, flags); } void rename0(String file, String database, String newname, int flags) { db_javaJNI.Db_rename0(swigCPtr, file, database, newname, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setAppendRecno(DbAppendRecno)} */ public void set_append_recno(DbAppendRecno db_append_recno_fcn) throws DbException { setAppendRecno(db_append_recno_fcn); } public void setAppendRecno(DbAppendRecno db_append_recno_fcn) throws DbException { db_javaJNI.Db_set_append_recno(swigCPtr, (append_recno_handler = db_append_recno_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setBtreeCompare(DbBtreeCompare)} */ public void set_bt_compare(DbBtreeCompare bt_compare_fcn) throws DbException { setBtreeCompare(bt_compare_fcn); } public void setBtreeCompare(DbBtreeCompare bt_compare_fcn) throws DbException { db_javaJNI.Db_set_bt_compare(swigCPtr, (bt_compare_handler = bt_compare_fcn)); } public void set_bt_maxkey(int maxkey) throws DbException { db_javaJNI.Db_set_bt_maxkey(swigCPtr, maxkey); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setBtreeMinKey(int)} */ public void set_bt_minkey(int bt_minkey) throws DbException { setBtreeMinKey(bt_minkey); } /** * Set the minimum number of key/data pairs intended to be stored * on any single Btree leaf page.

    * * This value is used to determine if key or data items will be * stored on overflow pages instead of Btree leaf pages. For more * information on the specific algorithm used, see Minimum keys * per page . The bt_minkey value specified must be at * least 2; if bt_minkey is not explicitly set, a value of * 2 is used.

    * * The Db.setBtreeMinKey method configures a database, not only * operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setBtreeMinKey method may not be called after the * {@link com.sleepycat.db.Db#open Db.open} method is called. If * the database already exists when {@link * com.sleepycat.db.Db#open Db.open} is called, the information * specified to Db.setBtreeMinKey will be ignored.


    Description: Db.getBtreeMinKey

    * * @param bt_minkey the minimum number of * key/data pairs intended to be stored on any single Btree * leaf page. * @throws IllegalArgumentException The Db.setBtreeMinKey method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setBtreeMinKey(int bt_minkey) throws DbException { db_javaJNI.Db_set_bt_minkey(swigCPtr, bt_minkey); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setBtreePrefix(DbBtreePrefix)} */ public void set_bt_prefix(DbBtreePrefix bt_prefix_fcn) throws DbException { setBtreePrefix(bt_prefix_fcn); } public void setBtreePrefix(DbBtreePrefix bt_prefix_fcn) throws DbException { db_javaJNI.Db_set_bt_prefix(swigCPtr, (bt_prefix_handler = bt_prefix_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setCacheSize(long,int)} */ public void set_cachesize(long bytes, int ncache) throws DbException { setCacheSize(bytes, ncache); } /** * Set the size of the shared memory buffer pool -- that is, the * cache. The cache should be the size of the normal working data * set of the application, with some small amount of additional * memory for unusual situations. (Note: the working set is not * the same as the number of pages accessed simultaneously, and * is usually much larger.)

    * * The default cache size is 256KB, and may not be specified as * less than 20KB. Any cache size less than 500MB is * automatically increased by 25% to account for buffer pool * overhead; cache sizes larger than 500MB are used as specified. * The current maximum size of a single cache is 4GB. (All sizes * are in powers-of-two, that is, 256KB is 2^32 not 256,000.) For * information on tuning the Berkeley DB cache size, see Selecting a * cache size .

    * * It is possible to specify caches to Berkeley DB larger than * 4GB and/or large enough they cannot be allocated contiguously * on some architectures. For example, some releases of Solaris * limit the amount of memory that may be allocated contiguously * by a process. If ncache is 0 or 1, the cache will be * allocated contiguously in memory. If it is greater than 1, the * cache will be broken up into ncache equally sized, * separate pieces of memory.

    * * Because databases opened within Berkeley DB environments use * the cache specified to the environment, it is an error to * attempt to set a cache in a database created within an * environment.

    * * The Db.setCacheSize method may not be called after the {@link * com.sleepycat.db.Db#open Db.open} method is called.

    * * @param bytes The size of the cache in * bytes. * @param ncache the number of caches to * create. * @throws IllegalArgumentException The Db.setCacheSize method * will fail and throw a IllegalArgumentException exception * if the specified cache size was impossibly small; called * in a database environment; the method was called after * {@link com.sleepycat.db.Db#open Db.open} was called; or if * an invalid flag value or parameter was specified. */ public void setCacheSize(long bytes, int ncache) throws DbException { db_javaJNI.Db_set_cachesize(swigCPtr, bytes, ncache); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setDuplicateCompare(DbDupCompare)} */ public void set_dup_compare(DbDupCompare dup_compare_fcn) throws DbException { setDuplicateCompare(dup_compare_fcn); } public void setDuplicateCompare(DbDupCompare dup_compare_fcn) throws DbException { db_javaJNI.Db_set_dup_compare(swigCPtr, (dup_compare_handler = dup_compare_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setEncrypted(String,int)} */ public void set_encrypt(String passwd, int flags) throws DbException { setEncrypted(passwd, flags); } /** * Set the password used by the Berkeley DB library to perform * encryption and decryption.

    * * Because databases opened within Berkeley DB environments use * the password specified to the environment, it is an error to * attempt to set a password in a database created within an * environment.

    * * The Db.setEncrypted method may not be called after the {@link * com.sleepycat.db.Db#open Db.open} method is called.

    * * @param flags must be set to 0 or the * following value: * * * @param passwd the password used to perform * encryption and decryption. * @throws DbException The Db.setEncrypted method * may fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • Cryptography is not available in this Berkeley DB * release. * @throws IllegalArgumentException The Db.setEncrypted method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setEncrypted(String passwd, int flags) throws DbException { db_javaJNI.Db_set_encrypt(swigCPtr, passwd, flags); } public void setFeedbackHandler(DbFeedbackHandler db_feedback_fcn) throws DbException { db_javaJNI.Db_setFeedbackHandler(swigCPtr, (db_feedback_handler = db_feedback_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setFlags(int)} */ public void set_flags(int flags) throws DbException { setFlags(flags); } /** * Configure a database. Calling Db.setFlags is additive; there * is no way to clear flags.

    * * The Db.setFlags method may not be called after the {@link * com.sleepycat.db.Db#open Db.open} method is called.

    * * @param flags must be set to 0 or by * bitwise inclusively OR 'ing together one or more of * the following values:

    General

    * * The following flags may be specified for any Berkeley DB * access method:

    * * * * * *

    Btree

    * * The following flags may be specified for the Btree access * method:

    * * * * * * * *

    Hash

    * * The following flags may be specified for the Hash access * method:

    * * * *

    Queue

    * * There are no additional flags that may be specified for * the Queue access method.

    Recno

    * * The following flags may be specified for the Recno access * method:

    * * * * * @throws IllegalArgumentException The Db.setFlags method will * fail and throw a IllegalArgumentException exception if an * invalid flag value or parameter was specified. */ public void setFlags(int flags) throws DbException { db_javaJNI.Db_set_flags(swigCPtr, flags); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setHashFillFactor(int)} */ public void set_h_ffactor(int h_ffactor) throws DbException { setHashFillFactor(h_ffactor); } /** * Set the desired density within the hash table. If no value is * specified, the fill factor will be selected dynamically as * pages are filled.

    * * The Db.setHashFillFactor method configures a database, not * only operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setHashFillFactor method may not be called after the * {@link com.sleepycat.db.Db#open Db.open} method is called. If * the database already exists when {@link * com.sleepycat.db.Db#open Db.open} is called, the information * specified to Db.setHashFillFactor will be ignored.

    The * density is an approximation of the number of keys allowed to * accumulate in any one bucket, determining when the hash table * grows or shrinks. If you know the average sizes of the keys * and data in your data set, setting the fill factor can enhance * performance. A reasonable rule computing fill factor is to set * it to the following:

    (pagesize - 32) / (average_key_size + average_data_size + 8)
    *
    * * @param h_ffactor the desired density within * the hash table. * @throws IllegalArgumentException The Db.setHashFillFactor * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setHashFillFactor(int h_ffactor) throws DbException { db_javaJNI.Db_set_h_ffactor(swigCPtr, h_ffactor); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setHash(DbHash)} */ public void set_h_hash(DbHash h_hash_fcn) throws DbException { setHash(h_hash_fcn); } public void setHash(DbHash h_hash_fcn) throws DbException { db_javaJNI.Db_set_h_hash(swigCPtr, (h_hash_handler = h_hash_fcn)); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setHashNumElements(int)} */ public void set_h_nelem(int h_nelem) throws DbException { setHashNumElements(h_nelem); } /** * Set an estimate of the final size of the hash table.

    * * In order for the estimate to be used when creating the * database, the {@link com.sleepycat.db.Db#setHashFillFactor * Db.setHashFillFactor} method must also be called. If the * estimate or fill factor are not set or are set too low, hash * tables will still expand gracefully as keys are entered, * although a slight performance degradation may be noticed.

    *

    * * The Db.setHashNumElements method configures a database, not * only operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setHashNumElements method may not be called after the * {@link com.sleepycat.db.Db#open Db.open} method is called. If * the database already exists when {@link * com.sleepycat.db.Db#open Db.open} is called, the information * specified to Db.setHashNumElements will be ignored.

    * * @param h_nelem an estimate of the final * size of the hash table. * @throws IllegalArgumentException The Db.setHashNumElements * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setHashNumElements(int h_nelem) throws DbException { db_javaJNI.Db_set_h_nelem(swigCPtr, h_nelem); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setByteOrder(int)} */ public void set_lorder(int lorder) throws DbException { setByteOrder(lorder); } /** * Set the byte order for integers in the stored database * metadata. The host byte order of the machine where the * Berkeley DB library was compiled will be used if no byte order * is set.

    * * The access methods provide no guarantees about the byte * ordering of the application data stored in the database, and * applications are responsible for maintaining any necessary * ordering.

    * * The Db.setByteOrder method configures a database, not only * operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setByteOrder method may not be called after the {@link * com.sleepycat.db.Db#open Db.open} method is called. If the * database already exists when {@link com.sleepycat.db.Db#open * Db.open} is called, the information specified to * Db.setByteOrder will be ignored.

    If creating additional * databases in a single physical file, information specified to * Db.setByteOrder will be ignored and the byte order of the * existing databases will be used. * * @param lorder The lorder parameter * should represent the byte order as an integer; for * example, big endian order is the number 4,321, and little * endian order is the number 1,234. * @throws IllegalArgumentException The Db.setByteOrder method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setByteOrder(int lorder) throws DbException { db_javaJNI.Db_set_lorder(swigCPtr, lorder); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setPageSize(long)} */ public void set_pagesize(long pagesize) throws DbException { setPageSize(pagesize); } /** * Set the size of the pages used to hold items in the database, * in bytes. The minimum page size is 512 bytes, the maximum page * size is 64K bytes, and the page size must be a power-of-two. * If the page size is not explicitly set, one is selected based * on the underlying filesystem I/O block size. The automatically * selected size has a lower limit of 512 bytes and an upper * limit of 16K bytes.

    * * For information on tuning the Berkeley DB page size, see Selecting a * page size .

    * * The Db.setPageSize method configures a database, not only * operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setPageSize method may not be called after the {@link * com.sleepycat.db.Db#open Db.open} method is called. If the * database already exists when {@link com.sleepycat.db.Db#open * Db.open} is called, the information specified to * Db.setPageSize will be ignored.

    If creating additional * databases in a file, the page size specified must be * consistent with the existing databases in the file or an error * will be returned. * * @param pagesize The pagesize * parameter sets the database page size. * @throws IllegalArgumentException The Db.setPageSize method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setPageSize(long pagesize) throws DbException { db_javaJNI.Db_set_pagesize(swigCPtr, pagesize); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setRecordDelimiter(int)} */ public void set_re_delim(int re_delim) throws DbException { setRecordDelimiter(re_delim); } /** * Set the delimiting byte used to mark the end of a record in * the backing source file for the Recno access method.

    * * This byte is used for variable length records if the * re_source file is specified. If the re_source file * is specified and no delimiting byte was specified, * <newline> characters (that is, ASCII 0x0a) are * interpreted as end-of-record markers.

    * * The Db.setRecordDelimiter method configures a database, not * only operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setRecordDelimiter method may not be called after the * {@link com.sleepycat.db.Db#open Db.open} method is called. If * the database already exists when {@link * com.sleepycat.db.Db#open Db.open} is called, the information * specified to Db.setRecordDelimiter will be ignored.

    * * @param re_delim the delimiting byte used to * mark the end of a record. * @throws IllegalArgumentException The Db.setRecordDelimiter * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setRecordDelimiter(int re_delim) throws DbException { db_javaJNI.Db_set_re_delim(swigCPtr, re_delim); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setRecordLength(int)} */ public void set_re_len(int re_len) throws DbException { setRecordLength(re_len); } /** * For the Queue access method, specify that the records are of * length re_len . For the Queue access method, the record * length must be enough smaller than the database's page size * that at least one record plus the database page's metadata * information can fit on each database page.

    * * For the Recno access method, specify that the records are * fixed-length, not byte-delimited, and are of length re_len * .

    * * Any records added to the database that are less than re_len * bytes long are automatically padded (see {@link * com.sleepycat.db.Db#setRecordPad Db.setRecordPad} for more * information).

    * * Any attempt to insert records into the database that are * greater than re_len bytes long will cause the call to * fail immediately and return an error.

    * * The Db.setRecordLength method configures a database, not only * operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setRecordLength method may not be called after the * {@link com.sleepycat.db.Db#open Db.open} method is called. If * the database already exists when {@link * com.sleepycat.db.Db#open Db.open} is called, the information * specified to Db.setRecordLength will be ignored.

    * * @param re_len the length of a Queue or * Recno database record, in bytes. * @throws IllegalArgumentException The Db.setRecordLength * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setRecordLength(int re_len) throws DbException { db_javaJNI.Db_set_re_len(swigCPtr, re_len); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setRecordPad(int)} */ public void set_re_pad(int re_pad) throws DbException { setRecordPad(re_pad); } /** * Set the padding character for short, fixed-length records for * the Queue and Recno access methods.

    * * If no pad character is specified, <space> characters * (that is, ASCII 0x20) are used for padding.

    * * The Db.setRecordPad method configures a database, not only * operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setRecordPad method may not be called after the {@link * com.sleepycat.db.Db#open Db.open} method is called. If the * database already exists when {@link com.sleepycat.db.Db#open * Db.open} is called, the information specified to * Db.setRecordPad will be ignored.

    * * @param re_pad the pad character for * fixed-length records for the Queue and Recno access * methods. * @throws IllegalArgumentException The Db.setRecordPad method * will fail and throw a IllegalArgumentException exception * if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setRecordPad(int re_pad) throws DbException { db_javaJNI.Db_set_re_pad(swigCPtr, re_pad); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setRecordSource(String)} */ public void set_re_source(String source) throws DbException { setRecordSource(source); } /** * Set the underlying source file for the Recno access method. * The purpose of the source value is to provide fast * access and modification to databases that are normally stored * as flat text files.

    * * The source parameter specifies an underlying flat text * database file that is read to initialize a transient record * number index. In the case of variable length records, the * records are separated, as specified by {@link * com.sleepycat.db.Db#setRecordDelimiter Db.setRecordDelimiter}. * For example, standard UNIX byte stream files can be * interpreted as a sequence of variable length records separated * by <newline> characters.

    * * In addition, when cached data would normally be written back * to the underlying database file (for example, the {@link * com.sleepycat.db.Db#close Db.close} or {@link * com.sleepycat.db.Db#sync Db.sync} methods are called), the * in-memory copy of the database will be written back to the * source file.

    * * By default, the backing source file is read lazily; that is, * records are not read from the file until they are requested by * the application. If multiple processes (not threads) are * accessing a Recno database concurrently, and are either * inserting or deleting records, the backing source file must be * read in its entirety before more than a single process * accesses the database, and only that process should specify * the backing source file as part of the {@link * com.sleepycat.db.Db#open Db.open} call. See the {@link * com.sleepycat.db.Db#DB_SNAPSHOT Db.DB_SNAPSHOT} flag for more * information.

    * * Reading and writing the backing source file specified by * source cannot be transaction-protected because it * involves filesystem operations that are not part of the Db * transaction methodology. For this reason, if a temporary * database is used to hold the records, it is possible to lose * the contents of the source file, for example, if the * system crashes at the right instant. If a file is used to hold * the database, normal database recovery on that file can be * used to prevent information loss, although it is still * possible that the contents of source will be lost if * the system crashes.

    * * The source file must already exist (but may be * zero-length) when {@link com.sleepycat.db.Db#open Db.open} is * called.

    * * It is not an error to specify a read-only source file * when creating a database, nor is it an error to modify the * resulting database. However, any attempt to write the changes * to the backing source file using either the {@link * com.sleepycat.db.Db#sync Db.sync} or {@link * com.sleepycat.db.Db#close Db.close} methods will fail, of * course. Specify the {@link com.sleepycat.db.Db#DB_NOSYNC * Db.DB_NOSYNC} flag to the {@link com.sleepycat.db.Db#close * Db.close} method to stop it from attempting to write the * changes to the backing file; instead, they will be silently * discarded.

    * * For all of the previous reasons, the source field is * generally used to specify databases that are read-only for * Berkeley DB applications; and that are either generated on the * fly by software tools or modified using a different mechanism * -- for example, a text editor.

    * * The Db.setRecordSource method configures operations performed * using the specified {@link com.sleepycat.db.Db Db} handle, not * all operations performed on the underlying database.

    * * The Db.setRecordSource method may not be called after the * {@link com.sleepycat.db.Db#open Db.open} method is called. If * the database already exists when {@link * com.sleepycat.db.Db#open Db.open} is called, the information * specified to Db.setRecordSource must be the same as that * historically used to create the database or corruption can * occur.

    * * @param source The backing flat text * database file for a Recno database. * @throws IllegalArgumentException The Db.setRecordSource * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setRecordSource(String source) throws DbException { db_javaJNI.Db_set_re_source(swigCPtr, source); } /** * @deprecated As of Berkeley DB 4.2, replaced by {@link * #setQueueExtentSize(int)} */ public void set_q_extentsize(int extentsize) throws DbException { setQueueExtentSize(extentsize); } /** * Set the size of the extents used to hold pages in a Queue * database, specified as a number of pages. Each extent is * created as a separate physical file. If no extent size is set, * the default behavior is to create only a single underlying * database file.

    * * For information on tuning the extent size, see Selecting a * extent size .

    * * The Db.setQueueExtentSize method configures a database, not * only operations performed using the specified {@link * com.sleepycat.db.Db Db} handle.

    * * The Db.setQueueExtentSize method may not be called after the * {@link com.sleepycat.db.Db#open Db.open} method is called. If * the database already exists when {@link * com.sleepycat.db.Db#open Db.open} is called, the information * specified to Db.setQueueExtentSize will be ignored.

    * * @param extentsize the number of pages in a * Queue database extent. * @throws IllegalArgumentException The Db.setQueueExtentSize * method will fail and throw a IllegalArgumentException * exception if the method was called after {@link * com.sleepycat.db.Db#open Db.open} was called; or if an * invalid flag value or parameter was specified. */ public void setQueueExtentSize(int extentsize) throws DbException { db_javaJNI.Db_set_q_extentsize(swigCPtr, extentsize); } /** * The Db.stat method creates a statistical structure and fills * it with statistics for the database.

    * * If the Db.DB_FAST_STAT flag has not been specified, the * Db.stat method will access some of or all the pages in the * database, incurring a severe performance penalty as well as * possibly flushing the underlying buffer pool.

    * * In the presence of multiple threads or processes accessing an * active database, the information returned by Db.stat may be * out-of-date.

    * * If the database was not opened read-only and the * Db.DB_FAST_STAT flag was not specified, the cached key and * record numbers will be updated after the statistical * information has been gathered.

    * * The Db.stat method cannot be transaction-protected. For this * reason, it should be called in a thread of control that has no * open cursors or active transactions.

    Hash Statistics *

    * * In the case of a Hash database, the statistics are returned in * an instance of DbHashStat. The data fields are available from * DbHashStat:

    Btree and Recno Statistics

    * * In the case of a Btree or Recno database, the statistics are * returned in an instance of DbBtreeStat. The data fields are * available from DbBtreeStat:

    Queue Statistics

    * * In the case of a Queue database, the statistics are returned * in an instance of DbQueueStat. The data fields are available * from DbQueueStat:

    For convenience, the DbBtreeStat, * DbHashStat and DbQueueStat classes have a toString method that * lists all their data fields.

    * * @param flags must be set to 0 or one of * the following values: * * * @throws DbException The Db.stat method may fail * and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: * @throws IllegalArgumentException The Db.stat method will fail * and throw a IllegalArgumentException exception if an * invalid flag value or parameter was specified. * @return In the case of a Hash * database, the statistics are returned in an instance of * DbHashStat. In the case of a Btree or Recno database, the * statistics are returned in an instance of DbBtreeStat. In * the case of a Queue database, the statistics are returned * in an instance of DbQueueStat.

    */ public Object stat(int flags) throws DbException { return db_javaJNI.Db_stat(swigCPtr, flags); } /** * The Db.sync method flushes any cached information to disk.

    *

    * * If the database is in memory only, the Db.sync method has no * effect and will always succeed.

    * * 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 {@link com.sleepycat.db.Db#close * Db.close}, atomically replace the original database with the * updated copy.

    * * @param flags currently unused, and must * be set to 0. * @throws DbException The Db.sync method may fail * and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: * @throws IllegalArgumentException The Db.sync method will fail * and throw a IllegalArgumentException exception if an * invalid flag value or parameter was specified. */ public void sync(int flags) throws DbException { db_javaJNI.Db_sync(swigCPtr, flags); } /** * The Db.truncate method empties the database, discarding all * records it contains. The number of records discarded from the * database is returned.

    * * It is an error to call the Db.truncate method on a database * with open cursors.

    * * @param flags must be set to 0 or the * following value: * * * @param txnid If the operation is to be * transaction-protected, (other than by specifying the * Db.DB_AUTO_COMMIT flag), the txnid parameter is a * transaction handle returned from {@link * com.sleepycat.db.DbEnv#txnBegin DbEnv.txnBegin}; * otherwise, null. * @throws DbDeadlockException If a transactional database * environment operation was selected to resolve a deadlock, * the Db.truncate method will fail and throw a {@link * com.sleepycat.db.DbDeadlockException DbDeadlockException} * exception. * @throws DbLockNotGrantedException If a Berkeley DB Concurrent * Data Store database environment configured for lock * timeouts was unable to grant a lock in the allowed time, * the Db.truncate method will fail and throw a {@link * com.sleepycat.db.DbLockNotGrantedException * DbLockNotGrantedException} exception. * @throws IllegalArgumentException The Db.truncate method will * fail and throw a IllegalArgumentException exception if * there are open cursors in the database; or if an invalid * flag value or parameter was specified. * @return The Db.truncate method * returns the number of records discarded from the database. *

    */ public int truncate(DbTxn txnid, int flags) throws DbException { return db_javaJNI.Db_truncate(swigCPtr, DbTxn.getCPtr(txnid), flags); } /** * The Db.upgrade method upgrades all of the databases included * in the file file , if necessary. If no upgrade is * necessary, Db.upgrade always returns success.

    * * Database upgrades are done in place and are destructive. * For example, if pages need to be allocated and no disk space * is available, the database may be left corrupted. Backups * should be made before databases are upgraded. See Upgrading databases * for more information.

    * * Unlike all other database operations, Db.upgrade may only be * done on a system with the same byte-order as the database.

    *

    Environment Variables

    * * If the database was opened within a database environment, the * environment variable DB_HOME may be used as the path of * the database environment home.

    * * Db.upgrade is affected by any database directory specified * using the {@link com.sleepycat.db.DbEnv#setDataDir * DbEnv.setDataDir} method, or by setting the "set_data_dir" * string in the environment's DB_CONFIG file.

    * * @param file the physical file containing * the databases to be upgraded. * @param flags must be set to 0 or the * following value: * * * @throws DbException The Db.upgrade method may * fail and throw {@link com.sleepycat.db.DbException * DbException}, encapsulating one of the following non-zero * errors: *
  • The database cannot be upgraded by this version of * the Berkeley DB software. * @throws IllegalArgumentException The Db.upgrade method will * fail and throw a IllegalArgumentException exception if the * database is not in the same byte-order as the system; or * if an invalid flag value or parameter was specified. */ public void upgrade(String file, int flags) throws DbException { db_javaJNI.Db_upgrade(swigCPtr, file, flags); } void verify0(String file, String database, java.io.OutputStream outfile, int flags) { db_javaJNI.Db_verify0(swigCPtr, file, database, outfile, flags); } }