00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <db_cxx.h>
00017 #include <iostream.h>
00018
00019 int main(int argc, char *argv[])
00020 {
00021 try {
00022 DbEnv *dbenv = new DbEnv(0);
00023 DbTxn *dbtxn;
00024 u_int8_t conflicts[10];
00025
00026 dbenv->set_error_stream(&cerr);
00027 dbenv->set_timeout(0x90000000,
00028 DB_SET_LOCK_TIMEOUT);
00029 dbenv->set_lg_bsize(0x1000);
00030 dbenv->set_lg_dir(".");
00031 dbenv->set_lg_max(0x10000000);
00032 dbenv->set_lg_regionmax(0x100000);
00033 dbenv->set_lk_conflicts(conflicts, sizeof(conflicts));
00034 dbenv->set_lk_detect(DB_LOCK_DEFAULT);
00035
00036
00037 dbenv->set_lk_max_lockers(100);
00038 dbenv->set_lk_max_locks(10);
00039 dbenv->set_lk_max_objects(1000);
00040 dbenv->set_mp_mmapsize(0x10000);
00041
00042
00043
00044
00045 dbenv->open(".", DB_CREATE | DB_INIT_TXN |
00046 DB_INIT_LOCK | DB_INIT_LOG |
00047 DB_INIT_MPOOL,
00048 0644);
00049
00050 dbenv->txn_begin(NULL, &dbtxn, DB_TXN_NOWAIT);
00051 dbtxn->set_timeout(0xA0000000, DB_SET_TXN_TIMEOUT);
00052 dbtxn->abort();
00053
00054 dbenv->close(0);
00055
00056
00057
00058
00059
00060
00061
00062 Db *db_bt = new Db(NULL, 0);
00063 db_bt->set_bt_minkey(100);
00064 db_bt->set_cachesize(0, 0x100000, 0);
00065 db_bt->close(0);
00066
00067 Db *db_h = new Db(NULL, 0);
00068 db_h->set_h_ffactor(0x10);
00069 db_h->set_h_nelem(100);
00070 db_h->set_lorder(0);
00071 db_h->set_pagesize(0x10000);
00072 db_h->close(0);
00073
00074 Db *db_re = new Db(NULL, 0);
00075 db_re->set_re_delim('@');
00076 db_re->set_re_pad(10);
00077 db_re->set_re_source("re.in");
00078 db_re->close(0);
00079
00080 Db *db_q = new Db(NULL, 0);
00081 db_q->set_q_extentsize(200);
00082 db_q->close(0);
00083
00084 }
00085 catch (DbException &dbe) {
00086 cerr << "Db Exception: " << dbe.what() << "\n";
00087 }
00088 return 0;
00089 }