5 DbRetVal rv
= conn
.open("root", "manager");
6 if (rv
!= OK
) return 1;
7 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
8 if (dbMgr
== NULL
) { printf("Auth failed\n"); return 2;}
11 tabDef
.addField("f1", typeInt
, 0, NULL
, true);//NOT NULL
12 tabDef
.addField("f2", typeInt
, 0, NULL
, false);
13 rv
= dbMgr
->createTable("t1", tabDef
);
14 if (rv
!= OK
) { printf("Table creation failed\n"); conn
.close(); return 3; }
15 printf("Table created\n");
17 Table
*table
= dbMgr
->openTable("t1");
20 printf("Unable to open table\n");
21 dbMgr
->dropTable("t1");
26 table
->bindFld("f1", &id1
);
27 table
->bindFld("f2", &id2
);
28 conn
.startTransaction();
29 rv
= table
->markFldNull(1);
31 printf("test passed\n");
32 dbMgr
->closeTable(table
);
33 dbMgr
->dropTable("t1");
34 printf("table dropped\n");
38 rv
= table
->insertTuple();
42 dbMgr
->dropTable("t1");
46 table
->clearFldNull(1);
49 table
->setCondition(NULL
);
50 rv
= table
->execute();
53 dbMgr
->closeTable(table
);
54 dbMgr
->dropTable("t1");
57 table
->bindFld("f2", &id2
);
61 tuple
= (char*)table
->fetch() ;
62 if (tuple
== NULL
) {break;}
63 if (table
->isFldNull(1)) printf("Column 1 is null\n");
64 if (table
->isFldNull(2)) printf("Column 2 is null\n");
65 printf("Binded Tuple value is %d %d \n", id1
, id2
);
69 dbMgr
->closeTable(table
);
70 dbMgr
->dropTable("t1");