2 //bind twice the same field.
3 //the later should have the effect
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, 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 Table
*table
= dbMgr
->openTable("t1");
22 printf("Unable to open table\n");
23 dbMgr
->dropTable("t1");
27 int id1
= 1, id2
= 5, id3
= 8;
29 char name
[20] = "PRAVEEN";
30 rv
= table
->bindFld("f1", &id1
);
31 if (rv
!= OK
) ret
= 1;
32 rv
= table
->bindFld("f2", &id2
);
33 if (rv
!= OK
) ret
= 2;
34 rv
= table
->bindFld("f2", &id3
);
35 if (rv
!= OK
) ret
= 3;
36 conn
.startTransaction();
37 rv
= table
->insertTuple();
39 conn
.startTransaction();
41 char *tuple
= (char*)table
->fetch();
42 int value
= *(int*)((char*)tuple
+ 4);
43 if (value
!=8) ret
= 5;
44 dbMgr
->dropTable("t1");