1 //TestCase: We need to start new server to test this.
2 //the default db size set is not enough to test this
7 DbRetVal rv
= conn
.open("root", "manager");
8 if (rv
!= OK
) return 1;
9 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
10 if (dbMgr
== NULL
) { printf("Auth failed\n"); return 2;}
13 tabDef
.addField("f1", typeInt
, 0, NULL
, true);
14 tabDef
.addField("f2", typeInt
);
15 rv
= dbMgr
->createTable("t1", tabDef
);
16 if (rv
!= OK
) { printf("Table creation failed\n"); conn
.close(); return 3; }
17 printf("Table created\n");
19 HashIndexInitInfo
*idxInfo
= new HashIndexInitInfo();
20 strcpy(idxInfo
->tableName
, "t1");
21 idxInfo
->list
.append("f1");
22 idxInfo
->isUnique
= true;
23 idxInfo
->isPrimary
= true;
24 idxInfo
->indType
= hashIndex
;
25 rv
= dbMgr
->createIndex("indx", idxInfo
);
26 if (rv
!= OK
) { printf("Index creation failed\n"); return ErrUnknown
; }
28 Table
*table
= dbMgr
->openTable("t1");
31 printf("Unable to open table\n");
32 dbMgr
->dropTable("t1");
37 table
->bindFld("f1", &id1
);
38 table
->bindFld("f2", &id2
);
40 for (int i
= 0 ; i
< 10000 ; i
++)
42 conn
.startTransaction();
43 for (int j
= 0 ; j
< 100 ; j
++) {
45 rv
= table
->insertTuple();
51 printf("Tuples inserted %d\n", icount
);
52 table
->setCondition(NULL
);
53 rv
= table
->execute();
56 dbMgr
->closeTable(table
);
57 dbMgr
->dropTable("t1");
60 void *fld2ptr
, *fld3ptr
, *tuple
;
64 tuple
= (char*)table
->fetch() ;
65 if (tuple
== NULL
) {break;}
69 dbMgr
->closeTable(table
);
71 if (icount
!= 1000000) return 3;