mysql for odbc
[csql.git] / test / system / lock / locktest009.c
blobb5cc8f8308b688417b8e0bf8f4895f930c8cd7ec
1 /**********************************************************
2 * Test Case
3 * create table t1
4 * create index if specified
5 * start transaction with READ_REPEATABLE isolation level
6 * delete 10 tuples
7 * check lock statistics
8 * abort 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(READ_REPEATABLE);
32 if (rv != OK) ret = 5;
33 rc = deleteTuple(dbMgr, conn, "t1", 10);
34 if (rc != 10) ret = 6;
35 printf("Before abort\n");
36 dbMgr->printDebugLockInfo();
37 conn.rollback();
38 printf("After abort\n");
39 dbMgr->printDebugLockInfo();
40 dropTable(dbMgr, "t1");
41 conn.close();
42 return ret;