*** empty log message ***
[csql.git] / test / system / lock / locktest003.c
blob6e96297772e7f2b72b1f9b91e9f9611b574e9ac8
1 /**********************************************************
2 * Test Case
3 * create table t1
4 * create index if specified
5 * start transaction with default isolation level
6 * select 10 tuples
7 * check lock statistics
8 * commit transation
9 * check lock statistics
11 #include "common.h"
12 #include <DatabaseManagerImpl.h>
13 int main()
15 Connection conn;
16 DbRetVal rv = conn.open("root", "manager");
17 if (rv != OK) return 1;
18 DatabaseManagerImpl *dbMgr = (DatabaseManagerImpl*) conn.getDatabaseManager();
19 if (dbMgr == NULL) { printf("Auth failed\n"); return 2;}
20 int ret =0, rc =0;
21 if (createTable(dbMgr, "t1") != 0 ) { ret = 3; }
22 #ifdef WITHINDEX
23 if (createIndex(dbMgr, "t1","f1", "idx1") != 0 ) { ret = 4; }
24 #endif
25 rv = conn.startTransaction();
26 if (rv != OK) ret = 5;
27 rc = insertTuple(dbMgr, conn, "t1", 10);
28 if (rc != 10) ret = 6;
29 conn.commit();
31 rv = conn.startTransaction();
32 if (rv != OK) ret = 5;
33 rc = selectTuple(dbMgr, conn, "t1", 10);
34 if (rc != 10) ret = 6;
35 printf("Before commit\n");
36 dbMgr->printDebugLockInfo();
37 conn.commit();
38 printf("After commit\n");
39 dbMgr->printDebugLockInfo();
40 dropTable(dbMgr, "t1");
41 conn.close();
42 return ret;