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