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