1 #include "../private.h" // struct ntdb_context
3 #include "tap-interface.h"
6 #include "helpapi-external-agent.h"
8 int main(int argc, char *argv[])
11 struct ntdb_context *ntdb;
12 int flags[] = { NTDB_DEFAULT, NTDB_NOMMAP,
13 NTDB_CONVERT, NTDB_NOMMAP|NTDB_CONVERT };
14 NTDB_DATA key = ntdb_mkdata("key", 3);
15 NTDB_DATA data = ntdb_mkdata("data", 4), d;
17 plan_tests(sizeof(flags) / sizeof(flags[0]) * 12 + 1);
19 for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) {
20 ntdb = ntdb_open("api-60-transaction.ntdb",
21 flags[i]|MAYBE_NOSYNC,
22 O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr);
27 ok1(ntdb_store(ntdb, key, data, NTDB_INSERT) == 0);
29 ok1(ntdb_transaction_start(ntdb) == 0);
30 /* Do an identical replace. */
31 ok1(ntdb_store(ntdb, key, data, NTDB_REPLACE) == 0);
32 ok1(ntdb_transaction_commit(ntdb) == 0);
34 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
35 ok1(ntdb_fetch(ntdb, key, &d) == NTDB_SUCCESS);
36 ok1(ntdb_deq(data, d));
41 ntdb = ntdb_open("api-60-transaction.ntdb",
42 flags[i]|MAYBE_NOSYNC,
43 O_RDWR, 0600, &tap_log_attr);
47 ok1(ntdb_check(ntdb, NULL, NULL) == 0);
48 ok1(ntdb_fetch(ntdb, key, &d) == NTDB_SUCCESS);
49 ok1(ntdb_deq(data, d));
54 ok1(tap_log_messages == 0);