modified to accept hostname and connect to the network
[csql.git] / test / system / lock / locktest001.c
blob72833cd19b0a4c87d2242f9a043ff3eb7480e3a8
1 /**********************************************************
2 * Test Case
3 * create table t1
4 * create index if specified
5 * insert 10 tuples
6 * check lock statistics
7 * commit transation
8 * check lock 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->printDebugLockInfo();
30 conn.commit();
31 printf("After commit\n");
32 dbMgr->printDebugLockInfo();
33 dropTable(dbMgr, "t1");
34 conn.close();
35 return ret;