mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
BDB 4.1.24
BitKeeper/deleted/.del-ex_access.wpj~3df6ae8c99bf7c5f: Delete: bdb/build_vxworks/ex_access/ex_access.wpj BitKeeper/deleted/.del-ex_btrec.wpj~a7622f1c6f432dc6: Delete: bdb/build_vxworks/ex_btrec/ex_btrec.wpj BitKeeper/deleted/.del-ex_dbclient.wpj~7345440f3b204cdd: Delete: bdb/build_vxworks/ex_dbclient/ex_dbclient.wpj BitKeeper/deleted/.del-ex_env.wpj~fbe1ab10b04e8b74: Delete: bdb/build_vxworks/ex_env/ex_env.wpj BitKeeper/deleted/.del-ex_mpool.wpj~4479cfd5c45f327d: Delete: bdb/build_vxworks/ex_mpool/ex_mpool.wpj BitKeeper/deleted/.del-ex_tpcb.wpj~f78093006e14bf41: Delete: bdb/build_vxworks/ex_tpcb/ex_tpcb.wpj BitKeeper/deleted/.del-db_buildall.dsp~bd749ff6da11682: Delete: bdb/build_win32/db_buildall.dsp BitKeeper/deleted/.del-cxx_app.cpp~ad8df8e0791011ed: Delete: bdb/cxx/cxx_app.cpp BitKeeper/deleted/.del-cxx_log.cpp~a50ff3118fe06952: Delete: bdb/cxx/cxx_log.cpp BitKeeper/deleted/.del-cxx_table.cpp~ecd751e79b055556: Delete: bdb/cxx/cxx_table.cpp BitKeeper/deleted/.del-namemap.txt~796a3acd3885d8fd: Delete: bdb/cxx/namemap.txt BitKeeper/deleted/.del-Design.fileop~3ca4da68f1727373: Delete: bdb/db/Design.fileop BitKeeper/deleted/.del-db185_int.h~61bee3736e7959ef: Delete: bdb/db185/db185_int.h BitKeeper/deleted/.del-acconfig.h~411e8854d67ad8b5: Delete: bdb/dist/acconfig.h BitKeeper/deleted/.del-mutex.m4~a13383cde18a64e1: Delete: bdb/dist/aclocal/mutex.m4 BitKeeper/deleted/.del-options.m4~b9d0ca637213750a: Delete: bdb/dist/aclocal/options.m4 BitKeeper/deleted/.del-programs.m4~3ce7890b47732b30: Delete: bdb/dist/aclocal/programs.m4 BitKeeper/deleted/.del-tcl.m4~f944e2db93c3b6db: Delete: bdb/dist/aclocal/tcl.m4 BitKeeper/deleted/.del-types.m4~59cae158c9a32cff: Delete: bdb/dist/aclocal/types.m4 BitKeeper/deleted/.del-script~d38f6d3a4f159cb4: Delete: bdb/dist/build/script BitKeeper/deleted/.del-configure.in~ac795a92c8fe049c: Delete: bdb/dist/configure.in BitKeeper/deleted/.del-ltconfig~66bbd007d8024af: Delete: bdb/dist/ltconfig BitKeeper/deleted/.del-rec_ctemp~a28554362534f00a: Delete: bdb/dist/rec_ctemp BitKeeper/deleted/.del-s_tcl~2ffe4326459fcd9f: Delete: bdb/dist/s_tcl BitKeeper/deleted/.del-.IGNORE_ME~d8148b08fa7d5d15: Delete: bdb/dist/template/.IGNORE_ME BitKeeper/deleted/.del-btree.h~179f2aefec1753d: Delete: bdb/include/btree.h BitKeeper/deleted/.del-cxx_int.h~6b649c04766508f8: Delete: bdb/include/cxx_int.h BitKeeper/deleted/.del-db.src~6b433ae615b16a8d: Delete: bdb/include/db.src BitKeeper/deleted/.del-db_185.h~ad8b373d9391d35c: Delete: bdb/include/db_185.h BitKeeper/deleted/.del-db_am.h~a714912b6b75932f: Delete: bdb/include/db_am.h BitKeeper/deleted/.del-db_cxx.h~fcafadf45f5d19e9: Delete: bdb/include/db_cxx.h BitKeeper/deleted/.del-db_dispatch.h~6844f20f7eb46904: Delete: bdb/include/db_dispatch.h BitKeeper/deleted/.del-db_int.src~419a3f48b6a01da7: Delete: bdb/include/db_int.src BitKeeper/deleted/.del-db_join.h~76f9747a42c3399a: Delete: bdb/include/db_join.h BitKeeper/deleted/.del-db_page.h~e302ca3a4db3abdc: Delete: bdb/include/db_page.h BitKeeper/deleted/.del-db_server_int.h~e1d20b6ba3bca1ab: Delete: bdb/include/db_server_int.h BitKeeper/deleted/.del-db_shash.h~5fbf2d696fac90f3: Delete: bdb/include/db_shash.h BitKeeper/deleted/.del-db_swap.h~1e60887550864a59: Delete: bdb/include/db_swap.h BitKeeper/deleted/.del-db_upgrade.h~c644eee73701fc8d: Delete: bdb/include/db_upgrade.h BitKeeper/deleted/.del-db_verify.h~b8d6c297c61f342e: Delete: bdb/include/db_verify.h BitKeeper/deleted/.del-debug.h~dc2b4f2cf27ccebc: Delete: bdb/include/debug.h BitKeeper/deleted/.del-hash.h~2aaa548b28882dfb: Delete: bdb/include/hash.h BitKeeper/deleted/.del-lock.h~a761c1b7de57b77f: Delete: bdb/include/lock.h BitKeeper/deleted/.del-log.h~ff20184238e35e4d: Delete: bdb/include/log.h BitKeeper/deleted/.del-mp.h~7e317597622f3411: Delete: bdb/include/mp.h BitKeeper/deleted/.del-mutex.h~d3ae7a2977a68137: Delete: bdb/include/mutex.h BitKeeper/deleted/.del-os.h~91867cc8757cd0e3: Delete: bdb/include/os.h BitKeeper/deleted/.del-os_jump.h~e1b939fa5151d4be: Delete: bdb/include/os_jump.h BitKeeper/deleted/.del-qam.h~6fad0c1b5723d597: Delete: bdb/include/qam.h BitKeeper/deleted/.del-queue.h~4c72c0826c123d5: Delete: bdb/include/queue.h BitKeeper/deleted/.del-region.h~513fe04d977ca0fc: Delete: bdb/include/region.h BitKeeper/deleted/.del-shqueue.h~525fc3e6c2025c36: Delete: bdb/include/shqueue.h BitKeeper/deleted/.del-tcl_db.h~c536fd61a844f23f: Delete: bdb/include/tcl_db.h BitKeeper/deleted/.del-txn.h~c8d94b221ec147e4: Delete: bdb/include/txn.h BitKeeper/deleted/.del-xa.h~ecc466493aae9d9a: Delete: bdb/include/xa.h BitKeeper/deleted/.del-DbRecoveryInit.java~756b52601a0b9023: Delete: bdb/java/src/com/sleepycat/db/DbRecoveryInit.java BitKeeper/deleted/.del-DbTxnRecover.java~74607cba7ab89d6d: Delete: bdb/java/src/com/sleepycat/db/DbTxnRecover.java BitKeeper/deleted/.del-lock_conflict.c~fc5e0f14cf597a2b: Delete: bdb/lock/lock_conflict.c BitKeeper/deleted/.del-log.src~53ac9e7b5cb023f2: Delete: bdb/log/log.src BitKeeper/deleted/.del-log_findckp.c~24287f008916e81f: Delete: bdb/log/log_findckp.c BitKeeper/deleted/.del-log_rec.c~d51711f2cac09297: Delete: bdb/log/log_rec.c BitKeeper/deleted/.del-log_register.c~b40bb4efac75ca15: Delete: bdb/log/log_register.c BitKeeper/deleted/.del-Design~b3d0f179f2767b: Delete: bdb/mp/Design BitKeeper/deleted/.del-os_finit.c~95dbefc6fe79b26c: Delete: bdb/os/os_finit.c BitKeeper/deleted/.del-os_abs.c~df95d1e7db81924: Delete: bdb/os_vxworks/os_abs.c BitKeeper/deleted/.del-os_finit.c~803b484bdb9d0122: Delete: bdb/os_vxworks/os_finit.c BitKeeper/deleted/.del-os_map.c~3a6d7926398b76d3: Delete: bdb/os_vxworks/os_map.c BitKeeper/deleted/.del-os_finit.c~19a227c6d3c78ad: Delete: bdb/os_win32/os_finit.c BitKeeper/deleted/.del-log-corruption.patch~1cf2ecc7c6408d5d: Delete: bdb/patches/log-corruption.patch BitKeeper/deleted/.del-Btree.pm~af6d0c5eaed4a98e: Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Btree.pm BitKeeper/deleted/.del-BerkeleyDB.pm~7244036d4482643: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pm BitKeeper/deleted/.del-BerkeleyDB.pod~e7b18fd6132448e3: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod BitKeeper/deleted/.del-Hash.pm~10292a26c06a5c95: Delete: bdb/perl.BerkeleyDB/BerkeleyDB/Hash.pm BitKeeper/deleted/.del-BerkeleyDB.pod.P~79f76a1495eda203: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.pod.P BitKeeper/deleted/.del-BerkeleyDB.xs~80c99afbd98e392c: Delete: bdb/perl.BerkeleyDB/BerkeleyDB.xs BitKeeper/deleted/.del-Changes~729c1891efa60de9: Delete: bdb/perl.BerkeleyDB/Changes BitKeeper/deleted/.del-MANIFEST~63a1e34aecf157a0: Delete: bdb/perl.BerkeleyDB/MANIFEST BitKeeper/deleted/.del-Makefile.PL~c68797707d8df87a: Delete: bdb/perl.BerkeleyDB/Makefile.PL BitKeeper/deleted/.del-README~5f2f579b1a241407: Delete: bdb/perl.BerkeleyDB/README BitKeeper/deleted/.del-Todo~dca3c66c193adda9: Delete: bdb/perl.BerkeleyDB/Todo BitKeeper/deleted/.del-config.in~ae81681e450e0999: Delete: bdb/perl.BerkeleyDB/config.in BitKeeper/deleted/.del-dbinfo~28ad67d83be4f68e: Delete: bdb/perl.BerkeleyDB/dbinfo BitKeeper/deleted/.del-mkconsts~543ab60669c7a04e: Delete: bdb/perl.BerkeleyDB/mkconsts BitKeeper/deleted/.del-mkpod~182c0ca54e439afb: Delete: bdb/perl.BerkeleyDB/mkpod BitKeeper/deleted/.del-5.004~e008cb5a48805543: Delete: bdb/perl.BerkeleyDB/patches/5.004 BitKeeper/deleted/.del-irix_6_5.pl~61662bb08afcdec8: Delete: bdb/perl.BerkeleyDB/hints/irix_6_5.pl BitKeeper/deleted/.del-solaris.pl~6771e7182394e152: Delete: bdb/perl.BerkeleyDB/hints/solaris.pl BitKeeper/deleted/.del-typemap~783b8f5295b05f3d: Delete: bdb/perl.BerkeleyDB/typemap BitKeeper/deleted/.del-5.004_01~6081ce2fff7b0bc: Delete: bdb/perl.BerkeleyDB/patches/5.004_01 BitKeeper/deleted/.del-5.004_02~87214eac35ad9e6: Delete: bdb/perl.BerkeleyDB/patches/5.004_02 BitKeeper/deleted/.del-5.004_03~9a672becec7cb40f: Delete: bdb/perl.BerkeleyDB/patches/5.004_03 BitKeeper/deleted/.del-5.004_04~e326cb51af09d154: Delete: bdb/perl.BerkeleyDB/patches/5.004_04 BitKeeper/deleted/.del-5.004_05~7ab457a1e41a92fe: Delete: bdb/perl.BerkeleyDB/patches/5.004_05 BitKeeper/deleted/.del-5.005~f9e2d59b5964cd4b: Delete: bdb/perl.BerkeleyDB/patches/5.005 BitKeeper/deleted/.del-5.005_01~3eb9fb7b5842ea8e: Delete: bdb/perl.BerkeleyDB/patches/5.005_01 BitKeeper/deleted/.del-5.005_02~67477ce0bef717cb: Delete: bdb/perl.BerkeleyDB/patches/5.005_02 BitKeeper/deleted/.del-5.005_03~c4c29a1fb21e290a: Delete: bdb/perl.BerkeleyDB/patches/5.005_03 BitKeeper/deleted/.del-5.6.0~e1fb9897d124ee22: Delete: bdb/perl.BerkeleyDB/patches/5.6.0 BitKeeper/deleted/.del-btree.t~e4a1a3c675ddc406: Delete: bdb/perl.BerkeleyDB/t/btree.t BitKeeper/deleted/.del-db-3.0.t~d2c60991d84558f2: Delete: bdb/perl.BerkeleyDB/t/db-3.0.t BitKeeper/deleted/.del-db-3.1.t~6ee88cd13f55e018: Delete: bdb/perl.BerkeleyDB/t/db-3.1.t BitKeeper/deleted/.del-db-3.2.t~f73b6461f98fd1cf: Delete: bdb/perl.BerkeleyDB/t/db-3.2.t BitKeeper/deleted/.del-destroy.t~cc6a2ae1980a2ecd: Delete: bdb/perl.BerkeleyDB/t/destroy.t BitKeeper/deleted/.del-env.t~a8604a4499c4bd07: Delete: bdb/perl.BerkeleyDB/t/env.t BitKeeper/deleted/.del-examples.t~2571b77c3cc75574: Delete: bdb/perl.BerkeleyDB/t/examples.t BitKeeper/deleted/.del-examples.t.T~8228bdd75ac78b88: Delete: bdb/perl.BerkeleyDB/t/examples.t.T BitKeeper/deleted/.del-examples3.t.T~66a186897a87026d: Delete: bdb/perl.BerkeleyDB/t/examples3.t.T BitKeeper/deleted/.del-examples3.t~fe3822ba2f2d7f83: Delete: bdb/perl.BerkeleyDB/t/examples3.t BitKeeper/deleted/.del-filter.t~f87b045c1b708637: Delete: bdb/perl.BerkeleyDB/t/filter.t BitKeeper/deleted/.del-hash.t~616bfb4d644de3a3: Delete: bdb/perl.BerkeleyDB/t/hash.t BitKeeper/deleted/.del-join.t~29fc39f74a83ca22: Delete: bdb/perl.BerkeleyDB/t/join.t BitKeeper/deleted/.del-mldbm.t~31f5015341eea040: Delete: bdb/perl.BerkeleyDB/t/mldbm.t BitKeeper/deleted/.del-queue.t~8f338034ce44a641: Delete: bdb/perl.BerkeleyDB/t/queue.t BitKeeper/deleted/.del-recno.t~d4ddbd3743add63e: Delete: bdb/perl.BerkeleyDB/t/recno.t BitKeeper/deleted/.del-strict.t~6885cdd2ea71ca2d: Delete: bdb/perl.BerkeleyDB/t/strict.t BitKeeper/deleted/.del-subdb.t~aab62a5d5864c603: Delete: bdb/perl.BerkeleyDB/t/subdb.t BitKeeper/deleted/.del-txn.t~65033b8558ae1216: Delete: bdb/perl.BerkeleyDB/t/txn.t BitKeeper/deleted/.del-unknown.t~f3710458682665e1: Delete: bdb/perl.BerkeleyDB/t/unknown.t BitKeeper/deleted/.del-Changes~436f74a5c414c65b: Delete: bdb/perl.DB_File/Changes BitKeeper/deleted/.del-DB_File.pm~ae0951c6c7665a82: Delete: bdb/perl.DB_File/DB_File.pm BitKeeper/deleted/.del-DB_File.xs~89e49a0b5556f1d8: Delete: bdb/perl.DB_File/DB_File.xs BitKeeper/deleted/.del-DB_File_BS~290fad5dbbb87069: Delete: bdb/perl.DB_File/DB_File_BS BitKeeper/deleted/.del-MANIFEST~90ee581572bdd4ac: Delete: bdb/perl.DB_File/MANIFEST BitKeeper/deleted/.del-Makefile.PL~ac0567bb5a377e38: Delete: bdb/perl.DB_File/Makefile.PL BitKeeper/deleted/.del-README~77e924a5a9bae6b3: Delete: bdb/perl.DB_File/README BitKeeper/deleted/.del-config.in~ab4c2792b86a810b: Delete: bdb/perl.DB_File/config.in BitKeeper/deleted/.del-dbinfo~461c43b30fab2cb: Delete: bdb/perl.DB_File/dbinfo BitKeeper/deleted/.del-dynixptx.pl~50dcddfae25d17e9: Delete: bdb/perl.DB_File/hints/dynixptx.pl BitKeeper/deleted/.del-typemap~55cffb3288a9e587: Delete: bdb/perl.DB_File/typemap BitKeeper/deleted/.del-version.c~a4df0e646f8b3975: Delete: bdb/perl.DB_File/version.c BitKeeper/deleted/.del-5.004_01~d6830d0082702af7: Delete: bdb/perl.DB_File/patches/5.004_01 BitKeeper/deleted/.del-5.004_02~78b082dc80c91031: Delete: bdb/perl.DB_File/patches/5.004_02 BitKeeper/deleted/.del-5.004~4411ec2e3c9e008b: Delete: bdb/perl.DB_File/patches/5.004 BitKeeper/deleted/.del-sco.pl~1e795fe14fe4dcfe: Delete: bdb/perl.DB_File/hints/sco.pl BitKeeper/deleted/.del-5.004_03~33f274648b160d95: Delete: bdb/perl.DB_File/patches/5.004_03 BitKeeper/deleted/.del-5.004_04~8f3d1b3cf18bb20a: Delete: bdb/perl.DB_File/patches/5.004_04 BitKeeper/deleted/.del-5.004_05~9c0f02e7331e142: Delete: bdb/perl.DB_File/patches/5.004_05 BitKeeper/deleted/.del-5.005~c2108cb2e3c8d951: Delete: bdb/perl.DB_File/patches/5.005 BitKeeper/deleted/.del-5.005_01~3b45e9673afc4cfa: Delete: bdb/perl.DB_File/patches/5.005_01 BitKeeper/deleted/.del-5.005_02~9fe5766bb02a4522: Delete: bdb/perl.DB_File/patches/5.005_02 BitKeeper/deleted/.del-5.005_03~ffa1c38c19ae72ea: Delete: bdb/perl.DB_File/patches/5.005_03 BitKeeper/deleted/.del-5.6.0~373be3a5ce47be85: Delete: bdb/perl.DB_File/patches/5.6.0 BitKeeper/deleted/.del-db-btree.t~3231595a1c241eb3: Delete: bdb/perl.DB_File/t/db-btree.t BitKeeper/deleted/.del-db-hash.t~7c4ad0c795c7fad2: Delete: bdb/perl.DB_File/t/db-hash.t BitKeeper/deleted/.del-db-recno.t~6c2d3d80b9ba4a50: Delete: bdb/perl.DB_File/t/db-recno.t BitKeeper/deleted/.del-db_server.sed~cdb00ebcd48a64e2: Delete: bdb/rpc_server/db_server.sed BitKeeper/deleted/.del-db_server_proc.c~d46c8f409c3747f4: Delete: bdb/rpc_server/db_server_proc.c BitKeeper/deleted/.del-db_server_svc.sed~3f5e59f334fa4607: Delete: bdb/rpc_server/db_server_svc.sed BitKeeper/deleted/.del-db_server_util.c~a809f3a4629acda: Delete: bdb/rpc_server/db_server_util.c BitKeeper/deleted/.del-log.tcl~ff1b41f1355b97d7: Delete: bdb/test/log.tcl BitKeeper/deleted/.del-mpool.tcl~b0df4dc1b04db26c: Delete: bdb/test/mpool.tcl BitKeeper/deleted/.del-mutex.tcl~52fd5c73a150565: Delete: bdb/test/mutex.tcl BitKeeper/deleted/.del-txn.tcl~c4ff071550b5446e: Delete: bdb/test/txn.tcl BitKeeper/deleted/.del-README~e800a12a5392010a: Delete: bdb/test/upgrade/README BitKeeper/deleted/.del-pack-2.6.6.pl~89d5076d758d3e98: Delete: bdb/test/upgrade/generate-2.X/pack-2.6.6.pl BitKeeper/deleted/.del-test-2.6.patch~4a52dc83d447547b: Delete: bdb/test/upgrade/generate-2.X/test-2.6.patch
This commit is contained in:
@ -30,7 +30,7 @@ nextline:
|
||||
$def = "";
|
||||
}
|
||||
if ($in_def == 1) {
|
||||
$def .= $_;
|
||||
$def .= " $_";
|
||||
}
|
||||
if (/\)/) {
|
||||
$line = "";
|
||||
@ -42,6 +42,8 @@ nextline:
|
||||
# remove comments
|
||||
s@/\*[^*]*\*/@@g;
|
||||
s@[ ][ ]*@ @g;
|
||||
s@^[ ]@@g;
|
||||
s@[ ]$@@g;
|
||||
s@JNIEnv *\* *@JNIEnv @g;
|
||||
s@([,*()]) @\1@g;
|
||||
s@ ([,*()])@\1@g;
|
||||
|
@ -3,10 +3,211 @@
|
||||
/* Header for class com_sleepycat_db_Db */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_Db
|
||||
#define _Included_com_sleepycat_db_Db
|
||||
#define _Included_com_sleepycat_db_Db
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#undef com_sleepycat_db_Db_DB_BTREE
|
||||
#define com_sleepycat_db_Db_DB_BTREE 1L
|
||||
#undef com_sleepycat_db_Db_DB_DONOTINDEX
|
||||
#define com_sleepycat_db_Db_DB_DONOTINDEX -30999L
|
||||
#undef com_sleepycat_db_Db_DB_HASH
|
||||
#define com_sleepycat_db_Db_DB_HASH 2L
|
||||
#undef com_sleepycat_db_Db_DB_KEYEMPTY
|
||||
#define com_sleepycat_db_Db_DB_KEYEMPTY -30998L
|
||||
#undef com_sleepycat_db_Db_DB_KEYEXIST
|
||||
#define com_sleepycat_db_Db_DB_KEYEXIST -30997L
|
||||
#undef com_sleepycat_db_Db_DB_LOCK_DEADLOCK
|
||||
#define com_sleepycat_db_Db_DB_LOCK_DEADLOCK -30996L
|
||||
#undef com_sleepycat_db_Db_DB_LOCK_NOTGRANTED
|
||||
#define com_sleepycat_db_Db_DB_LOCK_NOTGRANTED -30995L
|
||||
#undef com_sleepycat_db_Db_DB_NOSERVER
|
||||
#define com_sleepycat_db_Db_DB_NOSERVER -30994L
|
||||
#undef com_sleepycat_db_Db_DB_NOSERVER_HOME
|
||||
#define com_sleepycat_db_Db_DB_NOSERVER_HOME -30993L
|
||||
#undef com_sleepycat_db_Db_DB_NOSERVER_ID
|
||||
#define com_sleepycat_db_Db_DB_NOSERVER_ID -30992L
|
||||
#undef com_sleepycat_db_Db_DB_NOTFOUND
|
||||
#define com_sleepycat_db_Db_DB_NOTFOUND -30991L
|
||||
#undef com_sleepycat_db_Db_DB_OLD_VERSION
|
||||
#define com_sleepycat_db_Db_DB_OLD_VERSION -30990L
|
||||
#undef com_sleepycat_db_Db_DB_PAGE_NOTFOUND
|
||||
#define com_sleepycat_db_Db_DB_PAGE_NOTFOUND -30989L
|
||||
#undef com_sleepycat_db_Db_DB_QUEUE
|
||||
#define com_sleepycat_db_Db_DB_QUEUE 4L
|
||||
#undef com_sleepycat_db_Db_DB_RECNO
|
||||
#define com_sleepycat_db_Db_DB_RECNO 3L
|
||||
#undef com_sleepycat_db_Db_DB_REP_DUPMASTER
|
||||
#define com_sleepycat_db_Db_DB_REP_DUPMASTER -30988L
|
||||
#undef com_sleepycat_db_Db_DB_REP_HOLDELECTION
|
||||
#define com_sleepycat_db_Db_DB_REP_HOLDELECTION -30987L
|
||||
#undef com_sleepycat_db_Db_DB_REP_NEWMASTER
|
||||
#define com_sleepycat_db_Db_DB_REP_NEWMASTER -30986L
|
||||
#undef com_sleepycat_db_Db_DB_REP_NEWSITE
|
||||
#define com_sleepycat_db_Db_DB_REP_NEWSITE -30985L
|
||||
#undef com_sleepycat_db_Db_DB_REP_OUTDATED
|
||||
#define com_sleepycat_db_Db_DB_REP_OUTDATED -30984L
|
||||
#undef com_sleepycat_db_Db_DB_RUNRECOVERY
|
||||
#define com_sleepycat_db_Db_DB_RUNRECOVERY -30982L
|
||||
#undef com_sleepycat_db_Db_DB_SECONDARY_BAD
|
||||
#define com_sleepycat_db_Db_DB_SECONDARY_BAD -30981L
|
||||
#undef com_sleepycat_db_Db_DB_TXN_ABORT
|
||||
#define com_sleepycat_db_Db_DB_TXN_ABORT 0L
|
||||
#undef com_sleepycat_db_Db_DB_TXN_APPLY
|
||||
#define com_sleepycat_db_Db_DB_TXN_APPLY 1L
|
||||
#undef com_sleepycat_db_Db_DB_TXN_BACKWARD_ROLL
|
||||
#define com_sleepycat_db_Db_DB_TXN_BACKWARD_ROLL 3L
|
||||
#undef com_sleepycat_db_Db_DB_TXN_FORWARD_ROLL
|
||||
#define com_sleepycat_db_Db_DB_TXN_FORWARD_ROLL 4L
|
||||
#undef com_sleepycat_db_Db_DB_TXN_PRINT
|
||||
#define com_sleepycat_db_Db_DB_TXN_PRINT 8L
|
||||
#undef com_sleepycat_db_Db_DB_UNKNOWN
|
||||
#define com_sleepycat_db_Db_DB_UNKNOWN 5L
|
||||
#undef com_sleepycat_db_Db_DB_VERIFY_BAD
|
||||
#define com_sleepycat_db_Db_DB_VERIFY_BAD -30980L
|
||||
/* Inaccessible static: DB_AFTER */
|
||||
/* Inaccessible static: DB_AGGRESSIVE */
|
||||
/* Inaccessible static: DB_APPEND */
|
||||
/* Inaccessible static: DB_ARCH_ABS */
|
||||
/* Inaccessible static: DB_ARCH_DATA */
|
||||
/* Inaccessible static: DB_ARCH_LOG */
|
||||
/* Inaccessible static: DB_AUTO_COMMIT */
|
||||
/* Inaccessible static: DB_BEFORE */
|
||||
/* Inaccessible static: DB_CACHED_COUNTS */
|
||||
/* Inaccessible static: DB_CDB_ALLDB */
|
||||
/* Inaccessible static: DB_CHKSUM_SHA1 */
|
||||
/* Inaccessible static: DB_CLIENT */
|
||||
/* Inaccessible static: DB_CONSUME */
|
||||
/* Inaccessible static: DB_CONSUME_WAIT */
|
||||
/* Inaccessible static: DB_CREATE */
|
||||
/* Inaccessible static: DB_CURRENT */
|
||||
/* Inaccessible static: DB_CXX_NO_EXCEPTIONS */
|
||||
/* Inaccessible static: DB_DBT_MALLOC */
|
||||
/* Inaccessible static: DB_DBT_PARTIAL */
|
||||
/* Inaccessible static: DB_DBT_REALLOC */
|
||||
/* Inaccessible static: DB_DBT_USERMEM */
|
||||
/* Inaccessible static: DB_DIRECT */
|
||||
/* Inaccessible static: DB_DIRECT_DB */
|
||||
/* Inaccessible static: DB_DIRECT_LOG */
|
||||
/* Inaccessible static: DB_DIRTY_READ */
|
||||
/* Inaccessible static: DB_DUP */
|
||||
/* Inaccessible static: DB_DUPSORT */
|
||||
/* Inaccessible static: DB_EID_BROADCAST */
|
||||
/* Inaccessible static: DB_EID_INVALID */
|
||||
/* Inaccessible static: DB_ENCRYPT */
|
||||
/* Inaccessible static: DB_ENCRYPT_AES */
|
||||
/* Inaccessible static: DB_EXCL */
|
||||
/* Inaccessible static: DB_FAST_STAT */
|
||||
/* Inaccessible static: DB_FIRST */
|
||||
/* Inaccessible static: DB_FLUSH */
|
||||
/* Inaccessible static: DB_FORCE */
|
||||
/* Inaccessible static: DB_GET_BOTH */
|
||||
/* Inaccessible static: DB_GET_BOTH_RANGE */
|
||||
/* Inaccessible static: DB_GET_RECNO */
|
||||
/* Inaccessible static: DB_INIT_CDB */
|
||||
/* Inaccessible static: DB_INIT_LOCK */
|
||||
/* Inaccessible static: DB_INIT_LOG */
|
||||
/* Inaccessible static: DB_INIT_MPOOL */
|
||||
/* Inaccessible static: DB_INIT_TXN */
|
||||
/* Inaccessible static: DB_JOINENV */
|
||||
/* Inaccessible static: DB_JOIN_ITEM */
|
||||
/* Inaccessible static: DB_JOIN_NOSORT */
|
||||
/* Inaccessible static: DB_KEYFIRST */
|
||||
/* Inaccessible static: DB_KEYLAST */
|
||||
/* Inaccessible static: DB_LAST */
|
||||
/* Inaccessible static: DB_LOCKDOWN */
|
||||
/* Inaccessible static: DB_LOCK_DEFAULT */
|
||||
/* Inaccessible static: DB_LOCK_EXPIRE */
|
||||
/* Inaccessible static: DB_LOCK_GET */
|
||||
/* Inaccessible static: DB_LOCK_GET_TIMEOUT */
|
||||
/* Inaccessible static: DB_LOCK_IREAD */
|
||||
/* Inaccessible static: DB_LOCK_IWR */
|
||||
/* Inaccessible static: DB_LOCK_IWRITE */
|
||||
/* Inaccessible static: DB_LOCK_MAXLOCKS */
|
||||
/* Inaccessible static: DB_LOCK_MINLOCKS */
|
||||
/* Inaccessible static: DB_LOCK_MINWRITE */
|
||||
/* Inaccessible static: DB_LOCK_NOWAIT */
|
||||
/* Inaccessible static: DB_LOCK_OLDEST */
|
||||
/* Inaccessible static: DB_LOCK_PUT */
|
||||
/* Inaccessible static: DB_LOCK_PUT_ALL */
|
||||
/* Inaccessible static: DB_LOCK_PUT_OBJ */
|
||||
/* Inaccessible static: DB_LOCK_RANDOM */
|
||||
/* Inaccessible static: DB_LOCK_READ */
|
||||
/* Inaccessible static: DB_LOCK_TIMEOUT */
|
||||
/* Inaccessible static: DB_LOCK_WRITE */
|
||||
/* Inaccessible static: DB_LOCK_YOUNGEST */
|
||||
/* Inaccessible static: DB_MULTIPLE */
|
||||
/* Inaccessible static: DB_MULTIPLE_KEY */
|
||||
/* Inaccessible static: DB_NEXT */
|
||||
/* Inaccessible static: DB_NEXT_DUP */
|
||||
/* Inaccessible static: DB_NEXT_NODUP */
|
||||
/* Inaccessible static: DB_NODUPDATA */
|
||||
/* Inaccessible static: DB_NOLOCKING */
|
||||
/* Inaccessible static: DB_NOMMAP */
|
||||
/* Inaccessible static: DB_NOORDERCHK */
|
||||
/* Inaccessible static: DB_NOOVERWRITE */
|
||||
/* Inaccessible static: DB_NOPANIC */
|
||||
/* Inaccessible static: DB_NOSYNC */
|
||||
/* Inaccessible static: DB_ODDFILESIZE */
|
||||
/* Inaccessible static: DB_ORDERCHKONLY */
|
||||
/* Inaccessible static: DB_OVERWRITE */
|
||||
/* Inaccessible static: DB_PANIC_ENVIRONMENT */
|
||||
/* Inaccessible static: DB_POSITION */
|
||||
/* Inaccessible static: DB_PREV */
|
||||
/* Inaccessible static: DB_PREV_NODUP */
|
||||
/* Inaccessible static: DB_PRINTABLE */
|
||||
/* Inaccessible static: DB_PRIORITY_DEFAULT */
|
||||
/* Inaccessible static: DB_PRIORITY_HIGH */
|
||||
/* Inaccessible static: DB_PRIORITY_LOW */
|
||||
/* Inaccessible static: DB_PRIORITY_VERY_HIGH */
|
||||
/* Inaccessible static: DB_PRIORITY_VERY_LOW */
|
||||
/* Inaccessible static: DB_PRIVATE */
|
||||
/* Inaccessible static: DB_RDONLY */
|
||||
/* Inaccessible static: DB_RECNUM */
|
||||
/* Inaccessible static: DB_RECORDCOUNT */
|
||||
/* Inaccessible static: DB_RECOVER */
|
||||
/* Inaccessible static: DB_RECOVER_FATAL */
|
||||
/* Inaccessible static: DB_REGION_INIT */
|
||||
/* Inaccessible static: DB_RENUMBER */
|
||||
/* Inaccessible static: DB_REP_CLIENT */
|
||||
/* Inaccessible static: DB_REP_LOGSONLY */
|
||||
/* Inaccessible static: DB_REP_MASTER */
|
||||
/* Inaccessible static: DB_REP_PERMANENT */
|
||||
/* Inaccessible static: DB_REP_UNAVAIL */
|
||||
/* Inaccessible static: DB_REVSPLITOFF */
|
||||
/* Inaccessible static: DB_RMW */
|
||||
/* Inaccessible static: DB_SALVAGE */
|
||||
/* Inaccessible static: DB_SET */
|
||||
/* Inaccessible static: DB_SET_LOCK_TIMEOUT */
|
||||
/* Inaccessible static: DB_SET_RANGE */
|
||||
/* Inaccessible static: DB_SET_RECNO */
|
||||
/* Inaccessible static: DB_SET_TXN_TIMEOUT */
|
||||
/* Inaccessible static: DB_SNAPSHOT */
|
||||
/* Inaccessible static: DB_STAT_CLEAR */
|
||||
/* Inaccessible static: DB_SYSTEM_MEM */
|
||||
/* Inaccessible static: DB_THREAD */
|
||||
/* Inaccessible static: DB_TRUNCATE */
|
||||
/* Inaccessible static: DB_TXN_NOSYNC */
|
||||
/* Inaccessible static: DB_TXN_NOWAIT */
|
||||
/* Inaccessible static: DB_TXN_SYNC */
|
||||
/* Inaccessible static: DB_TXN_WRITE_NOSYNC */
|
||||
/* Inaccessible static: DB_UPGRADE */
|
||||
/* Inaccessible static: DB_USE_ENVIRON */
|
||||
/* Inaccessible static: DB_USE_ENVIRON_ROOT */
|
||||
/* Inaccessible static: DB_VERB_CHKPOINT */
|
||||
/* Inaccessible static: DB_VERB_DEADLOCK */
|
||||
/* Inaccessible static: DB_VERB_RECOVERY */
|
||||
/* Inaccessible static: DB_VERB_REPLICATION */
|
||||
/* Inaccessible static: DB_VERB_WAITSFOR */
|
||||
/* Inaccessible static: DB_VERIFY */
|
||||
/* Inaccessible static: DB_VERSION_MAJOR */
|
||||
/* Inaccessible static: DB_VERSION_MINOR */
|
||||
/* Inaccessible static: DB_VERSION_PATCH */
|
||||
/* Inaccessible static: DB_WRITECURSOR */
|
||||
/* Inaccessible static: DB_XA_CREATE */
|
||||
/* Inaccessible static: DB_XIDDATASIZE */
|
||||
/* Inaccessible static: DB_YIELDCPU */
|
||||
/* Inaccessible static: already_loaded_ */
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: _init
|
||||
@ -23,6 +224,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_Db__1init
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db__1notify_1internal
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: _associate
|
||||
* Signature: (Lcom/sleepycat/db/DbTxn;Lcom/sleepycat/db/Db;Lcom/sleepycat/db/DbSecondaryKeyCreate;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db__1associate
|
||||
(JNIEnv *, jobject, jobject, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: _close
|
||||
@ -122,10 +331,18 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_key_1range
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: _open
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;III)V
|
||||
* Signature: (Lcom/sleepycat/db/DbTxn;Ljava/lang/String;Ljava/lang/String;III)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db__1open
|
||||
(JNIEnv *, jobject, jstring, jstring, jint, jint, jint);
|
||||
(JNIEnv *, jobject, jobject, jstring, jstring, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: pget
|
||||
* Signature: (Lcom/sleepycat/db/DbTxn;Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_pget
|
||||
(JNIEnv *, jobject, jobject, jobject, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
@ -137,18 +354,18 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_put
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: rename
|
||||
* Method: _rename
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_rename
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db__1rename
|
||||
(JNIEnv *, jobject, jstring, jstring, jstring, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: remove
|
||||
* Method: _remove
|
||||
* Signature: (Ljava/lang/String;Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_remove
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db__1remove
|
||||
(JNIEnv *, jobject, jstring, jstring, jint);
|
||||
|
||||
/*
|
||||
@ -199,6 +416,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_bt_1prefix_1changed
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_set_1cachesize
|
||||
(JNIEnv *, jobject, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: set_cache_priority
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_set_1cache_1priority
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: dup_compare_changed
|
||||
@ -207,6 +432,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_set_1cachesize
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_dup_1compare_1changed
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: set_encrypt
|
||||
* Signature: (Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_set_1encrypt
|
||||
(JNIEnv *, jobject, jstring, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: feedback_changed
|
||||
@ -223,6 +456,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_feedback_1changed
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_set_1flags
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: get_flags_raw
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_get_1flags_1raw
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: set_h_ffactor
|
||||
@ -314,11 +555,19 @@ JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Db_stat
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: sync
|
||||
* Signature: (I)I
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_sync
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Db_sync
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: truncate
|
||||
* Signature: (Lcom/sleepycat/db/DbTxn;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Db_truncate
|
||||
(JNIEnv *, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Db
|
||||
* Method: upgrade
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* Header for class com_sleepycat_db_DbEnv */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_DbEnv
|
||||
#define _Included_com_sleepycat_db_DbEnv
|
||||
#define _Included_com_sleepycat_db_DbEnv
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -15,6 +15,22 @@ extern "C" {
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv__1close
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: dbremove
|
||||
* Signature: (Lcom/sleepycat/db/DbTxn;Ljava/lang/String;Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_dbremove
|
||||
(JNIEnv *, jobject, jobject, jstring, jstring, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: dbrename
|
||||
* Signature: (Lcom/sleepycat/db/DbTxn;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_dbrename
|
||||
(JNIEnv *, jobject, jobject, jstring, jstring, jstring, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: err
|
||||
@ -55,6 +71,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv__1init
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv__1init_1using_1db
|
||||
(JNIEnv *, jobject, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: _init_using_xa
|
||||
* Signature: (Lcom/sleepycat/db/DbErrcall;II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv__1init_1using_1xa
|
||||
(JNIEnv *, jobject, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: _notify_db_close
|
||||
@ -87,6 +111,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_remove
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1cachesize
|
||||
(JNIEnv *, jobject, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_encrypt
|
||||
* Signature: (Ljava/lang/String;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1encrypt
|
||||
(JNIEnv *, jobject, jstring, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: _set_errcall
|
||||
@ -106,7 +138,7 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv__1set_1errpfx
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: feedback_changed
|
||||
* Signature: (Lcom/sleepycat/db/DbFeedback;)V
|
||||
* Signature: (Lcom/sleepycat/db/DbEnvFeedback;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_feedback_1changed
|
||||
(JNIEnv *, jobject, jobject);
|
||||
@ -114,10 +146,10 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_feedback_1changed
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_verbose
|
||||
* Signature: (II)V
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1verbose
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
(JNIEnv *, jobject, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
@ -151,6 +183,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lg_1dir
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lg_1max
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_lg_regionmax
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lg_1regionmax
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_lk_conflicts
|
||||
@ -207,61 +247,37 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1lk_1max_1objects
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1mp_1mmapsize
|
||||
(JNIEnv *, jobject, jlong);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_mutexlocks
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1mutexlocks
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_pageyield
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1pageyield
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_panicstate
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1panicstate
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: recovery_init_changed
|
||||
* Signature: (Lcom/sleepycat/db/DbRecoveryInit;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_recovery_1init_1changed
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_region_init
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1region_1init
|
||||
(JNIEnv *, jclass, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_flags
|
||||
* Signature: (II)V
|
||||
* Signature: (IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1flags
|
||||
(JNIEnv *, jobject, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_rep_limit
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1rep_1limit
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_server
|
||||
* Signature: (Ljava/lang/String;JJI)V
|
||||
* Method: rep_transport_changed
|
||||
* Signature: (ILcom/sleepycat/db/DbRepTransport;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1server
|
||||
(JNIEnv *, jobject, jstring, jlong, jlong, jint);
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_rep_1transport_1changed
|
||||
(JNIEnv *, jobject, jint, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_rpc_server
|
||||
* Signature: (Lcom/sleepycat/db/DbClient;Ljava/lang/String;JJI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1rpc_1server
|
||||
(JNIEnv *, jobject, jobject, jstring, jlong, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
@ -277,7 +293,15 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1shm_1key
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1tas_1spins
|
||||
(JNIEnv *, jclass, jint);
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: set_timeout
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1timeout
|
||||
(JNIEnv *, jobject, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
@ -289,10 +313,10 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_set_1tmp_1dir
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: tx_recover_changed
|
||||
* Signature: (Lcom/sleepycat/db/DbTxnRecover;)V
|
||||
* Method: app_dispatch_changed
|
||||
* Signature: (Lcom/sleepycat/db/DbAppDispatch;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_tx_1recover_1changed
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_app_1dispatch_1changed
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
@ -367,6 +391,14 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_lock_1detect
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_lock_1get
|
||||
(JNIEnv *, jobject, jint, jint, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: lock_put
|
||||
* Signature: (Lcom/sleepycat/db/DbLock;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_lock_1put
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: lock_id
|
||||
@ -375,13 +407,29 @@ JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_lock_1get
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_lock_1id
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: lock_id_free
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_lock_1id_1free
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: lock_stat
|
||||
* Signature: ()Lcom/sleepycat/db/DbLockStat;
|
||||
* Signature: (I)Lcom/sleepycat/db/DbLockStat;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_lock_1stat
|
||||
(JNIEnv *, jobject);
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: lock_vec
|
||||
* Signature: (II[Lcom/sleepycat/db/DbLockRequest;II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_lock_1vec
|
||||
(JNIEnv *, jobject, jint, jint, jobjectArray, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
@ -399,6 +447,14 @@ JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbEnv_log_1archive
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_log_1compare
|
||||
(JNIEnv *, jclass, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: log_cursor
|
||||
* Signature: (I)Lcom/sleepycat/db/DbLogc;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_log_1cursor
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: log_file
|
||||
@ -415,14 +471,6 @@ JNIEXPORT jstring JNICALL Java_com_sleepycat_db_DbEnv_log_1file
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_log_1flush
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: log_get
|
||||
* Signature: (Lcom/sleepycat/db/DbLsn;Lcom/sleepycat/db/Dbt;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_log_1get
|
||||
(JNIEnv *, jobject, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: log_put
|
||||
@ -434,42 +482,26 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_log_1put
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: log_stat
|
||||
* Signature: ()Lcom/sleepycat/db/DbLogStat;
|
||||
* Signature: (I)Lcom/sleepycat/db/DbLogStat;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_log_1stat
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: log_register
|
||||
* Signature: (Lcom/sleepycat/db/Db;Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_log_1register
|
||||
(JNIEnv *, jobject, jobject, jstring);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: log_unregister
|
||||
* Signature: (Lcom/sleepycat/db/Db;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_log_1unregister
|
||||
(JNIEnv *, jobject, jobject);
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: memp_stat
|
||||
* Signature: ()Lcom/sleepycat/db/DbMpoolStat;
|
||||
* Signature: (I)Lcom/sleepycat/db/DbMpoolStat;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_memp_1stat
|
||||
(JNIEnv *, jobject);
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: memp_fstat
|
||||
* Signature: ()[Lcom/sleepycat/db/DbMpoolFStat;
|
||||
* Signature: (I)[Lcom/sleepycat/db/DbMpoolFStat;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbEnv_memp_1fstat
|
||||
(JNIEnv *, jobject);
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
@ -479,6 +511,38 @@ JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbEnv_memp_1fstat
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_memp_1trickle
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: rep_elect
|
||||
* Signature: (III)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_rep_1elect
|
||||
(JNIEnv *, jobject, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: rep_process_message
|
||||
* Signature: (Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/DbEnv$RepProcessMessage;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_rep_1process_1message
|
||||
(JNIEnv *, jobject, jobject, jobject, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: rep_start
|
||||
* Signature: (Lcom/sleepycat/db/Dbt;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_rep_1start
|
||||
(JNIEnv *, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: rep_stat
|
||||
* Signature: (I)Lcom/sleepycat/db/DbRepStat;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_rep_1stat
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: txn_begin
|
||||
@ -490,18 +554,26 @@ JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_txn_1begin
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: txn_checkpoint
|
||||
* Signature: (III)I
|
||||
* Signature: (III)V
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbEnv_txn_1checkpoint
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbEnv_txn_1checkpoint
|
||||
(JNIEnv *, jobject, jint, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: txn_recover
|
||||
* Signature: (II)[Lcom/sleepycat/db/DbPreplist;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_DbEnv_txn_1recover
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbEnv
|
||||
* Method: txn_stat
|
||||
* Signature: ()Lcom/sleepycat/db/DbTxnStat;
|
||||
* Signature: (I)Lcom/sleepycat/db/DbTxnStat;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_DbEnv_txn_1stat
|
||||
(JNIEnv *, jobject);
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* Header for class com_sleepycat_db_DbLock */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_DbLock
|
||||
#define _Included_com_sleepycat_db_DbLock
|
||||
#define _Included_com_sleepycat_db_DbLock
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -15,14 +15,6 @@ extern "C" {
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_finalize
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbLock
|
||||
* Method: put
|
||||
* Signature: (Lcom/sleepycat/db/DbEnv;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_put
|
||||
(JNIEnv *, jobject, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
37
bdb/libdb_java/com_sleepycat_db_DbLogc.h
Normal file
37
bdb/libdb_java/com_sleepycat_db_DbLogc.h
Normal file
@ -0,0 +1,37 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_sleepycat_db_DbLogc */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_DbLogc
|
||||
#define _Included_com_sleepycat_db_DbLogc
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbLogc
|
||||
* Method: close
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogc_close
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbLogc
|
||||
* Method: get
|
||||
* Signature: (Lcom/sleepycat/db/DbLsn;Lcom/sleepycat/db/Dbt;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogc_get
|
||||
(JNIEnv *, jobject, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbLogc
|
||||
* Method: finalize
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogc_finalize
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -3,7 +3,7 @@
|
||||
/* Header for class com_sleepycat_db_DbLsn */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_DbLsn
|
||||
#define _Included_com_sleepycat_db_DbLsn
|
||||
#define _Included_com_sleepycat_db_DbLsn
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* Header for class com_sleepycat_db_DbTxn */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_DbTxn
|
||||
#define _Included_com_sleepycat_db_DbTxn
|
||||
#define _Included_com_sleepycat_db_DbTxn
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -23,6 +23,14 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_abort
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_commit
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbTxn
|
||||
* Method: discard
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_discard
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbTxn
|
||||
* Method: id
|
||||
@ -34,18 +42,18 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxn_id
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbTxn
|
||||
* Method: prepare
|
||||
* Signature: ()V
|
||||
* Signature: ([B)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_prepare
|
||||
(JNIEnv *, jobject);
|
||||
(JNIEnv *, jobject, jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbTxn
|
||||
* Method: finalize
|
||||
* Signature: ()V
|
||||
* Method: set_timeout
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_finalize
|
||||
(JNIEnv *, jobject);
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_set_1timeout
|
||||
(JNIEnv *, jobject, jlong, jint);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
22
bdb/libdb_java/com_sleepycat_db_DbUtil.h
Normal file
22
bdb/libdb_java/com_sleepycat_db_DbUtil.h
Normal file
@ -0,0 +1,22 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_sleepycat_db_DbUtil */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_DbUtil
|
||||
#define _Included_com_sleepycat_db_DbUtil
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: big_endian */
|
||||
/*
|
||||
* Class: com_sleepycat_db_DbUtil
|
||||
* Method: is_big_endian
|
||||
* Signature: ()Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL Java_com_sleepycat_db_DbUtil_is_1big_1endian
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
@ -3,7 +3,7 @@
|
||||
/* Header for class com_sleepycat_db_Dbc */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_Dbc
|
||||
#define _Included_com_sleepycat_db_Dbc
|
||||
#define _Included_com_sleepycat_db_Dbc
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -47,6 +47,14 @@ JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Dbc_dup
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_get
|
||||
(JNIEnv *, jobject, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbc
|
||||
* Method: pget
|
||||
* Signature: (Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;Lcom/sleepycat/db/Dbt;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_pget
|
||||
(JNIEnv *, jobject, jobject, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbc
|
||||
* Method: put
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* Header for class com_sleepycat_db_Dbt */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_Dbt
|
||||
#define _Included_com_sleepycat_db_Dbt
|
||||
#define _Included_com_sleepycat_db_Dbt
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -15,134 +15,6 @@ extern "C" {
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_finalize
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_data
|
||||
* Signature: ()[B
|
||||
*/
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_sleepycat_db_Dbt_get_1data
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: internal_set_data
|
||||
* Signature: ([B)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_internal_1set_1data
|
||||
(JNIEnv *, jobject, jbyteArray);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: set_offset
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1offset
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_offset
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1offset
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_size
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1size
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: set_size
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1size
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_ulen
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1ulen
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: set_ulen
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1ulen
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_dlen
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1dlen
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: set_dlen
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1dlen
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_doff
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1doff
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: set_doff
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1doff
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_flags
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1flags
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: set_flags
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1flags
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: set_recno_key_data
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1recno_1key_1data
|
||||
(JNIEnv *, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: get_recno_key_data
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1recno_1key_1data
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: init
|
||||
@ -151,6 +23,14 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1recno_1key_1data
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_init
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_Dbt
|
||||
* Method: create_data
|
||||
* Signature: ()[B
|
||||
*/
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_sleepycat_db_Dbt_create_1data
|
||||
(JNIEnv *, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
95
bdb/libdb_java/com_sleepycat_db_xa_DbXAResource.h
Normal file
95
bdb/libdb_java/com_sleepycat_db_xa_DbXAResource.h
Normal file
@ -0,0 +1,95 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class com_sleepycat_db_xa_DbXAResource */
|
||||
|
||||
#ifndef _Included_com_sleepycat_db_xa_DbXAResource
|
||||
#define _Included_com_sleepycat_db_xa_DbXAResource
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: unique_rmid */
|
||||
/* Inaccessible static: class_00024com_00024sleepycat_00024db_00024xa_00024DbXAResource */
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _init
|
||||
* Signature: (Ljava/lang/String;II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1init
|
||||
(JNIEnv *, jobject, jstring, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _close
|
||||
* Signature: (Ljava/lang/String;II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1close
|
||||
(JNIEnv *, jobject, jstring, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _commit
|
||||
* Signature: (Ljavax/transaction/xa/Xid;IZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1commit
|
||||
(JNIEnv *, jobject, jobject, jint, jboolean);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _end
|
||||
* Signature: (Ljavax/transaction/xa/Xid;II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1end
|
||||
(JNIEnv *, jobject, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _forget
|
||||
* Signature: (Ljavax/transaction/xa/Xid;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1forget
|
||||
(JNIEnv *, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _prepare
|
||||
* Signature: (Ljavax/transaction/xa/Xid;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_xa_DbXAResource__1prepare
|
||||
(JNIEnv *, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _recover
|
||||
* Signature: (II)[Ljavax/transaction/xa/Xid;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_xa_DbXAResource__1recover
|
||||
(JNIEnv *, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _rollback
|
||||
* Signature: (Ljavax/transaction/xa/Xid;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1rollback
|
||||
(JNIEnv *, jobject, jobject, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: _start
|
||||
* Signature: (Ljavax/transaction/xa/Xid;II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1start
|
||||
(JNIEnv *, jobject, jobject, jint, jint);
|
||||
|
||||
/*
|
||||
* Class: com_sleepycat_db_xa_DbXAResource
|
||||
* Method: xa_attach
|
||||
* Signature: (Ljavax/transaction/xa/Xid;Ljava/lang/Integer;)Lcom/sleepycat/db/xa/DbXAResource$DbAttach;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_xa_DbXAResource_xa_1attach
|
||||
(JNIEnv *, jclass, jobject, jobject);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,55 +1,30 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_DbLock.c,v 11.4 2000/11/30 00:58:39 ubell Exp $";
|
||||
static const char revid[] = "$Id: java_DbLock.c,v 11.12 2002/02/28 21:27:38 ubell Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "com_sleepycat_db_DbLock.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_put
|
||||
(JNIEnv *jnienv, jobject jthis, /*DbEnv*/ jobject env)
|
||||
{
|
||||
int err;
|
||||
DB_LOCK *dblock = get_DB_LOCK(jnienv, jthis);
|
||||
DB_ENV *dbenv = get_DB_ENV(jnienv, env);
|
||||
|
||||
if (!verify_non_null(jnienv, dbenv))
|
||||
return;
|
||||
|
||||
if (!verify_non_null(jnienv, dblock))
|
||||
return;
|
||||
|
||||
err = lock_put(dbenv, dblock);
|
||||
if (verify_return(jnienv, err, 0)) {
|
||||
/* After a successful put, the DbLock can no longer
|
||||
* be used, so we release the storage related to it
|
||||
* (allocated in DbEnv.lock_get() or lock_tget()).
|
||||
*/
|
||||
free(dblock);
|
||||
|
||||
set_private_dbobj(jnienv, name_DB_LOCK, jthis, 0);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLock_finalize
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
DB_LOCK *dblock = get_DB_LOCK(jnienv, jthis);
|
||||
if (dblock) {
|
||||
/* Free any data related to DB_LOCK here */
|
||||
free(dblock);
|
||||
__os_free(NULL, dblock);
|
||||
}
|
||||
set_private_dbobj(jnienv, name_DB_LOCK, jthis, 0); /* paranoia */
|
||||
}
|
||||
|
110
bdb/libdb_java/java_DbLogc.c
Normal file
110
bdb/libdb_java/java_DbLogc.c
Normal file
@ -0,0 +1,110 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_DbLogc.c,v 11.6 2002/07/02 12:03:03 mjc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef DIAGNOSTIC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "com_sleepycat_db_DbLogc.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogc_close
|
||||
(JNIEnv *jnienv, jobject jthis, jint flags)
|
||||
{
|
||||
int err;
|
||||
DB_LOGC *dblogc = get_DB_LOGC(jnienv, jthis);
|
||||
|
||||
if (!verify_non_null(jnienv, dblogc))
|
||||
return;
|
||||
err = dblogc->close(dblogc, flags);
|
||||
if (verify_return(jnienv, err, 0)) {
|
||||
set_private_dbobj(jnienv, name_DB_LOGC, jthis, 0);
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbLogc_get
|
||||
(JNIEnv *jnienv, jobject jthis,
|
||||
/*DbLsn*/ jobject lsn, /*Dbt*/ jobject data, jint flags)
|
||||
{
|
||||
int err, retry;
|
||||
DB_LOGC *dblogc;
|
||||
DB_LSN *dblsn;
|
||||
LOCKED_DBT ldata;
|
||||
OpKind dataop;
|
||||
|
||||
/*
|
||||
* Depending on flags, the user may be supplying the key,
|
||||
* or else we may have to retrieve it.
|
||||
*/
|
||||
err = 0;
|
||||
dataop = outOp;
|
||||
|
||||
dblogc = get_DB_LOGC(jnienv, jthis);
|
||||
dblsn = get_DB_LSN(jnienv, lsn);
|
||||
if (locked_dbt_get(&ldata, jnienv, dblogc->dbenv, data, dataop) != 0)
|
||||
goto out1;
|
||||
|
||||
if (!verify_non_null(jnienv, dblogc))
|
||||
goto out1;
|
||||
|
||||
for (retry = 0; retry < 3; retry++) {
|
||||
err = dblogc->get(dblogc, dblsn, &ldata.javainfo->dbt, flags);
|
||||
|
||||
/*
|
||||
* If we failed due to lack of memory in our DBT arrays,
|
||||
* retry.
|
||||
*/
|
||||
if (err != ENOMEM)
|
||||
break;
|
||||
if (!locked_dbt_realloc(&ldata, jnienv, dblogc->dbenv))
|
||||
break;
|
||||
}
|
||||
out1:
|
||||
locked_dbt_put(&ldata, jnienv, dblogc->dbenv);
|
||||
if (!DB_RETOK_LGGET(err)) {
|
||||
if (verify_dbt(jnienv, err, &ldata))
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLogc_finalize
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
/*
|
||||
* Free any data related to DB_LOGC here.
|
||||
* If we ever have java-only data embedded in the DB_LOGC
|
||||
* and need to do this, we'll have to track DbLogc's
|
||||
* according to which DbEnv owns them, just as
|
||||
* we track Db's according to which DbEnv owns them.
|
||||
* That's necessary to avoid double freeing that
|
||||
* comes about when closes interact with GC.
|
||||
*/
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
DB_LOGC *dblogc;
|
||||
|
||||
dblogc = get_DB_LOGC(jnienv, jthis);
|
||||
if (dblogc != NULL)
|
||||
fprintf(stderr, "Java API: DbLogc has not been closed\n");
|
||||
#else
|
||||
|
||||
COMPQUIET(jnienv, NULL);
|
||||
COMPQUIET(jthis, NULL);
|
||||
|
||||
#endif
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_DbLsn.c,v 11.5 2000/11/30 00:58:39 ubell Exp $";
|
||||
static const char revid[] = "$Id: java_DbLsn.c,v 11.12 2002/05/07 16:12:41 dda Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
@ -15,7 +15,6 @@ static const char revid[] = "$Id: java_DbLsn.c,v 11.5 2000/11/30 00:58:39 ubell
|
||||
#include <string.h>
|
||||
#include <stdio.h> /* needed for FILENAME_MAX */
|
||||
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "com_sleepycat_db_DbLsn.h"
|
||||
@ -23,8 +22,9 @@ static const char revid[] = "$Id: java_DbLsn.c,v 11.5 2000/11/30 00:58:39 ubell
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLsn_init_1lsn
|
||||
(JNIEnv *jnienv, /*DbLsn*/ jobject jthis)
|
||||
{
|
||||
/* Note: the DB_LSN object stored in the private_dbobj_
|
||||
* is allocated in get_DbLsn().
|
||||
/*
|
||||
* Note: the DB_LSN object stored in the private_dbobj_
|
||||
* is allocated in get_DbLsn() or get_DB_LSN().
|
||||
*/
|
||||
|
||||
COMPQUIET(jnienv, NULL);
|
||||
@ -38,6 +38,6 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_DbLsn_finalize
|
||||
|
||||
dblsn = get_DB_LSN(jnienv, jthis);
|
||||
if (dblsn) {
|
||||
free(dblsn);
|
||||
(void)__os_free(NULL, dblsn);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_DbTxn.c,v 11.3 2000/09/18 18:32:25 dda Exp $";
|
||||
static const char revid[] = "$Id: java_DbTxn.c,v 11.16 2002/08/06 05:19:05 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
@ -15,33 +15,16 @@ static const char revid[] = "$Id: java_DbTxn.c,v 11.3 2000/09/18 18:32:25 dda Ex
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "com_sleepycat_db_DbTxn.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_abort
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
int err;
|
||||
DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis);
|
||||
if (!verify_non_null(jnienv, dbtxn))
|
||||
return;
|
||||
|
||||
err = txn_abort(dbtxn);
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_commit
|
||||
(JNIEnv *jnienv, jobject jthis, jint flags)
|
||||
{
|
||||
int err;
|
||||
DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis);
|
||||
if (!verify_non_null(jnienv, dbtxn))
|
||||
return;
|
||||
|
||||
err = txn_commit(dbtxn, flags);
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
JAVADB_METHOD(DbTxn_abort, (JAVADB_ARGS), DB_TXN,
|
||||
abort, (c_this))
|
||||
JAVADB_METHOD(DbTxn_commit, (JAVADB_ARGS, jint flags), DB_TXN,
|
||||
commit, (c_this, flags))
|
||||
JAVADB_METHOD(DbTxn_discard, (JAVADB_ARGS, jint flags), DB_TXN,
|
||||
discard, (c_this, flags))
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxn_id
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
@ -51,32 +34,34 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_DbTxn_id
|
||||
if (!verify_non_null(jnienv, dbtxn))
|
||||
return (-1);
|
||||
|
||||
/* No error to check for from txn_id */
|
||||
retval = txn_id(dbtxn);
|
||||
/* No error to check for from DB_TXN->id */
|
||||
retval = dbtxn->id(dbtxn);
|
||||
return (retval);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_prepare
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
(JNIEnv *jnienv, jobject jthis, jbyteArray gid)
|
||||
{
|
||||
int err;
|
||||
DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis);
|
||||
DB_TXN *dbtxn;
|
||||
jbyte *c_array;
|
||||
|
||||
dbtxn = get_DB_TXN(jnienv, jthis);
|
||||
if (!verify_non_null(jnienv, dbtxn))
|
||||
return;
|
||||
|
||||
err = txn_prepare(dbtxn);
|
||||
if (gid == NULL ||
|
||||
(*jnienv)->GetArrayLength(jnienv, gid) < DB_XIDDATASIZE) {
|
||||
report_exception(jnienv, "DbTxn.prepare gid array "
|
||||
"must be >= 128 bytes", EINVAL, 0);
|
||||
return;
|
||||
}
|
||||
c_array = (*jnienv)->GetByteArrayElements(jnienv, gid, NULL);
|
||||
err = dbtxn->prepare(dbtxn, (u_int8_t *)c_array);
|
||||
(*jnienv)->ReleaseByteArrayElements(jnienv, gid, c_array, 0);
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_DbTxn_finalize
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
DB_TXN *dbtxn = get_DB_TXN(jnienv, jthis);
|
||||
if (dbtxn) {
|
||||
/* Free any data related to DB_TXN here
|
||||
* Note: we don't make a policy of doing
|
||||
* a commit or abort here. The txnmgr
|
||||
* should be closed, and DB will clean up.
|
||||
*/
|
||||
}
|
||||
}
|
||||
JAVADB_METHOD(DbTxn_set_1timeout,
|
||||
(JAVADB_ARGS, jlong timeout, jint flags), DB_TXN,
|
||||
set_timeout, (c_this, (u_int32_t)timeout, flags))
|
||||
|
27
bdb/libdb_java/java_DbUtil.c
Normal file
27
bdb/libdb_java/java_DbUtil.c
Normal file
@ -0,0 +1,27 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 2001-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_DbUtil.c,v 1.5 2002/01/11 15:52:44 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "com_sleepycat_db_DbUtil.h"
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_sleepycat_db_DbUtil_is_1big_1endian (JNIEnv *jnienv,
|
||||
jclass jthis_class)
|
||||
{
|
||||
COMPQUIET(jnienv, NULL);
|
||||
COMPQUIET(jthis_class, NULL);
|
||||
|
||||
return (__db_isbigendian() ? JNI_TRUE : JNI_FALSE);
|
||||
}
|
288
bdb/libdb_java/java_DbXAResource.c
Normal file
288
bdb/libdb_java/java_DbXAResource.c
Normal file
@ -0,0 +1,288 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997-2001
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_DbXAResource.c,v 11.6 2002/08/06 05:19:06 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef DIAGNOSTIC
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "dbinc/xa.h"
|
||||
#include "dbinc_auto/xa_ext.h"
|
||||
#include "com_sleepycat_db_xa_DbXAResource.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1init
|
||||
(JNIEnv *jnienv, jobject jthis, jstring home, jint rmid, jint flags)
|
||||
{
|
||||
int err;
|
||||
LOCKED_STRING ls_home;
|
||||
jclass cl;
|
||||
jmethodID mid;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (locked_string_get(&ls_home, jnienv, home) != 0)
|
||||
goto out;
|
||||
if ((err = __db_xa_open((char *)ls_home.string,
|
||||
rmid, flags)) != XA_OK) {
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now create the DbEnv object, it will get attached
|
||||
* to the DB_ENV just made in __db_xa_open.
|
||||
*/
|
||||
if ((cl = get_class(jnienv, name_DB_ENV)) == NULL)
|
||||
goto out;
|
||||
|
||||
mid = (*jnienv)->GetStaticMethodID(jnienv, cl,
|
||||
"_create_DbEnv_for_XA", "(II)V");
|
||||
(*jnienv)->CallStaticVoidMethod(jnienv, cl, mid, 0, rmid);
|
||||
|
||||
out:
|
||||
locked_string_put(&ls_home, jnienv);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1close
|
||||
(JNIEnv *jnienv, jobject jthis, jstring home, jint rmid, jint flags)
|
||||
{
|
||||
int err;
|
||||
LOCKED_STRING ls_home;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (locked_string_get(&ls_home, jnienv, home) != 0)
|
||||
goto out;
|
||||
if ((err = __db_xa_close((char *)ls_home.string,
|
||||
rmid, flags)) != XA_OK)
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
out:
|
||||
locked_string_put(&ls_home, jnienv);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1commit
|
||||
(JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid,
|
||||
jboolean onePhase)
|
||||
{
|
||||
XID xid;
|
||||
long flags;
|
||||
int err;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (!get_XID(jnienv, jxid, &xid))
|
||||
return;
|
||||
flags = 0;
|
||||
if (onePhase == JNI_TRUE)
|
||||
flags |= TMONEPHASE;
|
||||
if ((err = __db_xa_commit(&xid, rmid, flags)) != XA_OK)
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1end
|
||||
(JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid, jint flags)
|
||||
{
|
||||
XID xid;
|
||||
int err;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (!get_XID(jnienv, jxid, &xid))
|
||||
return;
|
||||
if ((err = __db_xa_end(&xid, rmid, flags)) != XA_OK)
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1forget
|
||||
(JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid)
|
||||
{
|
||||
XID xid;
|
||||
int err;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (!get_XID(jnienv, jxid, &xid))
|
||||
return;
|
||||
if ((err = __db_xa_forget(&xid, rmid, 0)) != XA_OK)
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_xa_DbXAResource__1prepare
|
||||
(JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid)
|
||||
{
|
||||
XID xid;
|
||||
int err;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (!get_XID(jnienv, jxid, &xid))
|
||||
return (0);
|
||||
err = __db_xa_prepare(&xid, rmid, 0);
|
||||
if (err != XA_OK && err != XA_RDONLY)
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
|
||||
return (err);
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL Java_com_sleepycat_db_xa_DbXAResource__1recover
|
||||
(JNIEnv *jnienv, jobject jthis, jint rmid, jint flags)
|
||||
{
|
||||
XID *xids;
|
||||
int err;
|
||||
int total;
|
||||
int cnt;
|
||||
int i;
|
||||
int curflags;
|
||||
size_t nbytes;
|
||||
jclass xid_class;
|
||||
jmethodID mid;
|
||||
jobject obj;
|
||||
jobjectArray retval;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
total = 0;
|
||||
cnt = 0;
|
||||
xids = NULL;
|
||||
flags &= ~(DB_FIRST | DB_LAST | DB_NEXT);
|
||||
|
||||
/* Repeatedly call __db_xa_recover to fill up an array of XIDs */
|
||||
curflags = flags | DB_FIRST;
|
||||
do {
|
||||
total += cnt;
|
||||
nbytes = sizeof(XID) * (total + 10);
|
||||
if ((err = __os_realloc(NULL, nbytes, &xids)) != 0) {
|
||||
if (xids != NULL)
|
||||
__os_free(NULL, xids);
|
||||
verify_return(jnienv, XAER_NOTA, EXCEPTION_XA);
|
||||
return (NULL);
|
||||
}
|
||||
cnt = __db_xa_recover(&xids[total], 10, rmid, curflags);
|
||||
curflags = flags | DB_NEXT;
|
||||
} while (cnt > 0);
|
||||
|
||||
if (xids != NULL)
|
||||
__os_free(NULL, xids);
|
||||
|
||||
if (cnt < 0) {
|
||||
verify_return(jnienv, cnt, EXCEPTION_XA);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Create the java DbXid array and fill it up */
|
||||
if ((xid_class = get_class(jnienv, name_DB_XID)) == NULL)
|
||||
return (NULL);
|
||||
mid = (*jnienv)->GetMethodID(jnienv, xid_class, "<init>",
|
||||
"(I[B[B)V");
|
||||
if ((retval = (*jnienv)->NewObjectArray(jnienv, total, xid_class, 0))
|
||||
== NULL)
|
||||
goto out;
|
||||
|
||||
for (i = 0; i < total; i++) {
|
||||
jobject gtrid;
|
||||
jobject bqual;
|
||||
jsize gtrid_len;
|
||||
jsize bqual_len;
|
||||
|
||||
gtrid_len = (jsize)xids[i].gtrid_length;
|
||||
bqual_len = (jsize)xids[i].bqual_length;
|
||||
gtrid = (*jnienv)->NewByteArray(jnienv, gtrid_len);
|
||||
bqual = (*jnienv)->NewByteArray(jnienv, bqual_len);
|
||||
if (gtrid == NULL || bqual == NULL)
|
||||
goto out;
|
||||
(*jnienv)->SetByteArrayRegion(jnienv, gtrid, 0, gtrid_len,
|
||||
(jbyte *)&xids[i].data[0]);
|
||||
(*jnienv)->SetByteArrayRegion(jnienv, bqual, 0, bqual_len,
|
||||
(jbyte *)&xids[i].data[gtrid_len]);
|
||||
if ((obj = (*jnienv)->NewObject(jnienv, xid_class, mid,
|
||||
(jint)xids[i].formatID, gtrid, bqual)) == NULL)
|
||||
goto out;
|
||||
(*jnienv)->SetObjectArrayElement(jnienv, retval, i, obj);
|
||||
}
|
||||
out: return (retval);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1rollback
|
||||
(JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid)
|
||||
{
|
||||
XID xid;
|
||||
int err;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (!get_XID(jnienv, jxid, &xid))
|
||||
return;
|
||||
if ((err = __db_xa_rollback(&xid, rmid, 0)) != XA_OK)
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_xa_DbXAResource__1start
|
||||
(JNIEnv *jnienv, jobject jthis, jobject jxid, jint rmid, jint flags)
|
||||
{
|
||||
XID xid;
|
||||
int err;
|
||||
|
||||
COMPQUIET(jthis, NULL);
|
||||
if (!get_XID(jnienv, jxid, &xid))
|
||||
return;
|
||||
|
||||
if ((err = __db_xa_start(&xid, rmid, flags)) != XA_OK)
|
||||
verify_return(jnienv, err, EXCEPTION_XA);
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_xa_DbXAResource_xa_1attach
|
||||
(JNIEnv *jnienv, jclass jthisclass, jobject jxid, jobject jrmid)
|
||||
{
|
||||
XID xid;
|
||||
XID *xidp;
|
||||
int ret;
|
||||
DB_ENV *env;
|
||||
DB_TXN *txn;
|
||||
int rmid;
|
||||
int *rmidp;
|
||||
jobject jtxn;
|
||||
jobject jenv;
|
||||
jclass cl;
|
||||
jmethodID mid;
|
||||
|
||||
COMPQUIET(jthisclass, NULL);
|
||||
if (jxid == NULL) {
|
||||
xidp = NULL;
|
||||
}
|
||||
else {
|
||||
xidp = &xid;
|
||||
if (!get_XID(jnienv, jxid, &xid))
|
||||
return (NULL);
|
||||
}
|
||||
if (jrmid == NULL) {
|
||||
rmidp = NULL;
|
||||
}
|
||||
else {
|
||||
rmidp = &rmid;
|
||||
rmid = (int)(*jnienv)->CallIntMethod(jnienv, jrmid,
|
||||
mid_Integer_intValue);
|
||||
}
|
||||
|
||||
if ((ret = db_env_xa_attach(rmidp, xidp, &env, &txn)) != 0) {
|
||||
/*
|
||||
* DB_NOTFOUND is a normal return, it means we
|
||||
* have no current transaction,
|
||||
*/
|
||||
if (ret != DB_NOTFOUND)
|
||||
verify_return(jnienv, ret, 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
jenv = ((DB_ENV_JAVAINFO *)env->api2_internal)->jenvref;
|
||||
jtxn = get_DbTxn(jnienv, txn);
|
||||
if ((cl = get_class(jnienv, name_DB_XAATTACH)) == NULL)
|
||||
return (NULL);
|
||||
mid = (*jnienv)->GetMethodID(jnienv, cl, "<init>",
|
||||
"(Lcom/sleepycat/db/DbEnv;Lcom/sleepycat/db/DbTxn;)V");
|
||||
return (*jnienv)->NewObject(jnienv, cl, mid, jenv, jtxn);
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_Dbc.c,v 11.10 2000/10/25 19:54:55 dda Exp $";
|
||||
static const char revid[] = "$Id: java_Dbc.c,v 11.23 2002/08/06 05:19:06 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
@ -18,7 +18,6 @@ static const char revid[] = "$Id: java_Dbc.c,v 11.10 2000/10/25 19:54:55 dda Exp
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "com_sleepycat_db_Dbc.h"
|
||||
@ -51,20 +50,8 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_count
|
||||
return (count);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_del
|
||||
(JNIEnv *jnienv, jobject jthis, jint flags)
|
||||
{
|
||||
int err;
|
||||
DBC *dbc = get_DBC(jnienv, jthis);
|
||||
|
||||
if (!verify_non_null(jnienv, dbc))
|
||||
return (0);
|
||||
err = dbc->c_del(dbc, flags);
|
||||
if (err != DB_KEYEMPTY) {
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
JAVADB_METHOD_INT(Dbc_del, (JAVADB_ARGS, jint flags), DBC,
|
||||
c_del, (c_this, flags), DB_RETOK_DBCDEL)
|
||||
|
||||
JNIEXPORT jobject JNICALL Java_com_sleepycat_db_Dbc_dup
|
||||
(JNIEnv *jnienv, jobject jthis, jint flags)
|
||||
@ -88,10 +75,12 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_get
|
||||
{
|
||||
int err, retry, op_flags;
|
||||
DBC *dbc;
|
||||
JDBT dbkey, dbdata;
|
||||
DB_ENV *dbenv;
|
||||
LOCKED_DBT lkey, ldata;
|
||||
OpKind keyop, dataop;
|
||||
|
||||
/* Depending on flags, the user may be supplying the key,
|
||||
/*
|
||||
* Depending on flags, the user may be supplying the key,
|
||||
* or else we may have to retrieve it.
|
||||
*/
|
||||
err = 0;
|
||||
@ -106,38 +95,124 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_get
|
||||
op_flags == DB_SET_RECNO) {
|
||||
keyop = inOutOp;
|
||||
}
|
||||
else if (op_flags == DB_GET_BOTH) {
|
||||
else if (op_flags == DB_GET_BOTH || op_flags == DB_GET_BOTH_RANGE) {
|
||||
keyop = inOutOp;
|
||||
dataop = inOutOp;
|
||||
}
|
||||
|
||||
dbc = get_DBC(jnienv, jthis);
|
||||
if (jdbt_lock(&dbkey, jnienv, key, keyop) != 0)
|
||||
if (!verify_non_null(jnienv, dbc))
|
||||
return (0);
|
||||
dbenv = dbc->dbp->dbenv;
|
||||
|
||||
if (locked_dbt_get(&lkey, jnienv, dbenv, key, keyop) != 0)
|
||||
goto out2;
|
||||
if (jdbt_lock(&dbdata, jnienv, data, dataop) != 0)
|
||||
if (locked_dbt_get(&ldata, jnienv, dbenv, data, dataop) != 0)
|
||||
goto out1;
|
||||
|
||||
if (!verify_non_null(jnienv, dbc))
|
||||
goto out1;
|
||||
|
||||
for (retry = 0; retry < 3; retry++) {
|
||||
err = dbc->c_get(dbc, &dbkey.dbt->dbt, &dbdata.dbt->dbt, flags);
|
||||
err = dbc->c_get(dbc,
|
||||
&lkey.javainfo->dbt, &ldata.javainfo->dbt, flags);
|
||||
|
||||
/* If we failed due to lack of memory in our DBT arrays,
|
||||
/*
|
||||
* If we failed due to lack of memory in our DBT arrays,
|
||||
* retry.
|
||||
*/
|
||||
if (err != ENOMEM)
|
||||
break;
|
||||
if (!jdbt_realloc(&dbkey, jnienv) && !jdbt_realloc(&dbdata, jnienv))
|
||||
if (!locked_dbt_realloc(&lkey, jnienv,
|
||||
dbenv) && !locked_dbt_realloc(&ldata, jnienv, dbenv))
|
||||
break;
|
||||
}
|
||||
if (err != DB_NOTFOUND) {
|
||||
verify_return(jnienv, err, 0);
|
||||
out1:
|
||||
locked_dbt_put(&ldata, jnienv, dbenv);
|
||||
out2:
|
||||
locked_dbt_put(&lkey, jnienv, dbenv);
|
||||
if (!DB_RETOK_DBCGET(err)) {
|
||||
if (verify_dbt(jnienv, err, &lkey) &&
|
||||
verify_dbt(jnienv, err, &ldata))
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_pget
|
||||
(JNIEnv *jnienv, jobject jthis,
|
||||
/*Dbt*/ jobject key, /*Dbt*/ jobject pkey, /*Dbt*/ jobject data, jint flags)
|
||||
{
|
||||
int err, retry, op_flags;
|
||||
DBC *dbc;
|
||||
DB_ENV *dbenv;
|
||||
LOCKED_DBT lkey, lpkey, ldata;
|
||||
OpKind keyop, pkeyop, dataop;
|
||||
|
||||
/*
|
||||
* Depending on flags, the user may be supplying the key,
|
||||
* or else we may have to retrieve it.
|
||||
*/
|
||||
err = 0;
|
||||
keyop = outOp;
|
||||
pkeyop = outOp;
|
||||
dataop = outOp;
|
||||
|
||||
op_flags = flags & DB_OPFLAGS_MASK;
|
||||
if (op_flags == DB_SET) {
|
||||
keyop = inOp;
|
||||
}
|
||||
else if (op_flags == DB_SET_RANGE ||
|
||||
op_flags == DB_SET_RECNO) {
|
||||
keyop = inOutOp;
|
||||
}
|
||||
else if (op_flags == DB_GET_BOTH || op_flags == DB_GET_BOTH_RANGE) {
|
||||
pkeyop = inOutOp;
|
||||
keyop = inOutOp;
|
||||
dataop = inOutOp;
|
||||
}
|
||||
|
||||
dbc = get_DBC(jnienv, jthis);
|
||||
if (!verify_non_null(jnienv, dbc))
|
||||
return (0);
|
||||
dbenv = dbc->dbp->dbenv;
|
||||
if (locked_dbt_get(&lkey, jnienv, dbenv, key, keyop) != 0)
|
||||
goto out3;
|
||||
if (locked_dbt_get(&lpkey, jnienv, dbenv, pkey, pkeyop) != 0)
|
||||
goto out2;
|
||||
if (locked_dbt_get(&ldata, jnienv, dbenv, data, dataop) != 0)
|
||||
goto out1;
|
||||
|
||||
if (!verify_non_null(jnienv, dbc))
|
||||
goto out1;
|
||||
|
||||
for (retry = 0; retry < 3; retry++) {
|
||||
err = dbc->c_pget(dbc, &lkey.javainfo->dbt,
|
||||
&lpkey.javainfo->dbt, &ldata.javainfo->dbt, flags);
|
||||
|
||||
/*
|
||||
* If we failed due to lack of memory in our DBT arrays,
|
||||
* retry.
|
||||
*/
|
||||
if (err != ENOMEM)
|
||||
break;
|
||||
if (!locked_dbt_realloc(&lkey, jnienv, dbenv) &&
|
||||
!locked_dbt_realloc(&lpkey, jnienv, dbenv) &&
|
||||
!locked_dbt_realloc(&ldata, jnienv, dbenv))
|
||||
break;
|
||||
}
|
||||
out1:
|
||||
jdbt_unlock(&dbdata, jnienv);
|
||||
locked_dbt_put(&ldata, jnienv, dbenv);
|
||||
out2:
|
||||
jdbt_unlock(&dbkey, jnienv);
|
||||
locked_dbt_put(&lpkey, jnienv, dbenv);
|
||||
out3:
|
||||
locked_dbt_put(&lkey, jnienv, dbenv);
|
||||
if (!DB_RETOK_DBCGET(err)) {
|
||||
if (verify_dbt(jnienv, err, &lkey) &&
|
||||
verify_dbt(jnienv, err, &lpkey) &&
|
||||
verify_dbt(jnienv, err, &ldata))
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
return (err);
|
||||
}
|
||||
|
||||
@ -147,32 +222,39 @@ JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbc_put
|
||||
{
|
||||
int err;
|
||||
DBC *dbc;
|
||||
JDBT dbkey, dbdata;
|
||||
DB_ENV *dbenv;
|
||||
LOCKED_DBT lkey, ldata;
|
||||
OpKind keyop;
|
||||
|
||||
err = 0;
|
||||
dbc = get_DBC(jnienv, jthis);
|
||||
if (jdbt_lock(&dbkey, jnienv, key, inOp) != 0)
|
||||
if (!verify_non_null(jnienv, dbc))
|
||||
return (0);
|
||||
dbenv = dbc->dbp->dbenv;
|
||||
keyop = (dbc->dbp->type == DB_RECNO &&
|
||||
(flags == DB_BEFORE || flags == DB_AFTER)) ? outOp : inOp;
|
||||
if (locked_dbt_get(&lkey, jnienv, dbenv, key, keyop) != 0)
|
||||
goto out2;
|
||||
if (jdbt_lock(&dbdata, jnienv, data, inOp) != 0)
|
||||
if (locked_dbt_get(&ldata, jnienv, dbenv, data, inOp) != 0)
|
||||
goto out1;
|
||||
|
||||
if (!verify_non_null(jnienv, dbc))
|
||||
goto out1;
|
||||
err = dbc->c_put(dbc, &dbkey.dbt->dbt, &dbdata.dbt->dbt, flags);
|
||||
if (err != DB_KEYEXIST) {
|
||||
err = dbc->c_put(dbc, &lkey.javainfo->dbt, &ldata.javainfo->dbt, flags);
|
||||
if (!DB_RETOK_DBCPUT(err))
|
||||
verify_return(jnienv, err, 0);
|
||||
}
|
||||
out1:
|
||||
jdbt_unlock(&dbdata, jnienv);
|
||||
locked_dbt_put(&ldata, jnienv, dbenv);
|
||||
out2:
|
||||
jdbt_unlock(&dbkey, jnienv);
|
||||
locked_dbt_put(&lkey, jnienv, dbenv);
|
||||
return (err);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbc_finalize
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
/* Free any data related to DBC here.
|
||||
/*
|
||||
* Free any data related to DBC here.
|
||||
* If we ever have java-only data embedded in the DBC
|
||||
* and need to do this, we'll have to track Dbc's
|
||||
* according to which Db owns them, just as
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_Dbt.c,v 11.10 2000/10/25 19:54:55 dda Exp $";
|
||||
static const char revid[] = "$Id: java_Dbt.c,v 11.18 2002/06/20 11:11:55 mjc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
@ -15,16 +15,10 @@ static const char revid[] = "$Id: java_Dbt.c,v 11.10 2000/10/25 19:54:55 dda Exp
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
#include "com_sleepycat_db_Dbt.h"
|
||||
|
||||
JAVADB_RW_ACCESS(Dbt, jint, size, DBT, size)
|
||||
JAVADB_RW_ACCESS(Dbt, jint, ulen, DBT, ulen)
|
||||
JAVADB_RW_ACCESS(Dbt, jint, dlen, DBT, dlen)
|
||||
JAVADB_RW_ACCESS(Dbt, jint, doff, DBT, doff)
|
||||
JAVADB_RW_ACCESS(Dbt, jint, flags, DBT, flags)
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_init
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
@ -34,129 +28,22 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_init
|
||||
set_private_dbobj(jnienv, name_DBT, jthis, dbtji);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_internal_1set_1data
|
||||
(JNIEnv *jnienv, jobject jthis, jbyteArray array)
|
||||
{
|
||||
DBT_JAVAINFO *db_this;
|
||||
|
||||
db_this = get_DBT_JAVAINFO(jnienv, jthis);
|
||||
if (verify_non_null(jnienv, db_this)) {
|
||||
|
||||
/* If we previously allocated an array for java,
|
||||
* must release reference.
|
||||
*/
|
||||
dbjit_release(db_this, jnienv);
|
||||
|
||||
/* Make the array a global ref,
|
||||
* it won't be GC'd till we release it.
|
||||
*/
|
||||
if (array)
|
||||
array = (jbyteArray)NEW_GLOBAL_REF(jnienv, array);
|
||||
db_this->array_ = array;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_sleepycat_db_Dbt_get_1data
|
||||
JNIEXPORT jbyteArray JNICALL Java_com_sleepycat_db_Dbt_create_1data
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
DBT_JAVAINFO *db_this;
|
||||
jbyteArray arr;
|
||||
jbyteArray arr = NULL;
|
||||
int len;
|
||||
|
||||
db_this = get_DBT_JAVAINFO(jnienv, jthis);
|
||||
if (verify_non_null(jnienv, db_this)) {
|
||||
/* XXX this will copy the data on each call to get_data,
|
||||
* even if it is unchanged.
|
||||
*/
|
||||
if (db_this->create_array_ != 0) {
|
||||
/* XXX we should reuse the existing array if we can */
|
||||
len = db_this->dbt.size;
|
||||
if (db_this->array_ != NULL)
|
||||
DELETE_GLOBAL_REF(jnienv, db_this->array_);
|
||||
arr = (*jnienv)->NewByteArray(jnienv, len);
|
||||
db_this->array_ =
|
||||
(jbyteArray)NEW_GLOBAL_REF(jnienv, arr);
|
||||
(*jnienv)->SetByteArrayRegion(jnienv, arr, 0, len,
|
||||
db_this->dbt.data);
|
||||
}
|
||||
return (db_this->array_);
|
||||
len = db_this->dbt.size;
|
||||
if ((arr = (*jnienv)->NewByteArray(jnienv, len)) == NULL)
|
||||
goto out;
|
||||
(*jnienv)->SetByteArrayRegion(jnienv, arr, 0, len,
|
||||
db_this->dbt.data);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1offset
|
||||
(JNIEnv *jnienv, jobject jthis, jint offset)
|
||||
{
|
||||
DBT_JAVAINFO *db_this;
|
||||
|
||||
db_this = get_DBT_JAVAINFO(jnienv, jthis);
|
||||
if (verify_non_null(jnienv, db_this)) {
|
||||
db_this->offset_ = offset;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1offset
|
||||
(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
DBT_JAVAINFO *db_this;
|
||||
|
||||
db_this = get_DBT_JAVAINFO(jnienv, jthis);
|
||||
if (verify_non_null(jnienv, db_this)) {
|
||||
return db_this->offset_;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_set_1recno_1key_1data(JNIEnv *jnienv, jobject jthis, jint value)
|
||||
{
|
||||
JDBT jdbt;
|
||||
|
||||
if (jdbt_lock(&jdbt, jnienv, jthis, inOp) != 0)
|
||||
goto out;
|
||||
|
||||
if (!jdbt.dbt->dbt.data ||
|
||||
jdbt.java_array_len_ < sizeof(db_recno_t)) {
|
||||
char buf[200];
|
||||
sprintf(buf, "set_recno_key_data error: %p %p %d %d",
|
||||
&jdbt.dbt->dbt, jdbt.dbt->dbt.data,
|
||||
jdbt.dbt->dbt.ulen, sizeof(db_recno_t));
|
||||
report_exception(jnienv, buf, 0, 0);
|
||||
}
|
||||
else {
|
||||
*(db_recno_t*)(jdbt.dbt->dbt.data) = value;
|
||||
}
|
||||
out:
|
||||
jdbt_unlock(&jdbt, jnienv);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_Dbt_get_1recno_1key_1data(JNIEnv *jnienv, jobject jthis)
|
||||
{
|
||||
jint ret;
|
||||
JDBT jdbt;
|
||||
|
||||
ret = 0;
|
||||
|
||||
/* Although this is kind of like "retrieve", we don't support
|
||||
* DB_DBT_MALLOC for this operation, so we tell jdbt_lock
|
||||
* that is not a retrieve.
|
||||
*/
|
||||
if (jdbt_lock(&jdbt, jnienv, jthis, inOp) != 0)
|
||||
goto out;
|
||||
|
||||
if (!jdbt.dbt->dbt.data ||
|
||||
jdbt.java_array_len_ < sizeof(db_recno_t)) {
|
||||
char buf[200];
|
||||
sprintf(buf, "get_recno_key_data error: %p %p %d %d",
|
||||
&jdbt.dbt->dbt, jdbt.dbt->dbt.data,
|
||||
jdbt.dbt->dbt.ulen, sizeof(db_recno_t));
|
||||
report_exception(jnienv, buf, 0, 0);
|
||||
}
|
||||
else {
|
||||
ret = *(db_recno_t*)(jdbt.dbt->dbt.data);
|
||||
}
|
||||
out:
|
||||
jdbt_unlock(&jdbt, jnienv);
|
||||
return (ret);
|
||||
out: return (arr);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_finalize
|
||||
@ -167,10 +54,6 @@ JNIEXPORT void JNICALL Java_com_sleepycat_db_Dbt_finalize
|
||||
dbtji = get_DBT_JAVAINFO(jnienv, jthis);
|
||||
if (dbtji) {
|
||||
/* Free any data related to DBT here */
|
||||
dbjit_release(dbtji, jnienv);
|
||||
|
||||
/* Extra paranoia */
|
||||
memset(dbtji, 0, sizeof(DBT_JAVAINFO));
|
||||
free(dbtji);
|
||||
dbjit_destroy(dbtji);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,10 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*
|
||||
* $Id: java_info.h,v 11.17 2000/07/31 20:28:30 dda Exp $
|
||||
* $Id: java_info.h,v 11.35 2002/08/29 14:22:23 margo Exp $
|
||||
*/
|
||||
|
||||
#ifndef _JAVA_INFO_H_
|
||||
@ -36,16 +36,22 @@
|
||||
typedef struct _dbt_javainfo
|
||||
{
|
||||
DBT dbt;
|
||||
DB *db_; /* associated DB */
|
||||
jobject dbtref_; /* the java Dbt object */
|
||||
jbyteArray array_;
|
||||
int offset_;
|
||||
int create_array_; /* flag to create the array as needed */
|
||||
}
|
||||
DBT_JAVAINFO; /* used with all 'dbtji' functions */
|
||||
DB *db; /* associated DB */
|
||||
jobject dbtref; /* the java Dbt object */
|
||||
jbyteArray array; /* the java array object -
|
||||
this is only valid during the API call */
|
||||
int offset; /* offset into the Java array */
|
||||
|
||||
#define DBT_JAVAINFO_LOCKED 0x01 /* a LOCKED_DBT has been created */
|
||||
u_int32_t flags;
|
||||
}
|
||||
DBT_JAVAINFO; /* used with all 'dbtji' functions */
|
||||
|
||||
/* create/initialize a DBT_JAVAINFO object */
|
||||
extern DBT_JAVAINFO *dbjit_construct();
|
||||
extern void dbjit_release(DBT_JAVAINFO *dbjit, JNIEnv *jnienv);
|
||||
|
||||
/* free this DBT_JAVAINFO, releasing anything allocated on its behalf */
|
||||
extern void dbjit_destroy(DBT_JAVAINFO *dbjit);
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
@ -82,22 +88,25 @@ extern void dbjit_release(DBT_JAVAINFO *dbjit, JNIEnv *jnienv);
|
||||
*/
|
||||
typedef struct _db_env_javainfo
|
||||
{
|
||||
JavaVM *javavm_;
|
||||
int is_dbopen_;
|
||||
char *errpfx_;
|
||||
jobject jdbref_; /* temporary reference */
|
||||
jobject jenvref_; /* temporary reference */
|
||||
jobject default_errcall_; /* global reference */
|
||||
jobject errcall_; /* global reference */
|
||||
jobject feedback_; /* global reference */
|
||||
jobject tx_recover_; /* global reference */
|
||||
jobject recovery_init_; /* global reference */
|
||||
unsigned char *conflict_;
|
||||
JavaVM *javavm;
|
||||
int is_dbopen;
|
||||
char *errpfx;
|
||||
jobject jenvref; /* global reference */
|
||||
jobject default_errcall; /* global reference */
|
||||
jobject errcall; /* global reference */
|
||||
jobject feedback; /* global reference */
|
||||
jobject rep_transport; /* global reference */
|
||||
jobject app_dispatch; /* global reference */
|
||||
jobject recovery_init; /* global reference */
|
||||
u_char *conflict;
|
||||
size_t conflict_size;
|
||||
jint construct_flags;
|
||||
}
|
||||
DB_ENV_JAVAINFO; /* used with all 'dbjie' functions */
|
||||
DB_ENV_JAVAINFO; /* used with all 'dbjie' functions */
|
||||
|
||||
/* create/initialize an object */
|
||||
extern DB_ENV_JAVAINFO *dbjie_construct(JNIEnv *jnienv,
|
||||
jobject jenv,
|
||||
jobject default_errcall,
|
||||
int is_dbopen);
|
||||
|
||||
@ -115,7 +124,7 @@ extern void dbjie_set_errpfx(DB_ENV_JAVAINFO *, JNIEnv *jnienv,
|
||||
extern jstring dbjie_get_errpfx(DB_ENV_JAVAINFO *, JNIEnv *jnienv);
|
||||
extern void dbjie_set_errcall(DB_ENV_JAVAINFO *, JNIEnv *jnienv,
|
||||
jobject new_errcall);
|
||||
extern void dbjie_set_conflict(DB_ENV_JAVAINFO *, unsigned char *v);
|
||||
extern void dbjie_set_conflict(DB_ENV_JAVAINFO *, u_char *v, size_t sz);
|
||||
extern void dbjie_set_feedback_object(DB_ENV_JAVAINFO *, JNIEnv *jnienv,
|
||||
DB_ENV *dbenv, jobject value);
|
||||
extern void dbjie_call_feedback(DB_ENV_JAVAINFO *, DB_ENV *dbenv, jobject jenv,
|
||||
@ -124,13 +133,18 @@ extern void dbjie_set_recovery_init_object(DB_ENV_JAVAINFO *, JNIEnv *jnienv,
|
||||
DB_ENV *dbenv, jobject value);
|
||||
extern int dbjie_call_recovery_init(DB_ENV_JAVAINFO *, DB_ENV *dbenv,
|
||||
jobject jenv);
|
||||
extern void dbjie_set_tx_recover_object(DB_ENV_JAVAINFO *, JNIEnv *jnienv,
|
||||
extern void dbjie_set_rep_transport_object(DB_ENV_JAVAINFO *, JNIEnv *jnienv,
|
||||
DB_ENV *dbenv, int id, jobject obj);
|
||||
extern int dbjie_call_rep_transport(DB_ENV_JAVAINFO *, DB_ENV *dbenv,
|
||||
jobject jenv, const DBT *control,
|
||||
const DBT *rec, int envid, int flags);
|
||||
extern void dbjie_set_app_dispatch_object(DB_ENV_JAVAINFO *, JNIEnv *jnienv,
|
||||
DB_ENV *dbenv, jobject value);
|
||||
extern int dbjie_call_tx_recover(DB_ENV_JAVAINFO *,
|
||||
extern int dbjie_call_app_dispatch(DB_ENV_JAVAINFO *,
|
||||
DB_ENV *dbenv, jobject jenv,
|
||||
DBT *dbt, DB_LSN *lsn, int recops);
|
||||
extern jobject dbjie_get_errcall(DB_ENV_JAVAINFO *) ;
|
||||
extern int dbjie_is_dbopen(DB_ENV_JAVAINFO *);
|
||||
extern jint dbjie_is_dbopen(DB_ENV_JAVAINFO *);
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
@ -147,25 +161,27 @@ extern int dbjie_is_dbopen(DB_ENV_JAVAINFO *);
|
||||
*/
|
||||
typedef struct _db_javainfo
|
||||
{
|
||||
JavaVM *javavm_;
|
||||
jobject jdbref_; /* temporary reference during callback */
|
||||
jobject feedback_; /* global reference */
|
||||
jobject append_recno_; /* global reference */
|
||||
jobject bt_compare_; /* global reference */
|
||||
jobject bt_prefix_; /* global reference */
|
||||
jobject dup_compare_; /* global reference */
|
||||
jobject h_hash_; /* global reference */
|
||||
jmethodID feedback_method_id_;
|
||||
jmethodID append_recno_method_id_;
|
||||
jmethodID bt_compare_method_id_;
|
||||
jmethodID bt_prefix_method_id_;
|
||||
jmethodID dup_compare_method_id_;
|
||||
jmethodID h_hash_method_id_;
|
||||
jint construct_flags_;
|
||||
JavaVM *javavm;
|
||||
jobject jdbref; /* global reference */
|
||||
jobject append_recno; /* global reference */
|
||||
jobject assoc; /* global reference */
|
||||
jobject bt_compare; /* global reference */
|
||||
jobject bt_prefix; /* global reference */
|
||||
jobject dup_compare; /* global reference */
|
||||
jobject feedback; /* global reference */
|
||||
jobject h_hash; /* global reference */
|
||||
jmethodID append_recno_method_id;
|
||||
jmethodID assoc_method_id;
|
||||
jmethodID bt_compare_method_id;
|
||||
jmethodID bt_prefix_method_id;
|
||||
jmethodID dup_compare_method_id;
|
||||
jmethodID feedback_method_id;
|
||||
jmethodID h_hash_method_id;
|
||||
jint construct_flags;
|
||||
} DB_JAVAINFO;
|
||||
|
||||
/* create/initialize an object */
|
||||
extern DB_JAVAINFO *dbji_construct(JNIEnv *jnienv, jint flags);
|
||||
extern DB_JAVAINFO *dbji_construct(JNIEnv *jnienv, jobject jdb, jint flags);
|
||||
|
||||
/* release all objects held by this this one */
|
||||
extern void dbji_dealloc(DB_JAVAINFO *, JNIEnv *jnienv);
|
||||
@ -184,6 +200,11 @@ extern void dbji_call_feedback(DB_JAVAINFO *, DB *db, jobject jdb,
|
||||
extern void dbji_set_append_recno_object(DB_JAVAINFO *, JNIEnv *jnienv, DB *db, jobject value);
|
||||
extern int dbji_call_append_recno(DB_JAVAINFO *, DB *db, jobject jdb,
|
||||
DBT *dbt, jint recno);
|
||||
extern void dbji_set_assoc_object(DB_JAVAINFO *, JNIEnv *jnienv,
|
||||
DB *db, DB_TXN *txn, DB *second,
|
||||
jobject value, int flags);
|
||||
extern int dbji_call_assoc(DB_JAVAINFO *, DB *db, jobject jdb,
|
||||
const DBT *key, const DBT* data, DBT *result);
|
||||
extern void dbji_set_bt_compare_object(DB_JAVAINFO *, JNIEnv *jnienv, DB *db, jobject value);
|
||||
extern int dbji_call_bt_compare(DB_JAVAINFO *, DB *db, jobject jdb,
|
||||
const DBT *dbt1, const DBT *dbt2);
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_locked.c,v 11.11 2000/10/25 19:54:55 dda Exp $";
|
||||
static const char revid[] = "$Id: java_locked.c,v 11.32 2002/08/06 05:19:07 bostic Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
@ -15,280 +15,307 @@ static const char revid[] = "$Id: java_locked.c,v 11.11 2000/10/25 19:54:55 dda
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Implementation of class LockedDBT
|
||||
*
|
||||
* Implementation of functions to manipulate LOCKED_DBT.
|
||||
*/
|
||||
int
|
||||
jdbt_lock(JDBT *jdbt, JNIEnv *jnienv, jobject obj, OpKind kind)
|
||||
locked_dbt_get(LOCKED_DBT *ldbt, JNIEnv *jnienv, DB_ENV *dbenv,
|
||||
jobject jdbt, OpKind kind)
|
||||
{
|
||||
DBT *dbt;
|
||||
|
||||
jdbt->obj_ = obj;
|
||||
jdbt->do_realloc_ = 0;
|
||||
jdbt->kind_ = kind;
|
||||
jdbt->java_array_len_= 0;
|
||||
jdbt->java_data_ = 0;
|
||||
jdbt->before_data_ = 0;
|
||||
jdbt->has_error_ = 0;
|
||||
jdbt->dbt = (DBT_JAVAINFO *)get_private_dbobj(jnienv, name_DBT, obj);
|
||||
COMPQUIET(dbenv, NULL);
|
||||
ldbt->jdbt = jdbt;
|
||||
ldbt->java_array_len = 0;
|
||||
ldbt->flags = 0;
|
||||
ldbt->kind = kind;
|
||||
ldbt->java_data = 0;
|
||||
ldbt->before_data = 0;
|
||||
ldbt->javainfo =
|
||||
(DBT_JAVAINFO *)get_private_dbobj(jnienv, name_DBT, jdbt);
|
||||
|
||||
if (!verify_non_null(jnienv, jdbt->dbt)) {
|
||||
jdbt->has_error_ = 1;
|
||||
if (!verify_non_null(jnienv, ldbt->javainfo)) {
|
||||
report_exception(jnienv, "Dbt is gc'ed?", 0, 0);
|
||||
F_SET(ldbt, LOCKED_ERROR);
|
||||
return (EINVAL);
|
||||
}
|
||||
dbt = &jdbt->dbt->dbt;
|
||||
|
||||
if (kind == outOp &&
|
||||
(dbt->flags & (DB_DBT_USERMEM | DB_DBT_MALLOC | DB_DBT_REALLOC)) == 0) {
|
||||
report_exception(jnienv,
|
||||
"Dbt.flags must be set to Db.DB_DBT_USERMEM, "
|
||||
"Db.DB_DBT_MALLOC or Db.DB_DBT_REALLOC",
|
||||
0, 0);
|
||||
jdbt->has_error_ = 1;
|
||||
if (F_ISSET(ldbt->javainfo, DBT_JAVAINFO_LOCKED)) {
|
||||
report_exception(jnienv, "Dbt is already in use", 0, 0);
|
||||
F_SET(ldbt, LOCKED_ERROR);
|
||||
return (EINVAL);
|
||||
}
|
||||
dbt = &ldbt->javainfo->dbt;
|
||||
|
||||
/* If this is requested to be realloc, we cannot use the
|
||||
* underlying realloc, because the array we will pass in
|
||||
* is not allocated by us, but the Java VM, so it cannot
|
||||
* be successfully realloced. We simulate the reallocation,
|
||||
* by using USERMEM and reallocating the java array when a
|
||||
* ENOMEM error occurs. We change the flags during the operation,
|
||||
* and they are reset when the operation completes (in the
|
||||
* LockedDBT destructor.
|
||||
if ((*jnienv)->GetBooleanField(jnienv,
|
||||
jdbt, fid_Dbt_must_create_data) != 0)
|
||||
F_SET(ldbt, LOCKED_CREATE_DATA);
|
||||
else
|
||||
ldbt->javainfo->array =
|
||||
(*jnienv)->GetObjectField(jnienv, jdbt, fid_Dbt_data);
|
||||
|
||||
dbt->size = (*jnienv)->GetIntField(jnienv, jdbt, fid_Dbt_size);
|
||||
dbt->ulen = (*jnienv)->GetIntField(jnienv, jdbt, fid_Dbt_ulen);
|
||||
dbt->dlen = (*jnienv)->GetIntField(jnienv, jdbt, fid_Dbt_dlen);
|
||||
dbt->doff = (*jnienv)->GetIntField(jnienv, jdbt, fid_Dbt_doff);
|
||||
dbt->flags = (*jnienv)->GetIntField(jnienv, jdbt, fid_Dbt_flags);
|
||||
ldbt->javainfo->offset = (*jnienv)->GetIntField(jnienv, jdbt,
|
||||
fid_Dbt_offset);
|
||||
|
||||
/*
|
||||
* If no flags are set, use default behavior of DB_DBT_MALLOC.
|
||||
* We can safely set dbt->flags because flags will never be copied
|
||||
* back to the Java Dbt.
|
||||
*/
|
||||
if ((dbt->flags & DB_DBT_REALLOC) != 0) {
|
||||
dbt->flags &= ~DB_DBT_REALLOC;
|
||||
dbt->flags |= DB_DBT_USERMEM;
|
||||
jdbt->do_realloc_ = 1;
|
||||
if (kind != inOp &&
|
||||
!F_ISSET(dbt, DB_DBT_USERMEM | DB_DBT_MALLOC | DB_DBT_REALLOC))
|
||||
F_SET(dbt, DB_DBT_MALLOC);
|
||||
|
||||
/*
|
||||
* If this is requested to be realloc with an existing array,
|
||||
* we cannot use the underlying realloc, because the array we
|
||||
* will pass in is allocated by the Java VM, not us, so it
|
||||
* cannot be realloced. We simulate the reallocation by using
|
||||
* USERMEM and reallocating the java array when a ENOMEM error
|
||||
* occurs. We change the flags during the operation, and they
|
||||
* are reset when the operation completes (in locked_dbt_put).
|
||||
*/
|
||||
if (F_ISSET(dbt, DB_DBT_REALLOC) && ldbt->javainfo->array != NULL) {
|
||||
F_CLR(dbt, DB_DBT_REALLOC);
|
||||
F_SET(dbt, DB_DBT_USERMEM);
|
||||
F_SET(ldbt, LOCKED_REALLOC_NONNULL);
|
||||
}
|
||||
|
||||
if ((dbt->flags & DB_DBT_USERMEM) || kind != outOp) {
|
||||
if ((F_ISSET(dbt, DB_DBT_USERMEM) || kind != outOp) &&
|
||||
!F_ISSET(ldbt, LOCKED_CREATE_DATA)) {
|
||||
|
||||
/* If writing with DB_DBT_USERMEM/REALLOC
|
||||
/*
|
||||
* If writing with DB_DBT_USERMEM
|
||||
* or it's a set (or get/set) operation,
|
||||
* then the data should point to a java array.
|
||||
* Note that outOp means data is coming out of the database
|
||||
* (it's a get). inOp means data is going into the database
|
||||
* (either a put, or a key input).
|
||||
*/
|
||||
if (!jdbt->dbt->array_) {
|
||||
if (!ldbt->javainfo->array) {
|
||||
report_exception(jnienv, "Dbt.data is null", 0, 0);
|
||||
jdbt->has_error_ = 1;
|
||||
F_SET(ldbt, LOCKED_ERROR);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
/* Verify other parameters */
|
||||
jdbt->java_array_len_ = (*jnienv)->GetArrayLength(jnienv, jdbt->dbt->array_);
|
||||
if (jdbt->dbt->offset_ < 0 ) {
|
||||
ldbt->java_array_len = (*jnienv)->GetArrayLength(jnienv,
|
||||
ldbt->javainfo->array);
|
||||
if (ldbt->javainfo->offset < 0 ) {
|
||||
report_exception(jnienv, "Dbt.offset illegal", 0, 0);
|
||||
jdbt->has_error_ = 1;
|
||||
F_SET(ldbt, LOCKED_ERROR);
|
||||
return (EINVAL);
|
||||
}
|
||||
if (dbt->ulen + jdbt->dbt->offset_ > jdbt->java_array_len_) {
|
||||
if (dbt->size + ldbt->javainfo->offset > ldbt->java_array_len) {
|
||||
report_exception(jnienv,
|
||||
"Dbt.ulen + Dbt.offset greater than array length", 0, 0);
|
||||
jdbt->has_error_ = 1;
|
||||
"Dbt.size + Dbt.offset greater than array length",
|
||||
0, 0);
|
||||
F_SET(ldbt, LOCKED_ERROR);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
jdbt->java_data_ = (*jnienv)->GetByteArrayElements(jnienv, jdbt->dbt->array_,
|
||||
(jboolean *)0);
|
||||
dbt->data = jdbt->before_data_ = jdbt->java_data_ + jdbt->dbt->offset_;
|
||||
}
|
||||
else {
|
||||
ldbt->java_data = (*jnienv)->GetByteArrayElements(jnienv,
|
||||
ldbt->javainfo->array,
|
||||
(jboolean *)0);
|
||||
|
||||
/* If writing with DB_DBT_MALLOC, then the data is
|
||||
* allocated by DB.
|
||||
*/
|
||||
dbt->data = jdbt->before_data_ = 0;
|
||||
dbt->data = ldbt->before_data = ldbt->java_data +
|
||||
ldbt->javainfo->offset;
|
||||
}
|
||||
else if (!F_ISSET(ldbt, LOCKED_CREATE_DATA)) {
|
||||
|
||||
/*
|
||||
* If writing with DB_DBT_MALLOC or DB_DBT_REALLOC with
|
||||
* a null array, then the data is allocated by DB.
|
||||
*/
|
||||
dbt->data = ldbt->before_data = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* RPC makes the assumption that if dbt->size is non-zero, there
|
||||
* is data to copy from dbt->data. We may have set dbt->size
|
||||
* to a non-zero integer above but decided not to point
|
||||
* dbt->data at anything. (One example is if we're doing an outOp
|
||||
* with an already-used Dbt whose values we expect to just
|
||||
* overwrite.)
|
||||
*
|
||||
* Clean up the dbt fields so we don't run into trouble.
|
||||
* (Note that doff, dlen, and flags all may contain meaningful
|
||||
* values.)
|
||||
*/
|
||||
if (dbt->data == NULL)
|
||||
dbt->size = dbt->ulen = 0;
|
||||
|
||||
F_SET(ldbt->javainfo, DBT_JAVAINFO_LOCKED);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* The LockedDBT destructor is called when the java handler returns
|
||||
* to the user, since that's when the LockedDBT objects go out of scope.
|
||||
* Since it is thus called after any call to the underlying database,
|
||||
* it copies any information from temporary structures back to user
|
||||
* accessible arrays, and of course must free memory and remove references.
|
||||
/*
|
||||
* locked_dbt_put must be called for any LOCKED_DBT struct before a
|
||||
* java handler returns to the user. It can be thought of as the
|
||||
* LOCKED_DBT destructor. It copies any information from temporary
|
||||
* structures back to user accessible arrays, and of course must free
|
||||
* memory and remove references. The LOCKED_DBT itself is not freed,
|
||||
* as it is expected to be a stack variable.
|
||||
*
|
||||
* Note that after this call, the LOCKED_DBT can still be used in
|
||||
* limited ways, e.g. to look at values in the C DBT.
|
||||
*/
|
||||
void
|
||||
jdbt_unlock(JDBT *jdbt, JNIEnv *jnienv)
|
||||
locked_dbt_put(LOCKED_DBT *ldbt, JNIEnv *jnienv, DB_ENV *dbenv)
|
||||
{
|
||||
DBT *dbt;
|
||||
|
||||
dbt = &jdbt->dbt->dbt;
|
||||
dbt = &ldbt->javainfo->dbt;
|
||||
|
||||
/* Fix up the flags if we changed them. */
|
||||
if (jdbt->do_realloc_) {
|
||||
dbt->flags &= ~DB_DBT_USERMEM;
|
||||
dbt->flags |= DB_DBT_REALLOC;
|
||||
}
|
||||
/*
|
||||
* If the error flag was set, we never succeeded
|
||||
* in allocating storage.
|
||||
*/
|
||||
if (F_ISSET(ldbt, LOCKED_ERROR))
|
||||
return;
|
||||
|
||||
if ((dbt->flags & (DB_DBT_USERMEM | DB_DBT_REALLOC)) ||
|
||||
jdbt->kind_ == inOp) {
|
||||
if (((F_ISSET(dbt, DB_DBT_USERMEM) ||
|
||||
F_ISSET(ldbt, LOCKED_REALLOC_NONNULL)) ||
|
||||
ldbt->kind == inOp) && !F_ISSET(ldbt, LOCKED_CREATE_DATA)) {
|
||||
|
||||
/* If writing with DB_DBT_USERMEM/REALLOC or it's a set
|
||||
/*
|
||||
* If writing with DB_DBT_USERMEM or it's a set
|
||||
* (or get/set) operation, then the data may be already in
|
||||
* the java array, in which case, we just need to release it.
|
||||
* If DB didn't put it in the array (indicated by the
|
||||
* dbt->data changing), we need to do that
|
||||
*/
|
||||
if (jdbt->before_data_ != jdbt->java_data_) {
|
||||
if (ldbt->before_data != ldbt->java_data) {
|
||||
(*jnienv)->SetByteArrayRegion(jnienv,
|
||||
jdbt->dbt->array_,
|
||||
jdbt->dbt->offset_,
|
||||
ldbt->javainfo->array,
|
||||
ldbt->javainfo->offset,
|
||||
dbt->ulen,
|
||||
jdbt->before_data_);
|
||||
ldbt->before_data);
|
||||
}
|
||||
(*jnienv)->ReleaseByteArrayElements(jnienv, jdbt->dbt->array_, jdbt->java_data_, 0);
|
||||
(*jnienv)->ReleaseByteArrayElements(jnienv,
|
||||
ldbt->javainfo->array,
|
||||
ldbt->java_data, 0);
|
||||
dbt->data = 0;
|
||||
}
|
||||
if ((dbt->flags & DB_DBT_MALLOC) && jdbt->kind_ != inOp) {
|
||||
else if (F_ISSET(dbt, DB_DBT_MALLOC | DB_DBT_REALLOC) &&
|
||||
ldbt->kind != inOp && !F_ISSET(ldbt, LOCKED_CREATE_DATA)) {
|
||||
|
||||
/* If writing with DB_DBT_MALLOC, then the data was allocated
|
||||
* by DB. If dbt->data is zero, it means an error occurred
|
||||
* (and should have been already reported).
|
||||
/*
|
||||
* If writing with DB_DBT_MALLOC, or DB_DBT_REALLOC
|
||||
* with a zero buffer, then the data was allocated by
|
||||
* DB. If dbt->data is zero, it means an error
|
||||
* occurred (and should have been already reported).
|
||||
*/
|
||||
if (dbt->data) {
|
||||
|
||||
/* Release any old references. */
|
||||
dbjit_release(jdbt->dbt, jnienv);
|
||||
|
||||
/* In the case of SET_RANGE, the key is inOutOp
|
||||
/*
|
||||
* In the case of SET_RANGE, the key is inOutOp
|
||||
* and when not found, its data will be left as
|
||||
* its original value. Only copy and free it
|
||||
* here if it has been allocated by DB
|
||||
* (dbt->data has changed).
|
||||
*/
|
||||
if (dbt->data != jdbt->before_data_) {
|
||||
jdbt->dbt->array_ = (jbyteArray)
|
||||
NEW_GLOBAL_REF(jnienv,
|
||||
(*jnienv)->NewByteArray(jnienv,
|
||||
dbt->size));
|
||||
jdbt->dbt->offset_ = 0;
|
||||
if (dbt->data != ldbt->before_data) {
|
||||
jbyteArray newarr;
|
||||
|
||||
if ((newarr = (*jnienv)->NewByteArray(jnienv,
|
||||
dbt->size)) == NULL) {
|
||||
/* The JVM has posted an exception. */
|
||||
F_SET(ldbt, LOCKED_ERROR);
|
||||
return;
|
||||
}
|
||||
(*jnienv)->SetObjectField(jnienv, ldbt->jdbt,
|
||||
fid_Dbt_data,
|
||||
newarr);
|
||||
ldbt->javainfo->offset = 0;
|
||||
(*jnienv)->SetByteArrayRegion(jnienv,
|
||||
jdbt->dbt->array_, 0, dbt->size,
|
||||
newarr, 0, dbt->size,
|
||||
(jbyte *)dbt->data);
|
||||
free(dbt->data);
|
||||
(void)__os_ufree(dbenv, dbt->data);
|
||||
dbt->data = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The size field may have changed after a DB API call,
|
||||
* so we set that back too.
|
||||
*/
|
||||
(*jnienv)->SetIntField(jnienv, ldbt->jdbt, fid_Dbt_size, dbt->size);
|
||||
ldbt->javainfo->array = NULL;
|
||||
F_CLR(ldbt->javainfo, DBT_JAVAINFO_LOCKED);
|
||||
}
|
||||
|
||||
/* Realloc the java array to receive data if the DBT was marked
|
||||
* for realloc, and the last operation set the size field to an
|
||||
* amount greater than ulen.
|
||||
/*
|
||||
* Realloc the java array to receive data if the DBT used
|
||||
* DB_DBT_REALLOC flag with a non-null data array, and the last
|
||||
* operation set the size field to an amount greater than ulen.
|
||||
* Return 1 if these conditions are met, otherwise 0. This is used
|
||||
* internally to simulate the operations needed for DB_DBT_REALLOC.
|
||||
*/
|
||||
int jdbt_realloc(JDBT *jdbt, JNIEnv *jnienv)
|
||||
int locked_dbt_realloc(LOCKED_DBT *ldbt, JNIEnv *jnienv, DB_ENV *dbenv)
|
||||
{
|
||||
DBT *dbt;
|
||||
|
||||
dbt = &jdbt->dbt->dbt;
|
||||
COMPQUIET(dbenv, NULL);
|
||||
dbt = &ldbt->javainfo->dbt;
|
||||
|
||||
if (!jdbt->do_realloc_ || jdbt->has_error_ || dbt->size <= dbt->ulen)
|
||||
if (!F_ISSET(ldbt, LOCKED_REALLOC_NONNULL) ||
|
||||
F_ISSET(ldbt, LOCKED_ERROR) || dbt->size <= dbt->ulen)
|
||||
return (0);
|
||||
|
||||
(*jnienv)->ReleaseByteArrayElements(jnienv, jdbt->dbt->array_, jdbt->java_data_, 0);
|
||||
dbjit_release(jdbt->dbt, jnienv);
|
||||
(*jnienv)->ReleaseByteArrayElements(jnienv, ldbt->javainfo->array,
|
||||
ldbt->java_data, 0);
|
||||
|
||||
/* We allocate a new array of the needed size.
|
||||
/*
|
||||
* We allocate a new array of the needed size.
|
||||
* We'll set the offset to 0, as the old offset
|
||||
* really doesn't make any sense.
|
||||
*/
|
||||
jdbt->java_array_len_ = dbt->ulen = dbt->size;
|
||||
jdbt->dbt->offset_ = 0;
|
||||
jdbt->dbt->array_ = (jbyteArray)
|
||||
NEW_GLOBAL_REF(jnienv, (*jnienv)->NewByteArray(jnienv, dbt->size));
|
||||
if ((ldbt->javainfo->array = (*jnienv)->NewByteArray(jnienv,
|
||||
dbt->size)) == NULL) {
|
||||
F_SET(ldbt, LOCKED_ERROR);
|
||||
return (0);
|
||||
}
|
||||
|
||||
jdbt->java_data_ = (*jnienv)->GetByteArrayElements(jnienv,
|
||||
jdbt->dbt->array_,
|
||||
(jboolean *)0);
|
||||
dbt->data = jdbt->before_data_ = jdbt->java_data_;
|
||||
ldbt->java_array_len = dbt->ulen = dbt->size;
|
||||
ldbt->javainfo->offset = 0;
|
||||
(*jnienv)->SetObjectField(jnienv, ldbt->jdbt, fid_Dbt_data,
|
||||
ldbt->javainfo->array);
|
||||
ldbt->java_data = (*jnienv)->GetByteArrayElements(jnienv,
|
||||
ldbt->javainfo->array, (jboolean *)0);
|
||||
memcpy(ldbt->java_data, ldbt->before_data, dbt->ulen);
|
||||
dbt->data = ldbt->before_data = ldbt->java_data;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Implementation of class JSTR
|
||||
*
|
||||
* Implementation of functions to manipulate LOCKED_STRING.
|
||||
*/
|
||||
int
|
||||
jstr_lock(JSTR *js, JNIEnv *jnienv, jstring jstr)
|
||||
locked_string_get(LOCKED_STRING *ls, JNIEnv *jnienv, jstring jstr)
|
||||
{
|
||||
js->jstr_ = jstr;
|
||||
ls->jstr = jstr;
|
||||
|
||||
if (jstr == 0)
|
||||
js->string = 0;
|
||||
ls->string = 0;
|
||||
else
|
||||
js->string = (*jnienv)->GetStringUTFChars(jnienv, jstr,
|
||||
ls->string = (*jnienv)->GetStringUTFChars(jnienv, jstr,
|
||||
(jboolean *)0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
void jstr_unlock(JSTR *js, JNIEnv *jnienv)
|
||||
void locked_string_put(LOCKED_STRING *ls, JNIEnv *jnienv)
|
||||
{
|
||||
if (js->jstr_)
|
||||
(*jnienv)->ReleaseStringUTFChars(jnienv, js->jstr_, js->string);
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Implementation of class JSTRARRAY
|
||||
*
|
||||
*/
|
||||
int
|
||||
jstrarray_lock(JSTRARRAY *jsa, JNIEnv *jnienv, jobjectArray arr)
|
||||
{
|
||||
int i;
|
||||
|
||||
jsa->arr_ = arr;
|
||||
jsa->array = 0;
|
||||
|
||||
if (arr != 0) {
|
||||
int count = (*jnienv)->GetArrayLength(jnienv, arr);
|
||||
const char **new_array =
|
||||
(const char **)malloc((sizeof(const char *))*(count+1));
|
||||
for (i=0; i<count; i++) {
|
||||
jstring jstr = (jstring)(*jnienv)->GetObjectArrayElement(jnienv, arr, i);
|
||||
if (jstr == 0) {
|
||||
/*
|
||||
* An embedded null in the string array
|
||||
* is treated as an endpoint.
|
||||
*/
|
||||
new_array[i] = 0;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
new_array[i] =
|
||||
(*jnienv)->GetStringUTFChars(jnienv, jstr, (jboolean *)0);
|
||||
}
|
||||
}
|
||||
new_array[count] = 0;
|
||||
jsa->array = new_array;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
void jstrarray_unlock(JSTRARRAY *jsa, JNIEnv *jnienv)
|
||||
{
|
||||
int i;
|
||||
jstring jstr;
|
||||
|
||||
if (jsa->arr_) {
|
||||
int count = (*jnienv)->GetArrayLength(jnienv, jsa->arr_);
|
||||
for (i=0; i<count; i++) {
|
||||
if (jsa->array[i] == 0)
|
||||
break;
|
||||
jstr = (jstring)(*jnienv)->GetObjectArrayElement(jnienv, jsa->arr_, i);
|
||||
(*jnienv)->ReleaseStringUTFChars(jnienv, jstr, jsa->array[i]);
|
||||
}
|
||||
free((void*)jsa->array);
|
||||
}
|
||||
if (ls->jstr)
|
||||
(*jnienv)->ReleaseStringUTFChars(jnienv, ls->jstr, ls->string);
|
||||
}
|
||||
|
@ -1,98 +1,82 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*
|
||||
* $Id: java_locked.h,v 11.9 2000/10/25 19:54:55 dda Exp $
|
||||
* $Id: java_locked.h,v 11.18 2002/05/07 16:12:42 dda Exp $
|
||||
*/
|
||||
|
||||
#ifndef _JAVA_LOCKED_H_
|
||||
#define _JAVA_LOCKED_H_
|
||||
|
||||
/*
|
||||
* Used internally by LockedDBT constructor.
|
||||
* Used as argument to locked_dbt_get().
|
||||
*/
|
||||
typedef enum _OpKind {
|
||||
inOp, /* setting data in database (passing data in) */
|
||||
outOp, /* getting data from database to user memory */
|
||||
inOutOp /* both getting/setting data */
|
||||
inOp, /* setting data in database (passing data in) */
|
||||
outOp, /* getting data from database to user memory */
|
||||
inOutOp /* both getting/setting data */
|
||||
} OpKind;
|
||||
|
||||
/*
|
||||
* LOCKED_DBT
|
||||
*
|
||||
* Declaration of JDBT
|
||||
*
|
||||
* A JDBT object exists during a
|
||||
* single native call to the DB API. Its constructor's job is
|
||||
* to temporarily convert any java array found in the DBT_JAVAINFO
|
||||
* to actual bytes in memory that remain locked in place. These
|
||||
* bytes are used during the call to the underlying DB C layer,
|
||||
* and are released and/or copied back by the destructor.
|
||||
* Thus, a LockedDBT must be declared as a stack object to
|
||||
* function properly.
|
||||
* A stack variable LOCKED_DBT should be declared for each Dbt used in a
|
||||
* native call to the DB API. Before the DBT can be used, locked_dbt_get()
|
||||
* must be called to temporarily convert any java array found in the
|
||||
* Dbt (which has a pointer to a DBT_JAVAINFO struct) to actual bytes
|
||||
* in memory that remain locked in place. These bytes are used during
|
||||
* the call to the DB C API, and are released and/or copied back when
|
||||
* locked_dbt_put is called.
|
||||
*/
|
||||
typedef struct _jdbt
|
||||
typedef struct _locked_dbt
|
||||
{
|
||||
/* these are accessed externally to ldbt_ functions */
|
||||
DBT_JAVAINFO *dbt;
|
||||
unsigned int java_array_len_;
|
||||
/* these are accessed externally to locked_dbt_ functions */
|
||||
DBT_JAVAINFO *javainfo;
|
||||
unsigned int java_array_len;
|
||||
jobject jdbt;
|
||||
|
||||
/* these are for used internally by ldbt_ functions */
|
||||
jobject obj_;
|
||||
jbyte *java_data_;
|
||||
jbyte *before_data_;
|
||||
int has_error_;
|
||||
int do_realloc_;
|
||||
OpKind kind_;
|
||||
} JDBT;
|
||||
/* these are for used internally by locked_dbt_ functions */
|
||||
jbyte *java_data;
|
||||
jbyte *before_data;
|
||||
OpKind kind;
|
||||
|
||||
extern int jdbt_lock(JDBT *, JNIEnv *jnienv, jobject obj, OpKind kind);
|
||||
extern void jdbt_unlock(JDBT *, JNIEnv *jnienv); /* this unlocks and frees the memory */
|
||||
extern int jdbt_realloc(JDBT *, JNIEnv *jnienv); /* returns 1 if reallocation took place */
|
||||
#define LOCKED_ERROR 0x01 /* error occurred */
|
||||
#define LOCKED_CREATE_DATA 0x02 /* must create data on the fly */
|
||||
#define LOCKED_REALLOC_NONNULL 0x04 /* DB_DBT_REALLOC flag, nonnull data */
|
||||
u_int32_t flags;
|
||||
} LOCKED_DBT;
|
||||
|
||||
/****************************************************************
|
||||
/* Fill the LOCKED_DBT struct and lock the Java byte array */
|
||||
extern int locked_dbt_get(LOCKED_DBT *, JNIEnv *, DB_ENV *, jobject, OpKind);
|
||||
|
||||
/* unlock the Java byte array */
|
||||
extern void locked_dbt_put(LOCKED_DBT *, JNIEnv *, DB_ENV *);
|
||||
|
||||
/* realloc the Java byte array */
|
||||
extern int locked_dbt_realloc(LOCKED_DBT *, JNIEnv *, DB_ENV *);
|
||||
|
||||
/*
|
||||
* LOCKED_STRING
|
||||
*
|
||||
* Declaration of JSTR
|
||||
*
|
||||
* A JSTR exists temporarily to convert a java jstring object
|
||||
* A LOCKED_STRING exists temporarily to convert a java jstring object
|
||||
* to a char *. Because the memory for the char * string is
|
||||
* managed by the JVM, it must be released when we are done
|
||||
* looking at it. Typically, jstr_lock() is called at the
|
||||
* beginning of a function for each jstring object, and jstr_unlock
|
||||
* is called at the end of each function for each JSTR.
|
||||
* looking at it. Typically, locked_string_get() is called at the
|
||||
* beginning of a function for each jstring object, and locked_string_put
|
||||
* is called at the end of each function for each LOCKED_STRING.
|
||||
*/
|
||||
typedef struct _jstr
|
||||
typedef struct _locked_string
|
||||
{
|
||||
/* this accessed externally to jstr_ functions */
|
||||
/* this accessed externally to locked_string_ functions */
|
||||
const char *string;
|
||||
|
||||
/* this is used internally by jstr_ functions */
|
||||
jstring jstr_;
|
||||
} JSTR;
|
||||
/* this is used internally by locked_string_ functions */
|
||||
jstring jstr;
|
||||
} LOCKED_STRING;
|
||||
|
||||
extern int jstr_lock(JSTR *, JNIEnv *jnienv, jstring jstr);
|
||||
extern void jstr_unlock(JSTR *, JNIEnv *jnienv); /* this unlocks and frees mem */
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Declaration of class LockedStrarray
|
||||
*
|
||||
* Given a java jobjectArray object (that must be a String[]),
|
||||
* we extract the individual strings and build a const char **
|
||||
* When the LockedStrarray object is destroyed, the individual
|
||||
* strings are released.
|
||||
*/
|
||||
typedef struct _jstrarray
|
||||
{
|
||||
/* this accessed externally to jstrarray_ functions */
|
||||
const char **array;
|
||||
|
||||
/* this is used internally by jstrarray_ functions */
|
||||
jobjectArray arr_;
|
||||
} JSTRARRAY;
|
||||
|
||||
extern int jstrarray_lock(JSTRARRAY *, JNIEnv *jnienv, jobjectArray arr);
|
||||
extern void jstrarray_unlock(JSTRARRAY *, JNIEnv *jnienv); /* this unlocks and frees mem */
|
||||
extern int locked_string_get(LOCKED_STRING *, JNIEnv *jnienv, jstring jstr);
|
||||
extern void locked_string_put(LOCKED_STRING *, JNIEnv *jnienv); /* this unlocks and frees mem */
|
||||
|
||||
#endif /* !_JAVA_LOCKED_H_ */
|
||||
|
207
bdb/libdb_java/java_stat_auto.c
Normal file
207
bdb/libdb_java/java_stat_auto.c
Normal file
@ -0,0 +1,207 @@
|
||||
/* DO NOT EDIT: automatically built by dist/s_java. */
|
||||
#include "java_util.h"
|
||||
int __jv_fill_bt_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_bt_stat *statp) {
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_magic);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_version);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_metaflags);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_nkeys);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_ndata);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_pagesize);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_maxkey);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_minkey);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_re_len);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_re_pad);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_levels);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_int_pg);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_leaf_pg);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_dup_pg);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_over_pg);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_free);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_int_pgfree);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_leaf_pgfree);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_dup_pgfree);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, bt_over_pgfree);
|
||||
return (0);
|
||||
}
|
||||
int __jv_fill_h_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_h_stat *statp) {
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_magic);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_version);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_metaflags);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_nkeys);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_ndata);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_pagesize);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_ffactor);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_buckets);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_free);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_bfree);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_bigpages);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_big_bfree);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_overflows);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_ovfl_free);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_dup);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, hash_dup_free);
|
||||
return (0);
|
||||
}
|
||||
int __jv_fill_lock_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_lock_stat *statp) {
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_id);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cur_maxid);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxlocks);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxlockers);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxobjects);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nmodes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nlocks);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnlocks);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nlockers);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnlockers);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nobjects);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnobjects);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nconflicts);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nrequests);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nreleases);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nnowaits);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ndeadlocks);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_locktimeout);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nlocktimeouts);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_txntimeout);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ntxntimeouts);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize);
|
||||
return (0);
|
||||
}
|
||||
int __jv_fill_log_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_log_stat *statp) {
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_magic);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_version);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_mode);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_lg_bsize);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_lg_size);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_w_bytes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_w_mbytes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wc_bytes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wc_mbytes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wcount);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_wcount_fill);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_scount);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cur_file);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cur_offset);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_disk_file);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_disk_offset);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxcommitperflush);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_mincommitperflush);
|
||||
return (0);
|
||||
}
|
||||
int __jv_fill_mpool_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_mpool_stat *statp) {
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_gbytes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_bytes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ncache);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_map);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cache_hit);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_cache_miss);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_create);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_in);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_out);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ro_evict);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_rw_evict);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_trickle);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_pages);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_clean);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_page_dirty);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_buckets);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_searches);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_longest);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_examined);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_nowait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_wait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_hash_max_wait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_buckets);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_max_buckets);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_pages);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_alloc_max_pages);
|
||||
return (0);
|
||||
}
|
||||
int __jv_fill_qam_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_qam_stat *statp) {
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_magic);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_version);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_metaflags);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_nkeys);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_ndata);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_pagesize);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_extentsize);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_pages);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_re_len);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_re_pad);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_pgfree);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_first_recno);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, qs_cur_recno);
|
||||
return (0);
|
||||
}
|
||||
int __jv_fill_rep_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_rep_stat *statp) {
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_status);
|
||||
JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_next_lsn);
|
||||
JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_waiting_lsn);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_dupmasters);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_env_id);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_env_priority);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_gen);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_duplicated);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_queued);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_queued_max);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_queued_total);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_records);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_log_requested);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_master);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_master_changes);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_badgen);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_processed);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_recover);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_send_failures);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_msgs_sent);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_newsites);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nsites);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nthrottles);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_outdated);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_txns_applied);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_elections);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_elections_won);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_cur_winner);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_gen);
|
||||
JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_election_lsn);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_nsites);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_priority);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_status);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_tiebreaker);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_election_votes);
|
||||
return (0);
|
||||
}
|
||||
int __jv_fill_txn_stat(JNIEnv *jnienv, jclass cl,
|
||||
jobject jobj, struct __db_txn_stat *statp) {
|
||||
JAVADB_STAT_LSN(jnienv, cl, jobj, statp, st_last_ckp);
|
||||
JAVADB_STAT_LONG(jnienv, cl, jobj, statp, st_time_ckp);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_last_txnid);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxtxns);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_naborts);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nbegins);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_ncommits);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nactive);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_nrestores);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_maxnactive);
|
||||
JAVADB_STAT_ACTIVE(jnienv, cl, jobj, statp, st_txnarray);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_wait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_region_nowait);
|
||||
JAVADB_STAT_INT(jnienv, cl, jobj, statp, st_regsize);
|
||||
return (0);
|
||||
}
|
9
bdb/libdb_java/java_stat_auto.h
Normal file
9
bdb/libdb_java/java_stat_auto.h
Normal file
@ -0,0 +1,9 @@
|
||||
/* DO NOT EDIT: automatically built by dist/s_java. */
|
||||
extern int __jv_fill_bt_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_bt_stat *statp);
|
||||
extern int __jv_fill_h_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_h_stat *statp);
|
||||
extern int __jv_fill_lock_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_lock_stat *statp);
|
||||
extern int __jv_fill_log_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_log_stat *statp);
|
||||
extern int __jv_fill_mpool_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_mpool_stat *statp);
|
||||
extern int __jv_fill_qam_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_qam_stat *statp);
|
||||
extern int __jv_fill_rep_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_rep_stat *statp);
|
||||
extern int __jv_fill_txn_stat(JNIEnv *jnienv, jclass cl, jobject jobj, struct __db_txn_stat *statp);
|
@ -1,21 +1,19 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*/
|
||||
#include "db_config.h"
|
||||
|
||||
#ifndef lint
|
||||
static const char revid[] = "$Id: java_util.c,v 11.17 2000/10/28 13:09:39 dda Exp $";
|
||||
static const char revid[] = "$Id: java_util.c,v 11.49 2002/09/13 03:09:30 mjc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <jni.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include "java_util.h"
|
||||
|
||||
#ifdef DB_WIN32
|
||||
@ -32,17 +30,22 @@ const char * const name_DB_EXCEPTION = "DbException";
|
||||
const char * const name_DB_HASH_STAT = "DbHashStat";
|
||||
const char * const name_DB_LOCK = "DbLock";
|
||||
const char * const name_DB_LOCK_STAT = "DbLockStat";
|
||||
const char * const name_DB_LOCKNOTGRANTED_EX = "DbLockNotGrantedException";
|
||||
const char * const name_DB_LOGC = "DbLogc";
|
||||
const char * const name_DB_LOG_STAT = "DbLogStat";
|
||||
const char * const name_DB_LSN = "DbLsn";
|
||||
const char * const name_DB_MEMORY_EX = "DbMemoryException";
|
||||
const char * const name_DB_MPOOL_FSTAT = "DbMpoolFStat";
|
||||
const char * const name_DB_MPOOL_STAT = "DbMpoolStat";
|
||||
const char * const name_DB_PREPLIST = "DbPreplist";
|
||||
const char * const name_DB_QUEUE_STAT = "DbQueueStat";
|
||||
const char * const name_DB_REP_STAT = "DbRepStat";
|
||||
const char * const name_DB_RUNRECOVERY_EX = "DbRunRecoveryException";
|
||||
const char * const name_DBT = "Dbt";
|
||||
const char * const name_DB_TXN = "DbTxn";
|
||||
const char * const name_DB_TXN_STAT = "DbTxnStat";
|
||||
const char * const name_DB_TXN_STAT_ACTIVE = "DbTxnStat$Active";
|
||||
const char * const name_DB_UTIL = "DbUtil";
|
||||
const char * const name_DbAppendRecno = "DbAppendRecno";
|
||||
const char * const name_DbBtreeCompare = "DbBtreeCompare";
|
||||
const char * const name_DbBtreePrefix = "DbBtreePrefix";
|
||||
@ -50,24 +53,84 @@ const char * const name_DbDupCompare = "DbDupCompare";
|
||||
const char * const name_DbEnvFeedback = "DbEnvFeedback";
|
||||
const char * const name_DbErrcall = "DbErrcall";
|
||||
const char * const name_DbHash = "DbHash";
|
||||
const char * const name_DbLockRequest = "DbLockRequest";
|
||||
const char * const name_DbFeedback = "DbFeedback";
|
||||
const char * const name_DbRecoveryInit = "DbRecoveryInit";
|
||||
const char * const name_DbRepTransport = "DbRepTransport";
|
||||
const char * const name_DbSecondaryKeyCreate = "DbSecondaryKeyCreate";
|
||||
const char * const name_DbTxnRecover = "DbTxnRecover";
|
||||
const char * const name_RepElectResult = "DbEnv$RepElectResult";
|
||||
const char * const name_RepProcessMessage = "DbEnv$RepProcessMessage";
|
||||
|
||||
const char * const string_signature = "Ljava/lang/String;";
|
||||
|
||||
jfieldID fid_Dbt_data;
|
||||
jfieldID fid_Dbt_offset;
|
||||
jfieldID fid_Dbt_size;
|
||||
jfieldID fid_Dbt_ulen;
|
||||
jfieldID fid_Dbt_dlen;
|
||||
jfieldID fid_Dbt_doff;
|
||||
jfieldID fid_Dbt_flags;
|
||||
jfieldID fid_Dbt_private_dbobj_;
|
||||
jfieldID fid_Dbt_must_create_data;
|
||||
jfieldID fid_DbLockRequest_op;
|
||||
jfieldID fid_DbLockRequest_mode;
|
||||
jfieldID fid_DbLockRequest_timeout;
|
||||
jfieldID fid_DbLockRequest_obj;
|
||||
jfieldID fid_DbLockRequest_lock;
|
||||
jfieldID fid_RepProcessMessage_envid;
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
* Utility functions used by "glue" functions.
|
||||
*
|
||||
*/
|
||||
|
||||
/* Get the private data from a Db* object that points back to a C DB_* object.
|
||||
/*
|
||||
* Do any one time initialization, especially initializing any
|
||||
* unchanging methodIds, fieldIds, etc.
|
||||
*/
|
||||
void one_time_init(JNIEnv *jnienv)
|
||||
{
|
||||
jclass cl;
|
||||
|
||||
if ((cl = get_class(jnienv, name_DBT)) == NULL)
|
||||
return; /* An exception has been posted. */
|
||||
fid_Dbt_data = (*jnienv)->GetFieldID(jnienv, cl, "data", "[B");
|
||||
fid_Dbt_offset = (*jnienv)->GetFieldID(jnienv, cl, "offset", "I");
|
||||
fid_Dbt_size = (*jnienv)->GetFieldID(jnienv, cl, "size", "I");
|
||||
fid_Dbt_ulen = (*jnienv)->GetFieldID(jnienv, cl, "ulen", "I");
|
||||
fid_Dbt_dlen = (*jnienv)->GetFieldID(jnienv, cl, "dlen", "I");
|
||||
fid_Dbt_doff = (*jnienv)->GetFieldID(jnienv, cl, "doff", "I");
|
||||
fid_Dbt_flags = (*jnienv)->GetFieldID(jnienv, cl, "flags", "I");
|
||||
fid_Dbt_must_create_data = (*jnienv)->GetFieldID(jnienv, cl,
|
||||
"must_create_data", "Z");
|
||||
fid_Dbt_private_dbobj_ =
|
||||
(*jnienv)->GetFieldID(jnienv, cl, "private_dbobj_", "J");
|
||||
|
||||
if ((cl = get_class(jnienv, name_DbLockRequest)) == NULL)
|
||||
return; /* An exception has been posted. */
|
||||
fid_DbLockRequest_op = (*jnienv)->GetFieldID(jnienv, cl, "op", "I");
|
||||
fid_DbLockRequest_mode = (*jnienv)->GetFieldID(jnienv, cl, "mode", "I");
|
||||
fid_DbLockRequest_timeout =
|
||||
(*jnienv)->GetFieldID(jnienv, cl, "timeout", "I");
|
||||
fid_DbLockRequest_obj = (*jnienv)->GetFieldID(jnienv, cl, "obj",
|
||||
"Lcom/sleepycat/db/Dbt;");
|
||||
fid_DbLockRequest_lock = (*jnienv)->GetFieldID(jnienv, cl, "lock",
|
||||
"Lcom/sleepycat/db/DbLock;");
|
||||
|
||||
if ((cl = get_class(jnienv, name_RepProcessMessage)) == NULL)
|
||||
return; /* An exception has been posted. */
|
||||
fid_RepProcessMessage_envid =
|
||||
(*jnienv)->GetFieldID(jnienv, cl, "envid", "I");
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the private data from a Db* object that points back to a C DB_* object.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
void *get_private_dbobj(JNIEnv *jnienv, const char *classname,
|
||||
jobject obj)
|
||||
jobject obj)
|
||||
{
|
||||
jclass dbClass;
|
||||
jfieldID id;
|
||||
@ -76,18 +139,20 @@ void *get_private_dbobj(JNIEnv *jnienv, const char *classname,
|
||||
if (!obj)
|
||||
return (0);
|
||||
|
||||
dbClass = get_class(jnienv, classname);
|
||||
if ((dbClass = get_class(jnienv, classname)) == NULL)
|
||||
return (NULL); /* An exception has been posted. */
|
||||
id = (*jnienv)->GetFieldID(jnienv, dbClass, "private_dbobj_", "J");
|
||||
lp.java_long = (*jnienv)->GetLongField(jnienv, obj, id);
|
||||
return (lp.ptr);
|
||||
}
|
||||
|
||||
/* Set the private data in a Db* object that points back to a C DB_* object.
|
||||
/*
|
||||
* Set the private data in a Db* object that points back to a C DB_* object.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
void set_private_dbobj(JNIEnv *jnienv, const char *classname,
|
||||
jobject obj, void *value)
|
||||
jobject obj, void *value)
|
||||
{
|
||||
long_to_ptr lp;
|
||||
jclass dbClass;
|
||||
@ -95,12 +160,14 @@ void set_private_dbobj(JNIEnv *jnienv, const char *classname,
|
||||
|
||||
lp.java_long = 0; /* no junk in case sizes mismatch */
|
||||
lp.ptr = value;
|
||||
dbClass = get_class(jnienv, classname);
|
||||
if ((dbClass = get_class(jnienv, classname)) == NULL)
|
||||
return; /* An exception has been posted. */
|
||||
id = (*jnienv)->GetFieldID(jnienv, dbClass, "private_dbobj_", "J");
|
||||
(*jnienv)->SetLongField(jnienv, obj, id, lp.java_long);
|
||||
}
|
||||
|
||||
/* Get the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
/*
|
||||
* Get the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
@ -112,15 +179,17 @@ void *get_private_info(JNIEnv *jnienv, const char *classname,
|
||||
long_to_ptr lp;
|
||||
|
||||
if (!obj)
|
||||
return (0);
|
||||
return (NULL);
|
||||
|
||||
dbClass = get_class(jnienv, classname);
|
||||
if ((dbClass = get_class(jnienv, classname)) == NULL)
|
||||
return (NULL); /* An exception has been posted. */
|
||||
id = (*jnienv)->GetFieldID(jnienv, dbClass, "private_info_", "J");
|
||||
lp.java_long = (*jnienv)->GetLongField(jnienv, obj, id);
|
||||
return (lp.ptr);
|
||||
}
|
||||
|
||||
/* Set the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
/*
|
||||
* Set the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
@ -133,7 +202,8 @@ void set_private_info(JNIEnv *jnienv, const char *classname,
|
||||
|
||||
lp.java_long = 0; /* no junk in case sizes mismatch */
|
||||
lp.ptr = value;
|
||||
dbClass = get_class(jnienv, classname);
|
||||
if ((dbClass = get_class(jnienv, classname)) == NULL)
|
||||
return; /* An exception has been posted. */
|
||||
id = (*jnienv)->GetFieldID(jnienv, dbClass, "private_info_", "J");
|
||||
(*jnienv)->SetLongField(jnienv, obj, id, lp.java_long);
|
||||
}
|
||||
@ -144,19 +214,48 @@ void set_private_info(JNIEnv *jnienv, const char *classname,
|
||||
*/
|
||||
jclass get_class(JNIEnv *jnienv, const char *classname)
|
||||
{
|
||||
/* Note: PERFORMANCE: It should be possible to cache jclass's.
|
||||
/*
|
||||
* Note: PERFORMANCE: It should be possible to cache jclass's.
|
||||
* If we do a NewGlobalRef on each one, we can keep them
|
||||
* around in a table. A jclass is a jobject, and
|
||||
* since NewGlobalRef returns a jobject, it isn't
|
||||
* technically right, but it would likely work with
|
||||
* most implementations. Possibly make it configurable.
|
||||
*/
|
||||
char fullname[128] = DB_PACKAGE_NAME;
|
||||
strncat(fullname, classname, sizeof(fullname));
|
||||
char fullname[128];
|
||||
|
||||
(void)snprintf(fullname, sizeof(fullname),
|
||||
"%s%s", DB_PACKAGE_NAME, classname);
|
||||
return ((*jnienv)->FindClass(jnienv, fullname));
|
||||
}
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Given a fully qualified name (e.g. "java.util.Hashtable")
|
||||
* return the jclass object. If it can't be found, an
|
||||
* exception is raised and NULL is return.
|
||||
* This is appropriate to be used for classes that may
|
||||
* not be present.
|
||||
*/
|
||||
jclass get_fully_qualified_class(JNIEnv *jnienv, const char *classname)
|
||||
{
|
||||
jclass result;
|
||||
|
||||
result = ((*jnienv)->FindClass(jnienv, classname));
|
||||
if (result == NULL) {
|
||||
jclass cnfe;
|
||||
char message[1024];
|
||||
|
||||
cnfe = (*jnienv)->FindClass(jnienv,
|
||||
"java/lang/ClassNotFoundException");
|
||||
strncpy(message, classname, sizeof(message));
|
||||
strncat(message, ": class not found", sizeof(message));
|
||||
(*jnienv)->ThrowNew(jnienv, cnfe, message);
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be a DB object type.
|
||||
*/
|
||||
void set_object_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
@ -166,36 +265,39 @@ void set_object_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
char signature[512];
|
||||
jfieldID id;
|
||||
|
||||
strncpy(signature, "L", sizeof(signature));
|
||||
strncat(signature, DB_PACKAGE_NAME, sizeof(signature));
|
||||
strncat(signature, object_classname, sizeof(signature));
|
||||
strncat(signature, ";", sizeof(signature));
|
||||
|
||||
id = (*jnienv)->GetFieldID(jnienv, class_of_this, name_of_field, signature);
|
||||
(void)snprintf(signature, sizeof(signature),
|
||||
"L%s%s;", DB_PACKAGE_NAME, object_classname);
|
||||
id = (*jnienv)->GetFieldID(
|
||||
jnienv, class_of_this, name_of_field, signature);
|
||||
(*jnienv)->SetObjectField(jnienv, jthis, id, obj);
|
||||
}
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be an integer type.
|
||||
*/
|
||||
void set_int_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
jobject jthis, const char *name_of_field, jint value)
|
||||
{
|
||||
jfieldID id = (*jnienv)->GetFieldID(jnienv, class_of_this, name_of_field, "I");
|
||||
jfieldID id =
|
||||
(*jnienv)->GetFieldID(jnienv, class_of_this, name_of_field, "I");
|
||||
(*jnienv)->SetIntField(jnienv, jthis, id, value);
|
||||
}
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be an integer type.
|
||||
*/
|
||||
void set_long_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
jobject jthis, const char *name_of_field, jlong value)
|
||||
{
|
||||
jfieldID id = (*jnienv)->GetFieldID(jnienv, class_of_this, name_of_field, "J");
|
||||
jfieldID id = (*jnienv)->GetFieldID(jnienv, class_of_this,
|
||||
name_of_field, "J");
|
||||
(*jnienv)->SetLongField(jnienv, jthis, id, value);
|
||||
}
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be an integer type.
|
||||
*/
|
||||
void set_lsn_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
@ -205,89 +307,144 @@ void set_lsn_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
name_of_field, get_DbLsn(jnienv, value));
|
||||
}
|
||||
|
||||
/* Report an exception back to the java side.
|
||||
/*
|
||||
* Report an exception back to the java side.
|
||||
*/
|
||||
void report_exception(JNIEnv *jnienv, const char *text, int err,
|
||||
unsigned long expect_mask)
|
||||
void report_exception(JNIEnv *jnienv, const char *text,
|
||||
int err, unsigned long expect_mask)
|
||||
{
|
||||
jstring textString;
|
||||
jclass dbexcept;
|
||||
jclass javaexcept;
|
||||
jmethodID constructId;
|
||||
jthrowable obj;
|
||||
|
||||
textString = NULL;
|
||||
dbexcept = NULL;
|
||||
javaexcept = NULL;
|
||||
constructId = NULL;
|
||||
obj = NULL;
|
||||
|
||||
switch (err) {
|
||||
/* DB_JAVA_CALLBACK is returned by dbji_call_append_recno()
|
||||
* (the append_recno callback) when the Java version of the
|
||||
* callback has thrown an exception, and we want to pass the
|
||||
* exception on. The exception has already been thrown, we
|
||||
/*
|
||||
* DB_JAVA_CALLBACK is returned by
|
||||
* dbji_call_append_recno() (the append_recno callback)
|
||||
* when the Java version of the callback has thrown
|
||||
* an exception, and we want to pass the exception on.
|
||||
* The exception has already been thrown, we
|
||||
* don't want to throw a new one.
|
||||
*/
|
||||
case DB_JAVA_CALLBACK:
|
||||
break;
|
||||
case ENOMEM:
|
||||
dbexcept = get_class(jnienv, name_DB_MEMORY_EX);
|
||||
break;
|
||||
case ENOENT:
|
||||
/* In this case there is a corresponding standard java
|
||||
* exception type that we'll use. First we make sure
|
||||
* that the calling function expected this kind of error,
|
||||
* if not we give an 'internal error' DbException, since
|
||||
* we must not throw an exception type that isn't
|
||||
* declared in the signature.
|
||||
*
|
||||
* We'll make this a little more general if/when we add
|
||||
* more java standard exceptions.
|
||||
*/
|
||||
if ((expect_mask & EXCEPTION_FILE_NOT_FOUND) == 0) {
|
||||
char errstr[1024];
|
||||
case DB_JAVA_CALLBACK:
|
||||
break;
|
||||
case ENOENT:
|
||||
/*
|
||||
* In this case there is a corresponding
|
||||
* standard java exception type that we'll use.
|
||||
* First we make sure that the calling function
|
||||
* expected this kind of error, if not we give
|
||||
* an 'internal error' DbException, since
|
||||
* we must not throw an exception type that isn't
|
||||
* declared in the signature.
|
||||
*
|
||||
* We'll make this a little more general if/when
|
||||
* we add more java standard exceptions.
|
||||
*/
|
||||
if ((expect_mask & EXCEPTION_FILE_NOT_FOUND) != 0) {
|
||||
javaexcept = (*jnienv)->FindClass(jnienv,
|
||||
"java/io/FileNotFoundException");
|
||||
}
|
||||
else {
|
||||
char errstr[1024];
|
||||
|
||||
strncpy(errstr, "internal error: unexpected errno: ",
|
||||
sizeof(errstr));
|
||||
strncat(errstr, text, sizeof(errstr));
|
||||
textString = get_java_string(jnienv, errstr);
|
||||
snprintf(errstr, sizeof(errstr),
|
||||
"internal error: unexpected errno: %s",
|
||||
text);
|
||||
textString = get_java_string(jnienv,
|
||||
errstr);
|
||||
dbexcept = get_class(jnienv,
|
||||
name_DB_EXCEPTION);
|
||||
}
|
||||
break;
|
||||
case DB_RUNRECOVERY:
|
||||
dbexcept = get_class(jnienv,
|
||||
name_DB_RUNRECOVERY_EX);
|
||||
break;
|
||||
case DB_LOCK_DEADLOCK:
|
||||
dbexcept = get_class(jnienv, name_DB_DEADLOCK_EX);
|
||||
break;
|
||||
default:
|
||||
dbexcept = get_class(jnienv, name_DB_EXCEPTION);
|
||||
}
|
||||
else {
|
||||
javaexcept =
|
||||
(*jnienv)->FindClass(jnienv, "java/io/FileNotFoundException");
|
||||
}
|
||||
break;
|
||||
case DB_RUNRECOVERY:
|
||||
dbexcept = get_class(jnienv, name_DB_RUNRECOVERY_EX);
|
||||
break;
|
||||
case DB_LOCK_DEADLOCK:
|
||||
dbexcept = get_class(jnienv, name_DB_DEADLOCK_EX);
|
||||
break;
|
||||
default:
|
||||
dbexcept = get_class(jnienv, name_DB_EXCEPTION);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
if (dbexcept != NULL) {
|
||||
if (textString == NULL)
|
||||
textString = get_java_string(jnienv, text);
|
||||
constructId = (*jnienv)->GetMethodID(jnienv, dbexcept,
|
||||
"<init>",
|
||||
"(Ljava/lang/String;I)V");
|
||||
obj = (jthrowable)(*jnienv)->NewObject(jnienv, dbexcept,
|
||||
constructId, textString,
|
||||
err);
|
||||
(*jnienv)->Throw(jnienv, obj);
|
||||
if ((obj = create_exception(jnienv, textString, err, dbexcept))
|
||||
!= NULL)
|
||||
(*jnienv)->Throw(jnienv, obj);
|
||||
/* Otherwise, an exception has been posted. */
|
||||
}
|
||||
else if (javaexcept != NULL) {
|
||||
javaexcept =
|
||||
(*jnienv)->FindClass(jnienv, "java/io/FileNotFoundException");
|
||||
else if (javaexcept != NULL)
|
||||
(*jnienv)->ThrowNew(jnienv, javaexcept, text);
|
||||
}
|
||||
else
|
||||
fprintf(stderr,
|
||||
"report_exception: failed to create an exception\n");
|
||||
}
|
||||
|
||||
/* Report an error via the errcall mechanism.
|
||||
/*
|
||||
* Report an exception back to the java side, for the specific
|
||||
* case of DB_LOCK_NOTGRANTED, as more things are added to the
|
||||
* constructor of this type of exception.
|
||||
*/
|
||||
void report_notgranted_exception(JNIEnv *jnienv, const char *text,
|
||||
db_lockop_t op, db_lockmode_t mode,
|
||||
jobject jdbt, jobject jlock, int index)
|
||||
{
|
||||
jstring textString;
|
||||
jclass dbexcept;
|
||||
jthrowable obj;
|
||||
jmethodID mid;
|
||||
|
||||
if ((dbexcept = get_class(jnienv, name_DB_LOCKNOTGRANTED_EX)) == NULL)
|
||||
return; /* An exception has been posted. */
|
||||
textString = get_java_string(jnienv, text);
|
||||
|
||||
mid = (*jnienv)->GetMethodID(jnienv, dbexcept, "<init>",
|
||||
"(Ljava/lang/String;II"
|
||||
"Lcom/sleepycat/db/Dbt;"
|
||||
"Lcom/sleepycat/db/DbLock;I)V");
|
||||
if ((obj = (jthrowable)(*jnienv)->NewObject(jnienv, dbexcept,
|
||||
mid, textString, op, mode, jdbt, jlock, index)) != NULL)
|
||||
(*jnienv)->Throw(jnienv, obj);
|
||||
else
|
||||
fprintf(stderr,
|
||||
"report_notgranted_exception: failed to create an exception\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an exception object and return it.
|
||||
* The given class must have a constructor that has a
|
||||
* constructor with args (java.lang.String text, int errno);
|
||||
* DbException and its subclasses fit this bill.
|
||||
*/
|
||||
jobject create_exception(JNIEnv *jnienv, jstring text,
|
||||
int err, jclass dbexcept)
|
||||
{
|
||||
jthrowable obj;
|
||||
jmethodID mid;
|
||||
|
||||
mid = (*jnienv)->GetMethodID(jnienv, dbexcept, "<init>",
|
||||
"(Ljava/lang/String;I)V");
|
||||
if (mid != NULL)
|
||||
obj = (jthrowable)(*jnienv)->NewObject(jnienv, dbexcept, mid,
|
||||
text, err);
|
||||
else {
|
||||
fprintf(stderr, "Cannot get exception init method ID!\n");
|
||||
obj = NULL;
|
||||
}
|
||||
|
||||
return (obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report an error via the errcall mechanism.
|
||||
*/
|
||||
void report_errcall(JNIEnv *jnienv, jobject errcall,
|
||||
jstring prefix, const char *message)
|
||||
@ -296,7 +453,8 @@ void report_errcall(JNIEnv *jnienv, jobject errcall,
|
||||
jclass errcall_class;
|
||||
jstring msg;
|
||||
|
||||
errcall_class = get_class(jnienv, name_DbErrcall);
|
||||
if ((errcall_class = get_class(jnienv, name_DbErrcall)) == NULL)
|
||||
return; /* An exception has been posted. */
|
||||
msg = get_java_string(jnienv, message);
|
||||
|
||||
id = (*jnienv)->GetMethodID(jnienv, errcall_class,
|
||||
@ -311,7 +469,8 @@ void report_errcall(JNIEnv *jnienv, jobject errcall,
|
||||
(*jnienv)->CallVoidMethod(jnienv, errcall, id, prefix, msg);
|
||||
}
|
||||
|
||||
/* If the object is null, report an exception and return false (0),
|
||||
/*
|
||||
* If the object is null, report an exception and return false (0),
|
||||
* otherwise return true (1).
|
||||
*/
|
||||
int verify_non_null(JNIEnv *jnienv, void *obj)
|
||||
@ -323,29 +482,70 @@ int verify_non_null(JNIEnv *jnienv, void *obj)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* If the error code is non-zero, report an exception and return false (0),
|
||||
/*
|
||||
* If the error code is non-zero, report an exception and return false (0),
|
||||
* otherwise return true (1).
|
||||
*/
|
||||
int verify_return(JNIEnv *jnienv, int err, unsigned long expect_mask)
|
||||
{
|
||||
if (err == 0)
|
||||
return 1;
|
||||
return (1);
|
||||
|
||||
report_exception(jnienv, db_strerror(err), err, expect_mask);
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Create an object of the given class, calling its default constructor.
|
||||
/*
|
||||
* Verify that there was no memory error due to undersized Dbt.
|
||||
* If there is report a DbMemoryException, with the Dbt attached
|
||||
* and return false (0), otherwise return true (1).
|
||||
*/
|
||||
int verify_dbt(JNIEnv *jnienv, int err, LOCKED_DBT *ldbt)
|
||||
{
|
||||
DBT *dbt;
|
||||
jobject exception;
|
||||
jstring text;
|
||||
jclass dbexcept;
|
||||
jmethodID mid;
|
||||
|
||||
if (err != ENOMEM)
|
||||
return (1);
|
||||
|
||||
dbt = &ldbt->javainfo->dbt;
|
||||
if (!F_ISSET(dbt, DB_DBT_USERMEM) || dbt->size <= dbt->ulen)
|
||||
return (1);
|
||||
|
||||
/* Create/throw an exception of type DbMemoryException */
|
||||
if ((dbexcept = get_class(jnienv, name_DB_MEMORY_EX)) == NULL)
|
||||
return (1); /* An exception has been posted. */
|
||||
text = get_java_string(jnienv,
|
||||
"Dbt not large enough for available data");
|
||||
exception = create_exception(jnienv, text, ENOMEM, dbexcept);
|
||||
|
||||
/* Attach the dbt to the exception */
|
||||
mid = (*jnienv)->GetMethodID(jnienv, dbexcept, "set_dbt",
|
||||
"(L" DB_PACKAGE_NAME "Dbt;)V");
|
||||
(*jnienv)->CallVoidMethod(jnienv, exception, mid, ldbt->jdbt);
|
||||
(*jnienv)->Throw(jnienv, exception);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an object of the given class, calling its default constructor.
|
||||
*/
|
||||
jobject create_default_object(JNIEnv *jnienv, const char *class_name)
|
||||
{
|
||||
jclass dbclass = get_class(jnienv, class_name);
|
||||
jmethodID id = (*jnienv)->GetMethodID(jnienv, dbclass, "<init>", "()V");
|
||||
jobject object = (*jnienv)->NewObject(jnienv, dbclass, id);
|
||||
return (object);
|
||||
jmethodID id;
|
||||
jclass dbclass;
|
||||
|
||||
if ((dbclass = get_class(jnienv, class_name)) == NULL)
|
||||
return (NULL); /* An exception has been posted. */
|
||||
id = (*jnienv)->GetMethodID(jnienv, dbclass, "<init>", "()V");
|
||||
return ((*jnienv)->NewObject(jnienv, dbclass, id));
|
||||
}
|
||||
|
||||
/* Convert an DB object to a Java encapsulation of that object.
|
||||
/*
|
||||
* Convert an DB object to a Java encapsulation of that object.
|
||||
* Note: This implementation creates a new Java object on each call,
|
||||
* so it is generally useful when a new DB object has just been created.
|
||||
*/
|
||||
@ -361,20 +561,24 @@ jobject convert_object(JNIEnv *jnienv, const char *class_name, void *dbobj)
|
||||
return (jo);
|
||||
}
|
||||
|
||||
/* Create a copy of the string
|
||||
/*
|
||||
* Create a copy of the string
|
||||
*/
|
||||
char *dup_string(const char *str)
|
||||
{
|
||||
int len;
|
||||
char *retval;
|
||||
int err;
|
||||
|
||||
len = strlen(str) + 1;
|
||||
retval = (char *)malloc(sizeof(char)*len);
|
||||
if ((err = __os_malloc(NULL, sizeof(char)*len, &retval)) != 0)
|
||||
return (NULL);
|
||||
strncpy(retval, str, len);
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/* Create a java string from the given string
|
||||
/*
|
||||
* Create a java string from the given string
|
||||
*/
|
||||
jstring get_java_string(JNIEnv *jnienv, const char* string)
|
||||
{
|
||||
@ -383,21 +587,23 @@ jstring get_java_string(JNIEnv *jnienv, const char* string)
|
||||
return ((*jnienv)->NewStringUTF(jnienv, string));
|
||||
}
|
||||
|
||||
/* Create a malloc'ed copy of the java string.
|
||||
/*
|
||||
* Create a copy of the java string using __os_malloc.
|
||||
* Caller must free it.
|
||||
*/
|
||||
char *get_c_string(JNIEnv *jnienv, jstring jstr)
|
||||
{
|
||||
const jbyte *utf;
|
||||
const char *utf;
|
||||
char *retval;
|
||||
|
||||
utf = (*jnienv)->GetStringUTFChars(jnienv, jstr, NULL);
|
||||
retval = dup_string((const char *)utf);
|
||||
retval = dup_string(utf);
|
||||
(*jnienv)->ReleaseStringUTFChars(jnienv, jstr, utf);
|
||||
return retval;
|
||||
return (retval);
|
||||
}
|
||||
|
||||
/* Convert a java object to the various C pointers they represent.
|
||||
/*
|
||||
* Convert a java object to the various C pointers they represent.
|
||||
*/
|
||||
DB *get_DB(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
@ -406,7 +612,8 @@ DB *get_DB(JNIEnv *jnienv, jobject obj)
|
||||
|
||||
DB_BTREE_STAT *get_DB_BTREE_STAT(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_BTREE_STAT *)get_private_dbobj(jnienv, name_DB_BTREE_STAT, obj));
|
||||
return ((DB_BTREE_STAT *)
|
||||
get_private_dbobj(jnienv, name_DB_BTREE_STAT, obj));
|
||||
}
|
||||
|
||||
DBC *get_DBC(JNIEnv *jnienv, jobject obj)
|
||||
@ -426,7 +633,8 @@ DB_ENV_JAVAINFO *get_DB_ENV_JAVAINFO(JNIEnv *jnienv, jobject obj)
|
||||
|
||||
DB_HASH_STAT *get_DB_HASH_STAT(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_HASH_STAT *)get_private_dbobj(jnienv, name_DB_HASH_STAT, obj));
|
||||
return ((DB_HASH_STAT *)
|
||||
get_private_dbobj(jnienv, name_DB_HASH_STAT, obj));
|
||||
}
|
||||
|
||||
DB_JAVAINFO *get_DB_JAVAINFO(JNIEnv *jnienv, jobject obj)
|
||||
@ -439,29 +647,71 @@ DB_LOCK *get_DB_LOCK(JNIEnv *jnienv, jobject obj)
|
||||
return ((DB_LOCK *)get_private_dbobj(jnienv, name_DB_LOCK, obj));
|
||||
}
|
||||
|
||||
DB_LOG_STAT *get_DB_LOG_STAT(JNIEnv *jnienv, jobject obj)
|
||||
DB_LOGC *get_DB_LOGC(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_LOG_STAT *)get_private_dbobj(jnienv, name_DB_LOG_STAT, obj));
|
||||
return ((DB_LOGC *)get_private_dbobj(jnienv, name_DB_LOGC, obj));
|
||||
}
|
||||
|
||||
DB_LSN *get_DB_LSN(JNIEnv *jnienv, jobject obj)
|
||||
DB_LOG_STAT *get_DB_LOG_STAT(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_LSN *)get_private_dbobj(jnienv, name_DB_LSN, obj));
|
||||
return ((DB_LOG_STAT *)
|
||||
get_private_dbobj(jnienv, name_DB_LOG_STAT, obj));
|
||||
}
|
||||
|
||||
DB_LSN *get_DB_LSN(JNIEnv *jnienv, /* DbLsn */ jobject obj) {
|
||||
/*
|
||||
* DbLsns that are created from within java (new DbLsn()) rather
|
||||
* than from within C (get_DbLsn()) may not have a "private" DB_LSN
|
||||
* structure allocated for them yet. We can't do this in the
|
||||
* actual constructor (init_lsn()), because there's no way to pass
|
||||
* in an initializing value in, and because the get_DbLsn()/
|
||||
* convert_object() code path needs a copy of the pointer before
|
||||
* the constructor gets called. Thus, get_DbLsn() allocates and
|
||||
* fills a DB_LSN for the object it's about to create.
|
||||
*
|
||||
* Since "new DbLsn()" may reasonably be passed as an argument to
|
||||
* functions such as DbEnv.log_put(), though, we need to make sure
|
||||
* that DB_LSN's get allocated when the object was created from
|
||||
* Java, too. Here, we lazily allocate a new private DB_LSN if
|
||||
* and only if it turns out that we don't already have one.
|
||||
*
|
||||
* The only exception is if the DbLsn object is a Java null
|
||||
* (in which case the jobject will also be NULL). Then a NULL
|
||||
* DB_LSN is legitimate.
|
||||
*/
|
||||
DB_LSN *lsnp;
|
||||
int err;
|
||||
|
||||
if (obj == NULL)
|
||||
return (NULL);
|
||||
|
||||
lsnp = (DB_LSN *)get_private_dbobj(jnienv, name_DB_LSN, obj);
|
||||
if (lsnp == NULL) {
|
||||
if ((err = __os_malloc(NULL, sizeof(DB_LSN), &lsnp)) != 0)
|
||||
return (NULL);
|
||||
memset(lsnp, 0, sizeof(DB_LSN));
|
||||
set_private_dbobj(jnienv, name_DB_LSN, obj, lsnp);
|
||||
}
|
||||
|
||||
return (lsnp);
|
||||
}
|
||||
|
||||
DB_MPOOL_FSTAT *get_DB_MPOOL_FSTAT(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_MPOOL_FSTAT *)get_private_dbobj(jnienv, name_DB_MPOOL_FSTAT, obj));
|
||||
return ((DB_MPOOL_FSTAT *)
|
||||
get_private_dbobj(jnienv, name_DB_MPOOL_FSTAT, obj));
|
||||
}
|
||||
|
||||
DB_MPOOL_STAT *get_DB_MPOOL_STAT(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_MPOOL_STAT *)get_private_dbobj(jnienv, name_DB_MPOOL_STAT, obj));
|
||||
return ((DB_MPOOL_STAT *)
|
||||
get_private_dbobj(jnienv, name_DB_MPOOL_STAT, obj));
|
||||
}
|
||||
|
||||
DB_QUEUE_STAT *get_DB_QUEUE_STAT(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_QUEUE_STAT *)get_private_dbobj(jnienv, name_DB_QUEUE_STAT, obj));
|
||||
return ((DB_QUEUE_STAT *)
|
||||
get_private_dbobj(jnienv, name_DB_QUEUE_STAT, obj));
|
||||
}
|
||||
|
||||
DB_TXN *get_DB_TXN(JNIEnv *jnienv, jobject obj)
|
||||
@ -471,7 +721,8 @@ DB_TXN *get_DB_TXN(JNIEnv *jnienv, jobject obj)
|
||||
|
||||
DB_TXN_STAT *get_DB_TXN_STAT(JNIEnv *jnienv, jobject obj)
|
||||
{
|
||||
return ((DB_TXN_STAT *)get_private_dbobj(jnienv, name_DB_TXN_STAT, obj));
|
||||
return ((DB_TXN_STAT *)
|
||||
get_private_dbobj(jnienv, name_DB_TXN_STAT, obj));
|
||||
}
|
||||
|
||||
DBT *get_DBT(JNIEnv *jnienv, jobject obj)
|
||||
@ -490,7 +741,8 @@ DBT_JAVAINFO *get_DBT_JAVAINFO(JNIEnv *jnienv, jobject obj)
|
||||
return ((DBT_JAVAINFO *)get_private_dbobj(jnienv, name_DBT, obj));
|
||||
}
|
||||
|
||||
/* Convert a C pointer to the various Java objects they represent.
|
||||
/*
|
||||
* Convert a C pointer to the various Java objects they represent.
|
||||
*/
|
||||
jobject get_DbBtreeStat(JNIEnv *jnienv, DB_BTREE_STAT *dbobj)
|
||||
{
|
||||
@ -507,27 +759,109 @@ jobject get_DbHashStat(JNIEnv *jnienv, DB_HASH_STAT *dbobj)
|
||||
return (convert_object(jnienv, name_DB_HASH_STAT, dbobj));
|
||||
}
|
||||
|
||||
jobject get_DbLogc(JNIEnv *jnienv, DB_LOGC *dbobj)
|
||||
{
|
||||
return (convert_object(jnienv, name_DB_LOGC, dbobj));
|
||||
}
|
||||
|
||||
jobject get_DbLogStat(JNIEnv *jnienv, DB_LOG_STAT *dbobj)
|
||||
{
|
||||
return (convert_object(jnienv, name_DB_LOG_STAT, dbobj));
|
||||
}
|
||||
|
||||
/* LSNs are different since they are really normally
|
||||
/*
|
||||
* LSNs are different since they are really normally
|
||||
* treated as by-value objects. We actually create
|
||||
* a pointer to the LSN and store that, deleting it
|
||||
* when the LSN is GC'd.
|
||||
*/
|
||||
jobject get_DbLsn(JNIEnv *jnienv, DB_LSN dbobj)
|
||||
{
|
||||
DB_LSN *lsnp = (DB_LSN *)malloc(sizeof(DB_LSN));
|
||||
DB_LSN *lsnp;
|
||||
int err;
|
||||
|
||||
if ((err = __os_malloc(NULL, sizeof(DB_LSN), &lsnp)) != 0)
|
||||
return (NULL);
|
||||
|
||||
memset(lsnp, 0, sizeof(DB_LSN));
|
||||
*lsnp = dbobj;
|
||||
return (convert_object(jnienv, name_DB_LSN, lsnp));
|
||||
}
|
||||
|
||||
jobject get_Dbt(JNIEnv *jnienv, DBT *dbt)
|
||||
/*
|
||||
* Shared code for get_Dbt and get_const_Dbt.
|
||||
*
|
||||
* XXX
|
||||
* Currently we make no distinction in implementation of these
|
||||
* two kinds of Dbts, although in the future we may want to.
|
||||
* (It's probably easier to make the optimizations listed below
|
||||
* with readonly Dbts).
|
||||
*
|
||||
* Dbt's created via this function are only used for a short lifetime,
|
||||
* during callback functions. In the future, we should consider taking
|
||||
* advantage of this by having a pool of Dbt objects instead of creating
|
||||
* new ones each time. Because of multithreading, we may need an
|
||||
* arbitrary number. We might also have sharing of the byte arrays
|
||||
* used by the Dbts.
|
||||
*/
|
||||
static jobject get_Dbt_shared(JNIEnv *jnienv, const DBT *dbt, int readonly,
|
||||
DBT_JAVAINFO **ret_info)
|
||||
{
|
||||
return (convert_object(jnienv, name_DBT, dbt));
|
||||
jobject jdbt;
|
||||
DBT_JAVAINFO *dbtji;
|
||||
|
||||
COMPQUIET(readonly, 0);
|
||||
|
||||
/* A NULL DBT should become a null Dbt. */
|
||||
if (dbt == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Note that a side effect of creating a Dbt object
|
||||
* is the creation of the attached DBT_JAVAINFO object
|
||||
* (see the native implementation of Dbt.init())
|
||||
* A DBT_JAVAINFO object contains its own DBT.
|
||||
*/
|
||||
jdbt = create_default_object(jnienv, name_DBT);
|
||||
dbtji = get_DBT_JAVAINFO(jnienv, jdbt);
|
||||
memcpy(&dbtji->dbt, dbt, sizeof(DBT));
|
||||
|
||||
/*
|
||||
* Set the boolean indicator so that the Java side knows to
|
||||
* call back when it wants to look at the array. This avoids
|
||||
* needlessly creating/copying arrays that may never be looked at.
|
||||
*/
|
||||
(*jnienv)->SetBooleanField(jnienv, jdbt, fid_Dbt_must_create_data, 1);
|
||||
(*jnienv)->SetIntField(jnienv, jdbt, fid_Dbt_size, dbt->size);
|
||||
|
||||
if (ret_info != NULL)
|
||||
*ret_info = dbtji;
|
||||
return (jdbt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a writeable Dbt.
|
||||
*
|
||||
* Currently we're sharing code with get_const_Dbt.
|
||||
* It really shouldn't be this way, we have a DBT that we can
|
||||
* change, and have some mechanism for copying back
|
||||
* any changes to the original DBT.
|
||||
*/
|
||||
jobject get_Dbt(JNIEnv *jnienv, DBT *dbt,
|
||||
DBT_JAVAINFO **ret_info)
|
||||
{
|
||||
return (get_Dbt_shared(jnienv, dbt, 0, ret_info));
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a Dbt that we promise not to change, or at least
|
||||
* if there are changes, they don't matter and won't get
|
||||
* seen by anyone.
|
||||
*/
|
||||
jobject get_const_Dbt(JNIEnv *jnienv, const DBT *dbt,
|
||||
DBT_JAVAINFO **ret_info)
|
||||
{
|
||||
return (get_Dbt_shared(jnienv, dbt, 1, ret_info));
|
||||
}
|
||||
|
||||
jobject get_DbMpoolFStat(JNIEnv *jnienv, DB_MPOOL_FSTAT *dbobj)
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Copyright (c) 1997-2002
|
||||
* Sleepycat Software. All rights reserved.
|
||||
*
|
||||
* $Id: java_util.h,v 11.22 2001/01/11 18:19:53 bostic Exp $
|
||||
* $Id: java_util.h,v 11.44 2002/08/29 14:22:24 margo Exp $
|
||||
*/
|
||||
|
||||
#ifndef _JAVA_UTIL_H_
|
||||
@ -12,7 +12,8 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
/* These are level 4 warnings that are explicitly disabled.
|
||||
/*
|
||||
* These are level 4 warnings that are explicitly disabled.
|
||||
* With Visual C++, by default you do not see above level 3 unless
|
||||
* you use /W4. But we like to compile with the highest level
|
||||
* warnings to catch other errors.
|
||||
@ -35,15 +36,15 @@
|
||||
|
||||
#include "db_config.h"
|
||||
#include "db.h"
|
||||
#include "db_int.h"
|
||||
#include <jni.h>
|
||||
#include "java_info.h"
|
||||
#include "java_locked.h"
|
||||
#include <jni.h>
|
||||
#include <string.h> /* needed for memset */
|
||||
|
||||
#define DB_PACKAGE_NAME "com/sleepycat/db/"
|
||||
|
||||
/* Union to convert longs to pointers (see {get,set}_private_dbobj).
|
||||
*/
|
||||
/* Union to convert longs to pointers (see {get,set}_private_dbobj). */
|
||||
typedef union {
|
||||
jlong java_long;
|
||||
void *ptr;
|
||||
@ -52,13 +53,13 @@ typedef union {
|
||||
/****************************************************************
|
||||
*
|
||||
* Utility functions and definitions used by "glue" functions.
|
||||
*
|
||||
*/
|
||||
|
||||
#define NOT_IMPLEMENTED(str) \
|
||||
report_exception(jnienv, str /*concatenate*/ ": not implemented", 0)
|
||||
|
||||
/* Get, delete a global reference.
|
||||
/*
|
||||
* Get, delete a global reference.
|
||||
* Making this operation a function call allows for
|
||||
* easier tracking for debugging. Global references
|
||||
* are mostly grabbed at 'open' and 'close' points,
|
||||
@ -78,7 +79,7 @@ static void wrdebug(const char *str)
|
||||
static jobject debug_new_global_ref(JNIEnv *jnienv, jobject obj, const char *s)
|
||||
{
|
||||
wrdebug(s);
|
||||
return (*jnienv)->NewGlobalRef(jnienv, obj);
|
||||
return ((*jnienv)->NewGlobalRef(jnienv, obj));
|
||||
}
|
||||
|
||||
static void debug_delete_global_ref(JNIEnv *jnienv, jobject obj, const char *s)
|
||||
@ -97,28 +98,45 @@ static void debug_delete_global_ref(JNIEnv *jnienv, jobject obj, const char *s)
|
||||
#define wrdebug(x)
|
||||
#endif
|
||||
|
||||
/* Get the private data from a Db* object that points back to a C DB_* object.
|
||||
/*
|
||||
* Do any one time initialization, especially initializing any
|
||||
* unchanging methodIds, fieldIds, etc.
|
||||
*/
|
||||
void one_time_init(JNIEnv *jnienv);
|
||||
|
||||
/*
|
||||
* Get the current JNIEnv from the java VM.
|
||||
* If the jvm argument is null, uses the default
|
||||
* jvm stored during the first invocation.
|
||||
*/
|
||||
JNIEnv *get_jnienv(JavaVM *jvm);
|
||||
|
||||
/*
|
||||
* Get the private data from a Db* object that points back to a C DB_* object.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
void *get_private_dbobj(JNIEnv *jnienv, const char *classname,
|
||||
jobject obj);
|
||||
|
||||
/* Set the private data in a Db* object that points back to a C DB_* object.
|
||||
/*
|
||||
* Set the private data in a Db* object that points back to a C DB_* object.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
void set_private_dbobj(JNIEnv *jnienv, const char *classname,
|
||||
jobject obj, void *value);
|
||||
|
||||
/* Get the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
/*
|
||||
* Get the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
void *get_private_info(JNIEnv *jnienv, const char *classname,
|
||||
jobject obj);
|
||||
|
||||
/* Set the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
/*
|
||||
* Set the private data in a Db/DbEnv object that holds additional 'side data'.
|
||||
* The private data is stored in the object as a Java long (64 bits),
|
||||
* which is long enough to store a pointer on current architectures.
|
||||
*/
|
||||
@ -126,84 +144,126 @@ void set_private_info(JNIEnv *jnienv, const char *classname,
|
||||
jobject obj, void *value);
|
||||
|
||||
/*
|
||||
* Given a non-qualified name (e.g. "foo"), get the class handl
|
||||
* Given a non-qualified name (e.g. "foo"), get the class handle
|
||||
* for the fully qualified name (e.g. "com.sleepycat.db.foo")
|
||||
*/
|
||||
jclass get_class(JNIEnv *jnienv, const char *classname);
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be a DB object type.
|
||||
*/
|
||||
void set_object_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
jobject jthis, const char *object_classname,
|
||||
const char *name_of_field, jobject obj);
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be an integer type.
|
||||
*/
|
||||
void set_int_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
jobject jthis, const char *name_of_field, jint value);
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be an integer type.
|
||||
*/
|
||||
void set_long_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
jobject jthis, const char *name_of_field, jlong value);
|
||||
|
||||
/* Set an individual field in a Db* object.
|
||||
/*
|
||||
* Set an individual field in a Db* object.
|
||||
* The field must be an DbLsn type.
|
||||
*/
|
||||
void set_lsn_field(JNIEnv *jnienv, jclass class_of_this,
|
||||
jobject jthis, const char *name_of_field, DB_LSN value);
|
||||
|
||||
/* Values of expect_mask
|
||||
/*
|
||||
* Values of flags for verify_return() and report_exception().
|
||||
* These indicate what sort of exceptions the method may throw
|
||||
* (in addition to DbException).
|
||||
*/
|
||||
static const int EXCEPTION_FILE_NOT_FOUND = 0x0001;
|
||||
static const u_int32_t EXCEPTION_FILE_NOT_FOUND = 0x0001; /*FileNotFound*/
|
||||
|
||||
/* Report an exception back to the java side.
|
||||
/*
|
||||
* Report an exception back to the java side.
|
||||
*/
|
||||
void report_exception(JNIEnv *jnienv, const char *text, int err,
|
||||
unsigned long expect_mask);
|
||||
void report_exception(JNIEnv *jnienv, const char *text,
|
||||
int err, unsigned long expect_mask);
|
||||
|
||||
/* Report an error via the errcall mechanism.
|
||||
/*
|
||||
* Report an exception back to the java side, for the specific
|
||||
* case of DB_LOCK_NOTGRANTED, as more things are added to the
|
||||
* constructor of this type of exception.
|
||||
*/
|
||||
void report_notgranted_exception(JNIEnv *jnienv, const char *text,
|
||||
db_lockop_t op, db_lockmode_t mode,
|
||||
jobject jdbt, jobject jlock, int index);
|
||||
|
||||
/*
|
||||
* Create an exception object and return it.
|
||||
* The given class must have a constructor that has a
|
||||
* constructor with args (java.lang.String text, int errno);
|
||||
* DbException and its subclasses fit this bill.
|
||||
*/
|
||||
jobject create_exception(JNIEnv *jnienv, jstring text,
|
||||
int err, jclass dbexcept);
|
||||
|
||||
/*
|
||||
* Report an error via the errcall mechanism.
|
||||
*/
|
||||
void report_errcall(JNIEnv *jnienv, jobject errcall,
|
||||
jstring prefix, const char *message);
|
||||
|
||||
/* If the object is null, report an exception and return false (0),
|
||||
/*
|
||||
* If the object is null, report an exception and return false (0),
|
||||
* otherwise return true (1).
|
||||
*/
|
||||
int verify_non_null(JNIEnv *jnienv, void *obj);
|
||||
|
||||
/* If the error code is non-zero, report an exception and return false (0),
|
||||
/*
|
||||
* If the error code is non-zero, report an exception and return false (0),
|
||||
* otherwise return true (1).
|
||||
*/
|
||||
int verify_return(JNIEnv *jnienv, int err, unsigned long expect_mask);
|
||||
int verify_return(JNIEnv *jnienv, int err, unsigned long flags);
|
||||
|
||||
/* Create an object of the given class, calling its default constructor.
|
||||
/*
|
||||
* Verify that there was no memory error due to undersized Dbt.
|
||||
* If there is report a DbMemoryException, with the Dbt attached
|
||||
* and return false (0), otherwise return true (1).
|
||||
*/
|
||||
int verify_dbt(JNIEnv *jnienv, int err, LOCKED_DBT *locked_dbt);
|
||||
|
||||
/*
|
||||
* Create an object of the given class, calling its default constructor.
|
||||
*/
|
||||
jobject create_default_object(JNIEnv *jnienv, const char *class_name);
|
||||
|
||||
/* Convert an DB object to a Java encapsulation of that object.
|
||||
/*
|
||||
* Create a Dbt object, , calling its default constructor.
|
||||
*/
|
||||
jobject create_dbt(JNIEnv *jnienv, const char *class_name);
|
||||
|
||||
/*
|
||||
* Convert an DB object to a Java encapsulation of that object.
|
||||
* Note: This implementation creates a new Java object on each call,
|
||||
* so it is generally useful when a new DB object has just been created.
|
||||
*/
|
||||
jobject convert_object(JNIEnv *jnienv, const char *class_name, void *dbobj);
|
||||
|
||||
/* Create a copy of the string
|
||||
*/
|
||||
char *dup_string(const char *str);
|
||||
|
||||
/* Create a malloc'ed copy of the java string.
|
||||
/*
|
||||
* Create a copy of the java string using __os_malloc.
|
||||
* Caller must free it.
|
||||
*/
|
||||
char *get_c_string(JNIEnv *jnienv, jstring jstr);
|
||||
|
||||
/* Create a java string from the given string
|
||||
/*
|
||||
* Create a java string from the given string
|
||||
*/
|
||||
jstring get_java_string(JNIEnv *jnienv, const char* string);
|
||||
|
||||
/* Convert a java object to the various C pointers they represent.
|
||||
/*
|
||||
* Convert a java object to the various C pointers they represent.
|
||||
*/
|
||||
DB *get_DB (JNIEnv *jnienv, jobject obj);
|
||||
DB_BTREE_STAT *get_DB_BTREE_STAT (JNIEnv *jnienv, jobject obj);
|
||||
@ -213,6 +273,7 @@ DB_ENV_JAVAINFO *get_DB_ENV_JAVAINFO (JNIEnv *jnienv, jobject obj);
|
||||
DB_HASH_STAT *get_DB_HASH_STAT (JNIEnv *jnienv, jobject obj);
|
||||
DB_JAVAINFO *get_DB_JAVAINFO (JNIEnv *jnienv, jobject obj);
|
||||
DB_LOCK *get_DB_LOCK (JNIEnv *jnienv, jobject obj);
|
||||
DB_LOGC *get_DB_LOGC (JNIEnv *jnienv, jobject obj);
|
||||
DB_LOG_STAT *get_DB_LOG_STAT (JNIEnv *jnienv, jobject obj);
|
||||
DB_LSN *get_DB_LSN (JNIEnv *jnienv, jobject obj);
|
||||
DB_MPOOL_FSTAT *get_DB_MPOOL_FSTAT(JNIEnv *jnienv, jobject obj);
|
||||
@ -223,17 +284,20 @@ DB_TXN_STAT *get_DB_TXN_STAT (JNIEnv *jnienv, jobject obj);
|
||||
DBT *get_DBT (JNIEnv *jnienv, jobject obj);
|
||||
DBT_JAVAINFO *get_DBT_JAVAINFO (JNIEnv *jnienv, jobject obj);
|
||||
|
||||
/* From a C object, create a Java object.
|
||||
/*
|
||||
* From a C object, create a Java object.
|
||||
*/
|
||||
jobject get_DbBtreeStat (JNIEnv *jnienv, DB_BTREE_STAT *dbobj);
|
||||
jobject get_Dbc (JNIEnv *jnienv, DBC *dbobj);
|
||||
jobject get_DbHashStat (JNIEnv *jnienv, DB_HASH_STAT *dbobj);
|
||||
jobject get_DbLogc (JNIEnv *jnienv, DB_LOGC *dbobj);
|
||||
jobject get_DbLogStat (JNIEnv *jnienv, DB_LOG_STAT *dbobj);
|
||||
jobject get_DbLsn (JNIEnv *jnienv, DB_LSN dbobj);
|
||||
jobject get_DbMpoolStat (JNIEnv *jnienv, DB_MPOOL_STAT *dbobj);
|
||||
jobject get_DbMpoolFStat (JNIEnv *jnienv, DB_MPOOL_FSTAT *dbobj);
|
||||
jobject get_DbQueueStat (JNIEnv *jnienv, DB_QUEUE_STAT *dbobj);
|
||||
jobject get_Dbt (JNIEnv *jnienv, DBT *dbt);
|
||||
jobject get_const_Dbt (JNIEnv *jnienv, const DBT *dbt, DBT_JAVAINFO **retp);
|
||||
jobject get_Dbt (JNIEnv *jnienv, DBT *dbt, DBT_JAVAINFO **retp);
|
||||
jobject get_DbTxn (JNIEnv *jnienv, DB_TXN *dbobj);
|
||||
jobject get_DbTxnStat (JNIEnv *jnienv, DB_TXN_STAT *dbobj);
|
||||
|
||||
@ -247,17 +311,22 @@ extern const char * const name_DB_EXCEPTION;
|
||||
extern const char * const name_DB_HASH_STAT;
|
||||
extern const char * const name_DB_LOCK;
|
||||
extern const char * const name_DB_LOCK_STAT;
|
||||
extern const char * const name_DB_LOGC;
|
||||
extern const char * const name_DB_LOG_STAT;
|
||||
extern const char * const name_DB_LSN;
|
||||
extern const char * const name_DB_MEMORY_EX;
|
||||
extern const char * const name_DB_MPOOL_FSTAT;
|
||||
extern const char * const name_DB_MPOOL_STAT;
|
||||
extern const char * const name_DB_LOCKNOTGRANTED_EX;
|
||||
extern const char * const name_DB_PREPLIST;
|
||||
extern const char * const name_DB_QUEUE_STAT;
|
||||
extern const char * const name_DB_REP_STAT;
|
||||
extern const char * const name_DB_RUNRECOVERY_EX;
|
||||
extern const char * const name_DBT;
|
||||
extern const char * const name_DB_TXN;
|
||||
extern const char * const name_DB_TXN_STAT;
|
||||
extern const char * const name_DB_TXN_STAT_ACTIVE;
|
||||
extern const char * const name_DB_UTIL;
|
||||
extern const char * const name_DbAppendRecno;
|
||||
extern const char * const name_DbBtreeCompare;
|
||||
extern const char * const name_DbBtreePrefix;
|
||||
@ -267,93 +336,106 @@ extern const char * const name_DbErrcall;
|
||||
extern const char * const name_DbFeedback;
|
||||
extern const char * const name_DbHash;
|
||||
extern const char * const name_DbRecoveryInit;
|
||||
extern const char * const name_DbRepTransport;
|
||||
extern const char * const name_DbSecondaryKeyCreate;
|
||||
extern const char * const name_DbTxnRecover;
|
||||
extern const char * const name_RepElectResult;
|
||||
extern const char * const name_RepProcessMessage;
|
||||
|
||||
extern const char * const string_signature;
|
||||
|
||||
#define JAVADB_RO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \
|
||||
JNIEXPORT j_fieldtype JNICALL \
|
||||
Java_com_sleepycat_db_##j_class##_get_1##j_field \
|
||||
(JNIEnv *jnienv, jobject jthis) \
|
||||
{ \
|
||||
c_type *db_this = get_##c_type(jnienv, jthis); \
|
||||
\
|
||||
if (verify_non_null(jnienv, db_this)) { \
|
||||
return db_this->c_field; \
|
||||
} \
|
||||
return 0; \
|
||||
extern jfieldID fid_Dbt_data;
|
||||
extern jfieldID fid_Dbt_offset;
|
||||
extern jfieldID fid_Dbt_size;
|
||||
extern jfieldID fid_Dbt_ulen;
|
||||
extern jfieldID fid_Dbt_dlen;
|
||||
extern jfieldID fid_Dbt_doff;
|
||||
extern jfieldID fid_Dbt_flags;
|
||||
extern jfieldID fid_Dbt_must_create_data;
|
||||
extern jfieldID fid_DbLockRequest_op;
|
||||
extern jfieldID fid_DbLockRequest_mode;
|
||||
extern jfieldID fid_DbLockRequest_timeout;
|
||||
extern jfieldID fid_DbLockRequest_obj;
|
||||
extern jfieldID fid_DbLockRequest_lock;
|
||||
extern jfieldID fid_RepProcessMessage_envid;
|
||||
|
||||
#define JAVADB_ARGS JNIEnv *jnienv, jobject jthis
|
||||
|
||||
#define JAVADB_GET_FLD(j_class, j_fieldtype, j_field, c_type, c_field) \
|
||||
JNIEXPORT j_fieldtype JNICALL \
|
||||
Java_com_sleepycat_db_##j_class##_get_1##j_field \
|
||||
(JAVADB_ARGS) \
|
||||
{ \
|
||||
c_type *db= get_##c_type(jnienv, jthis); \
|
||||
\
|
||||
if (verify_non_null(jnienv, db)) \
|
||||
return (db->c_field); \
|
||||
return (0); \
|
||||
}
|
||||
|
||||
#define JAVADB_WO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \
|
||||
JNIEXPORT void JNICALL \
|
||||
Java_com_sleepycat_db_##j_class##_set_1##j_field \
|
||||
(JNIEnv *jnienv, jobject jthis, j_fieldtype value) \
|
||||
{ \
|
||||
c_type *db_this = get_##c_type(jnienv, jthis); \
|
||||
\
|
||||
if (verify_non_null(jnienv, db_this)) { \
|
||||
db_this->c_field = value; \
|
||||
} \
|
||||
#define JAVADB_SET_FLD(j_class, j_fieldtype, j_field, c_type, c_field) \
|
||||
JNIEXPORT void JNICALL \
|
||||
Java_com_sleepycat_db_##j_class##_set_1##j_field \
|
||||
(JAVADB_ARGS, j_fieldtype value) \
|
||||
{ \
|
||||
c_type *db= get_##c_type(jnienv, jthis); \
|
||||
\
|
||||
if (verify_non_null(jnienv, db)) \
|
||||
db->c_field = value; \
|
||||
}
|
||||
|
||||
/* This is a variant of the JAVADB_WO_ACCESS macro to define a simple set_
|
||||
* method using a C "method" call. These should be used with set_
|
||||
* methods that cannot invoke java 'callbacks' (no set_ method currently
|
||||
* does that). That assumption allows us to optimize (and simplify)
|
||||
* by not calling API_BEGIN/END macros.
|
||||
#define JAVADB_METHOD(_meth, _argspec, c_type, c_meth, _args) \
|
||||
JNIEXPORT void JNICALL Java_com_sleepycat_db_##_meth _argspec \
|
||||
{ \
|
||||
c_type *c_this = get_##c_type(jnienv, jthis); \
|
||||
int ret; \
|
||||
\
|
||||
if (!verify_non_null(jnienv, c_this)) \
|
||||
return; \
|
||||
ret = c_this->c_meth _args; \
|
||||
if (!DB_RETOK_STD(ret)) \
|
||||
report_exception(jnienv, db_strerror(ret), ret, 0); \
|
||||
}
|
||||
|
||||
#define JAVADB_METHOD_INT(_meth, _argspec, c_type, c_meth, _args, _retok) \
|
||||
JNIEXPORT jint JNICALL Java_com_sleepycat_db_##_meth _argspec \
|
||||
{ \
|
||||
c_type *c_this = get_##c_type(jnienv, jthis); \
|
||||
int ret; \
|
||||
\
|
||||
if (!verify_non_null(jnienv, c_this)) \
|
||||
return (0); \
|
||||
ret = c_this->c_meth _args; \
|
||||
if (!_retok(ret)) \
|
||||
report_exception(jnienv, db_strerror(ret), ret, 0); \
|
||||
return ((jint)ret); \
|
||||
}
|
||||
|
||||
#define JAVADB_SET_METH(j_class, j_type, j_fld, c_type, c_field) \
|
||||
JAVADB_METHOD(j_class##_set_1##j_fld, (JAVADB_ARGS, j_type val), c_type, \
|
||||
set_##c_field, (c_this, val))
|
||||
|
||||
#define JAVADB_SET_METH_STR(j_class, j_fld, c_type, c_field) \
|
||||
JAVADB_METHOD(j_class##_set_1##j_fld, (JAVADB_ARGS, jstring val), c_type, \
|
||||
set_##c_field, (c_this, (*jnienv)->GetStringUTFChars(jnienv, val, NULL)))
|
||||
|
||||
|
||||
/*
|
||||
* These macros are used by code generated by the s_java script.
|
||||
*/
|
||||
#define JAVADB_WO_ACCESS_METHOD(j_class, j_fieldtype, \
|
||||
j_field, c_type, c_field) \
|
||||
JNIEXPORT void JNICALL \
|
||||
Java_com_sleepycat_db_##j_class##_set_1##j_field \
|
||||
(JNIEnv *jnienv, jobject jthis, j_fieldtype value) \
|
||||
{ \
|
||||
c_type *db_this; \
|
||||
int err; \
|
||||
\
|
||||
db_this = get_##c_type(jnienv, jthis); \
|
||||
if (verify_non_null(jnienv, db_this)) { \
|
||||
err = db_this->set_##c_field(db_this, value); \
|
||||
verify_return(jnienv, err, 0); \
|
||||
} \
|
||||
}
|
||||
#define JAVADB_STAT_INT(env, cl, jobj, statp, name) \
|
||||
set_int_field(jnienv, cl, jobj, #name, statp->name)
|
||||
|
||||
#define JAVADB_RW_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \
|
||||
JAVADB_RO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field) \
|
||||
JAVADB_WO_ACCESS(j_class, j_fieldtype, j_field, c_type, c_field)
|
||||
#define JAVADB_STAT_LSN(env, cl, jobj, statp, name) \
|
||||
set_lsn_field(jnienv, cl, jobj, #name, statp->name)
|
||||
|
||||
#define JAVADB_WO_ACCESS_STRING(j_class, j_field, c_type, c_field) \
|
||||
JNIEXPORT void JNICALL \
|
||||
Java_com_sleepycat_db_##j_class##_set_1##j_field \
|
||||
(JNIEnv *jnienv, jobject jthis, jstring value) \
|
||||
{ \
|
||||
c_type *db_this; \
|
||||
int err; \
|
||||
\
|
||||
db_this = get_##c_type(jnienv, jthis); \
|
||||
if (verify_non_null(jnienv, db_this)) { \
|
||||
err = db_this->set_##c_field(db_this, \
|
||||
(*jnienv)->GetStringUTFChars(jnienv, value, NULL)); \
|
||||
verify_return(jnienv, err, 0); \
|
||||
} \
|
||||
}
|
||||
#define JAVADB_STAT_LONG(env, cl, jobj, statp, name) \
|
||||
set_long_field(jnienv, cl, jobj, #name, statp->name)
|
||||
|
||||
#define JAVADB_API_BEGIN(db, jthis) \
|
||||
if ((db) != NULL) \
|
||||
((DB_JAVAINFO*)(db)->cj_internal)->jdbref_ = \
|
||||
((DB_ENV_JAVAINFO*)((db)->dbenv->cj_internal))->jdbref_ = (jthis)
|
||||
|
||||
#define JAVADB_API_END(db) \
|
||||
if ((db) != NULL) \
|
||||
((DB_JAVAINFO*)(db)->cj_internal)->jdbref_ = \
|
||||
((DB_ENV_JAVAINFO*)((db)->dbenv->cj_internal))->jdbref_ = 0
|
||||
|
||||
#define JAVADB_ENV_API_BEGIN(dbenv, jthis) \
|
||||
if ((dbenv) != NULL) \
|
||||
((DB_ENV_JAVAINFO*)((dbenv)->cj_internal))->jenvref_ = (jthis)
|
||||
|
||||
#define JAVADB_ENV_API_END(dbenv) \
|
||||
if ((dbenv) != NULL) \
|
||||
((DB_ENV_JAVAINFO*)((dbenv)->cj_internal))->jenvref_ = 0
|
||||
/*
|
||||
* We build the active list separately.
|
||||
*/
|
||||
#define JAVADB_STAT_ACTIVE(env, cl, jobj, statp, name) \
|
||||
do {} while(0)
|
||||
|
||||
#endif /* !_JAVA_UTIL_H_ */
|
||||
|
Reference in New Issue
Block a user