test cases for trie index
[csql.git] / test / dbapi / Index / createindexnofld.c
blobdf3031b4831f5bb800445a39afe67b69ea803d11
1 #include<CSql.h>
2 //creating index with non existing field
3 //It should fail
4 int main()
7 Connection conn;
8 DbRetVal rv = conn.open("root", "manager");
9 if (rv != OK)
11 printf("Error during connection %d\n", rv);
12 return -1;
14 DatabaseManager *dbMgr = conn.getDatabaseManager();
15 if (dbMgr == NULL) { printf("Auth failed\n"); return -1;}
16 TableDef tabDef;
17 tabDef.addField("f1", typeInt, 0, NULL);
18 tabDef.addField("f2", typeInt);
19 rv = dbMgr->createTable("t1", tabDef);
20 if (rv != OK) { printf("Table creation failed\n"); return -1; }
21 printf("Table created\n");
22 HashIndexInitInfo *idxInfo = new HashIndexInitInfo();
23 strcpy(idxInfo->tableName, "t1");
24 idxInfo->indType = hashIndex;
25 #ifdef TREEINDEX
26 idxInfo->indType = treeIndex;
27 #elif TRIEINDEX
28 idxInfo->indType = trieIndex;
29 #endif
30 int ret =0;
31 rv = dbMgr->createIndex("indx1", idxInfo);
32 if (rv == OK) ret =1;
33 delete idxInfo;
34 dbMgr->dropTable("t1");
35 conn.close();
36 return ret;