📄 db.java
字号:
throws DbException, FileNotFoundException; // returns: 0, DB_KEYEXIST, or throws error public native int put(DbTxn txnid, Dbt key, Dbt data, int flags) throws DbException; public native void remove(String name, String subname, int flags) throws DbException; // Note: this callback is not implemented // Comparison function. // public native void set_bt_compare(DbBtreeCompare bt_compare); // Maximum keys per page. public native void set_bt_maxkey(int maxkey) throws DbException; // Minimum keys per page. public native void set_bt_minkey(int minkey) throws DbException; // Note: this callback is not implemented // Prefix function. // public native void set_bt_prefix(DbBtreePrefix bt_prefix); // Set cache size public native void set_cachesize(int gbytes, int bytes, int ncaches) throws DbException; // Note: this callback is not implemented // Duplication resolution // public native void set_dup_compare(DbDupCompare dup_compare); // Error message callback. public native void set_errcall(DbErrcall errcall); // Error stream. public void set_error_stream(OutputStream s) { DbOutputStreamErrcall errcall = new DbOutputStreamErrcall(s); set_errcall(errcall); } // Error message prefix. public native void set_errpfx(String errpfx); // Feedback public void set_feedback(DbFeedback feedback) { feedback_ = feedback; feedback_changed(feedback); } // (Internal) private native void feedback_changed(DbFeedback feedback); // Flags. public native void set_flags(/*u_int32_t*/ int flags); // Fill factor. public native void set_h_ffactor(/*unsigned*/ int h_ffactor); // Note: this callback is not implemented // Hash function. // public native void set_h_hash(DbHash h_hash); // Number of elements. public native void set_h_nelem(/*unsigned*/ int h_nelem); // Byte order. public native void set_lorder(int lorder); // Underlying page size. public native void set_pagesize(/*size_t*/ long pagesize); // Variable-length delimiting byte. public native void set_re_delim(int re_delim); // Length for fixed-length records. public native void set_re_len(/*u_int32_t*/ int re_len); // Fixed-length padding byte. public native void set_re_pad(int re_pad); // Source file name. public native void set_re_source(String re_source); // returns a DbBtreeStat or DbHashStat public native Object stat(int flags) throws DbException; public native void sync(int flags) throws DbException; public native void upgrade(String name, int flags) throws DbException; protected native void finalize() throws Throwable; //////////////////////////////////////////////////////////////// // // private data // private long private_info_ = 0; private DbEnv dbenv_ = null; private DbFeedback feedback_ = null; private static boolean already_loaded_ = false; public static void load_db() { if (already_loaded_) return; // An alternate library name can be specified via a property. // String overrideLibname = System.getProperty("sleepycat.db.libname"); if (overrideLibname != null) { System.loadLibrary(overrideLibname); } else { String os = System.getProperty("os.name"); if (os != null && os.startsWith("Windows")) { // called libdb_java30.dll on Win/* System.loadLibrary("libdb_java" + DbConstants.DB_VERSION_MAJOR + DbConstants.DB_VERSION_MINOR); } else { // called libdb_java.so on UNIX System.loadLibrary("db_java"); } } already_loaded_ = true; } static private void check_constant(int c1, int c2) { if (c1 != c2) { System.err.println("Db: constant mismatch"); System.exit(1); } } static { Db.load_db(); // Note: constant values are stored in DbConstants, which // is automatically generated. Initializing constants in // static code insulates users from the possibility of // changing constants. // DB_CXX_NO_EXCEPTIONS = DbConstants.DB_CXX_NO_EXCEPTIONS; DB_XA_CREATE = DbConstants.DB_XA_CREATE; DB_CREATE = DbConstants.DB_CREATE; DB_NOMMAP = DbConstants.DB_NOMMAP; DB_THREAD = DbConstants.DB_THREAD; DB_LOCKDOWN = DbConstants.DB_LOCKDOWN; DB_PRIVATE = DbConstants.DB_PRIVATE; DB_TXN_SYNC = DbConstants.DB_TXN_SYNC; DB_TXN_NOWAIT = DbConstants.DB_TXN_NOWAIT; DB_EXCL = DbConstants.DB_EXCL; DB_RDONLY = DbConstants.DB_RDONLY; DB_TRUNCATE = DbConstants.DB_TRUNCATE; DB_UPGRADE = DbConstants.DB_UPGRADE; // These constants are not assigned, but rather checked. // Having initialized constants for these values allows // them to be used as case values in switch statements. // check_constant(DB_INCOMPLETE, DbConstants.DB_INCOMPLETE); check_constant(DB_KEYEMPTY, DbConstants.DB_KEYEMPTY); check_constant(DB_KEYEXIST, DbConstants.DB_KEYEXIST); check_constant(DB_LOCK_DEADLOCK, DbConstants.DB_LOCK_DEADLOCK); check_constant(DB_LOCK_NOTGRANTED, DbConstants.DB_LOCK_NOTGRANTED); check_constant(DB_NOTFOUND, DbConstants.DB_NOTFOUND); check_constant(DB_OLD_VERSION, DbConstants.DB_OLD_VERSION); check_constant(DB_RUNRECOVERY, DbConstants.DB_RUNRECOVERY); DB_FORCE = DbConstants.DB_FORCE; 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_TXN = DbConstants.DB_INIT_TXN; DB_RECOVER = DbConstants.DB_RECOVER; DB_RECOVER_FATAL = DbConstants.DB_RECOVER_FATAL; DB_SYSTEM_MEM = DbConstants.DB_SYSTEM_MEM; DB_TXN_NOSYNC = DbConstants.DB_TXN_NOSYNC; 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_WAITSFOR = DbConstants.DB_VERB_WAITSFOR; DB_LOCK_NORUN = DbConstants.DB_LOCK_NORUN; DB_LOCK_DEFAULT = DbConstants.DB_LOCK_DEFAULT; DB_LOCK_OLDEST = DbConstants.DB_LOCK_OLDEST; DB_LOCK_RANDOM = DbConstants.DB_LOCK_RANDOM; DB_LOCK_YOUNGEST = DbConstants.DB_LOCK_YOUNGEST; DB_DUP = DbConstants.DB_DUP; DB_DUPSORT = DbConstants.DB_DUPSORT; DB_RECNUM = DbConstants.DB_RECNUM; DB_RENUMBER = DbConstants.DB_RENUMBER; DB_REVSPLITOFF = DbConstants.DB_REVSPLITOFF; DB_SNAPSHOT = DbConstants.DB_SNAPSHOT; DB_LOCK_NOWAIT = DbConstants.DB_LOCK_NOWAIT; DB_LOCK_CONFLICT = DbConstants.DB_LOCK_CONFLICT; DB_LOCK_RW_N = DbConstants.DB_LOCK_RW_N; DB_ARCH_ABS = DbConstants.DB_ARCH_ABS; DB_ARCH_DATA = DbConstants.DB_ARCH_DATA; DB_ARCH_LOG = DbConstants.DB_ARCH_LOG; DB_AFTER = DbConstants.DB_AFTER; DB_APPEND = DbConstants.DB_APPEND; DB_BEFORE = DbConstants.DB_BEFORE; DB_CHECKPOINT = DbConstants.DB_CHECKPOINT; DB_CONSUME = DbConstants.DB_CONSUME; DB_CURLSN = DbConstants.DB_CURLSN; DB_CURRENT = DbConstants.DB_CURRENT; DB_FIRST = DbConstants.DB_FIRST; DB_FLUSH = DbConstants.DB_FLUSH; DB_GET_BOTH = DbConstants.DB_GET_BOTH; DB_GET_RECNO = DbConstants.DB_GET_RECNO; DB_JOIN_ITEM = DbConstants.DB_JOIN_ITEM; DB_KEYFIRST = DbConstants.DB_KEYFIRST; DB_KEYLAST = DbConstants.DB_KEYLAST; DB_LAST = DbConstants.DB_LAST; DB_NEXT = DbConstants.DB_NEXT; DB_NEXT_DUP = DbConstants.DB_NEXT_DUP; DB_NEXT_NODUP = DbConstants.DB_NEXT_NODUP; DB_NOOVERWRITE = DbConstants.DB_NOOVERWRITE; DB_NOSYNC = DbConstants.DB_NOSYNC; DB_POSITION = DbConstants.DB_POSITION; DB_PREV = DbConstants.DB_PREV; DB_RECORDCOUNT = DbConstants.DB_RECORDCOUNT; DB_SET = DbConstants.DB_SET; DB_SET_RANGE = DbConstants.DB_SET_RANGE; DB_SET_RECNO = DbConstants.DB_SET_RECNO; DB_WRITECURSOR = DbConstants.DB_WRITECURSOR; DB_RMW = DbConstants.DB_RMW; 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; }}// end of Db.java
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -