1 /* create table with two fields f1(not null) and f2
2 * f1 field in not binded
3 * when fetching count variable should be zero.
5 * Author : Jitendra Lenka
12 DbRetVal rv
= conn
.open("root","manager");
14 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
17 printf("Auth failed\n");
22 tabDef
.addField("f1",typeInt
,0,NULL
,true);
23 tabDef
.addField("f2",typeInt
);
25 rv
= dbMgr
->createTable("t1",tabDef
);
28 printf("Table creation failed\n");
31 printf("Table created\n");
33 Table
*table
= dbMgr
->openTable("t1");
36 printf("Unable to open table\n");
37 dbMgr
->dropTable("t1");
43 table
->bindFld("f2",&id1
);
47 conn
.startTransaction();
49 rv
= table
->insertTuple();
55 printf("Total row inserted=%d\n",count
);
59 table
->setCondition(NULL
);
60 rv
= table
->execute();
63 dbMgr
->closeTable(table
);
64 dbMgr
->dropTable("t1");
69 tuple
= (char*)table
->fetch();
70 if(tuple
== NULL
){break;}
71 fld
= (char*)tuple
+ os::align(sizeof(int));
72 printf("Tuple value is %d %d\n",*((int*)tuple
),*((int*)fld
));
75 dbMgr
->closeTable(table
);
76 dbMgr
->dropTable("t1");