*** empty log message ***
[csql.git] / test / system / Allocator / dbsizelimit1.c
blobbc98356ae68bf52c1dc457b1e141e2ac48931e37
1 //Test Case: Insert 50K tuples such that it execeeds the user db size
2 //It should fail saying "no space in userdb"
3 #include<CSql.h>
4 int main()
6 Connection conn;
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;}
12 TableDef tabDef;
13 tabDef.addField("f1", typeInt, 0, NULL, true);
14 tabDef.addField("f2", typeString, 196);
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");
20 if (table == NULL)
22 printf("Unable to open table\n");
23 dbMgr->dropTable("t1");
24 conn.close();
25 return -1;
27 int id1 = 0, id2 = 5;
28 char name[20] = "PRAVEEN";
29 table->bindFld("f1", &id1);
30 table->bindFld("f2", &id2);
31 int icount =0;
32 for (int i = 0 ; i < 1000 ; i++)
34 conn.startTransaction();
35 for (int j = 0 ; j < 1000 ; j++) {
36 id1= icount++;
37 rv = table->insertTuple();
38 if (rv != OK) break;
40 if (rv != OK) break;
41 conn.commit();
43 dbMgr->closeTable(table);
44 dbMgr->dropTable("t1");
45 conn.close();
46 if (rv == ErrNoMemory) return 0; else return 1;