1 //addField f1, dropField f1 and then addField f1 with notnull flag set,
2 //table creation should succeed and it should make the f1 field notnull
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;}
14 tabDef
.addField("f1", typeInt
);
15 tabDef
.dropField("f1");
16 tabDef
.addField("f1", typeInt
, 0, NULL
, true);
17 rv
=dbMgr
->createTable("t1", tabDef
);
20 printf("Table creation failed\n");
21 printf("Test Failed\n");
22 dbMgr
->dropTable("t1");
25 printf("Table created\n");
27 Table
*table
= dbMgr
->openTable("t1");
30 printf("Unable to open table\n");
31 dbMgr
->dropTable("t1");
36 // table->bindFld("f1",&id);
38 conn
.startTransaction();
39 rv
=table
->insertTuple();
42 printf("NULL value inserted in NOTNULL field\n");
43 printf("Test Failed\n");
45 dbMgr
->closeTable(table
);
46 dbMgr
->dropTable("t1");
50 printf("NULL value can not be stored\n");
51 printf("Test passed\n");
52 dbMgr
->closeTable(table
);
53 dbMgr
->dropTable("t1");