1
[csql.git] / test / dbapi / TableDef / dupfieldname.c
blob92d0035686b83a45b8268e4414268bd82f53668a
1 //Should not allow duplicate field names in one table
2 #include<CSql.h>
3 int main()
5 Connection conn;
6 DbRetVal rv = conn.open("root", "manager");
7 if (rv != OK) return 1;
8 DatabaseManager *dbMgr = conn.getDatabaseManager();
9 if (dbMgr == NULL) { printf("Auth failed\n"); return 2;}
11 TableDef tabDef;
12 //int test=0;
13 tabDef.addField("f1", typeInt, 0, NULL, true);
14 rv=(DbRetVal)tabDef.addField("f1", typeInt);
15 if(rv==0)
17 printf("Test failed with return value %d\n",rv);
18 return rv;
20 printf("test passed\n");
21 dbMgr->createTable("t1", tabDef);
22 dbMgr->dropTable("t1");
23 conn.close();
24 return 0;
27 //3298:3086821072:TableDef.cxx:40:Field f_1 already Exists
28 //Table created with field name f_1 only