summaryrefslogtreecommitdiff
path: root/libraries/liblmdb/mtest6.c
diff options
context:
space:
mode:
authorHallvard Furuseth <hallvard@openldap.org>2015-04-14 20:25:51 +0200
committerHallvard Furuseth <hallvard@openldap.org>2015-04-14 20:25:51 +0200
commit2f6877ff7bccbbd550387cb343687e7dcf72a406 (patch)
tree0ffdeb4f6a068aa4cb5ee7adf373ff16f136a968 /libraries/liblmdb/mtest6.c
parent5224774f3ccf44d7428350bb28a4e9eec7e7c7cf (diff)
downloadlmdb-2f6877ff7bccbbd550387cb343687e7dcf72a406.tar.gz
lmdb-2f6877ff7bccbbd550387cb343687e7dcf72a406.tar.bz2
lmdb-2f6877ff7bccbbd550387cb343687e7dcf72a406.zip
Cleanup mtest* and sample-*.
Fix mdb_txn_begin(&read-only txn) calls. Test mdb_env_set_maxreaders(). Rename DBI open/close functions. Move mdb_dbi_close() out of txn.
Diffstat (limited to 'libraries/liblmdb/mtest6.c')
-rw-r--r--libraries/liblmdb/mtest6.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libraries/liblmdb/mtest6.c b/libraries/liblmdb/mtest6.c
index b351c1a..174f4f6 100644
--- a/libraries/liblmdb/mtest6.c
+++ b/libraries/liblmdb/mtest6.c
@@ -46,8 +46,9 @@ int main(int argc,char * argv[])
E(mdb_env_set_mapsize(env, 10485760));
E(mdb_env_set_maxdbs(env, 4));
E(mdb_env_open(env, "./testdb", MDB_FIXEDMAP|MDB_NOSYNC, 0664));
+
E(mdb_txn_begin(env, NULL, 0, &txn));
- E(mdb_open(txn, "id6", MDB_CREATE|MDB_INTEGERKEY, &dbi));
+ E(mdb_dbi_open(txn, "id6", MDB_CREATE|MDB_INTEGERKEY, &dbi));
E(mdb_cursor_open(txn, dbi, &cursor));
E(mdb_stat(txn, dbi, &mst));
@@ -110,7 +111,7 @@ int main(int argc,char * argv[])
printf("Deleted %d values\n", j);
E(mdb_env_stat(env, &mst));
- E(mdb_txn_begin(env, NULL, 1, &txn));
+ E(mdb_txn_begin(env, NULL, MDB_RDONLY, &txn));
E(mdb_cursor_open(txn, dbi, &cursor));
printf("Cursor next\n");
while ((rc = mdb_cursor_get(cursor, &key, &data, MDB_NEXT)) == 0) {
@@ -127,9 +128,9 @@ int main(int argc,char * argv[])
}
CHECK(rc == MDB_NOTFOUND, "mdb_cursor_get");
mdb_cursor_close(cursor);
- mdb_close(env, dbi);
-
mdb_txn_abort(txn);
+
+ mdb_dbi_close(env, dbi);
#endif
mdb_env_close(env);