2 //Insert 1 million tuples. There will not be enough db space.
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 tabDef
.addField("f3", typeString
, 1016);
16 rv
= dbMgr
->createTable("t1", tabDef
);
17 if (rv
!= OK
) { printf("Table creation failed\n"); conn
.close(); return 3; }
18 printf("Table created\n");
20 Table
*table
= dbMgr
->openTable("t1");
23 printf("Unable to open table\n");
24 dbMgr
->dropTable("t1");
29 char name
[20] = "PRAVEEN";
30 table
->bindFld("f1", &id1
);
31 table
->bindFld("f2", &id2
);
32 table
->bindFld("f3", name
);
34 for (int i
= 0 ; i
< 1000 ; i
++)
36 conn
.startTransaction();
37 for (int j
= 0 ; j
< 100 ; j
++) {
39 rv
= table
->insertTuple();
44 printf("Tuples inserted %d\n", icount
);
45 dbMgr
->closeTable(table
);
46 dbMgr
->dropTable("t1");
48 if (rv
== ErrNoMemory
)
50 //insert is expected to fail
51 printf("insert failed with return values %d\n", rv
);