4 //MAX_SYS_DB_SIZE=10485760
5 //MAX_DB_SIZE=335544320
6 //you may have to set the kernel.shmmax kernel paremeter(login as root) using
7 //$sysctl -w kernel.shmmax=1000000000
13 DbRetVal rv
= conn
.open("root", "manager");
16 printf("Error during connection %d\n", rv
);
21 DatabaseManager
*dbMgr
= conn
.getDatabaseManager();
22 if (dbMgr
== NULL
) { printf("Auth failed\n"); return -1;}
24 tabDef
.addField("f1", typeInt
, 0, NULL
, true );
25 tabDef
.addField("f2", typeString
, 6);
26 rv
= dbMgr
->createTable("t1", tabDef
);
27 if (rv
!= OK
) { printf("Table creation failed\n"); return -1; }
28 printf("Table created\n");
29 HashIndexInitInfo
*idxInfo
= new HashIndexInitInfo();
30 strcpy(idxInfo
->tableName
, "t1");
31 idxInfo
->list
.append("f1");
32 idxInfo
->indType
= hashIndex
;
33 idxInfo
->bucketSize
= 100007;
34 rv
= dbMgr
->createIndex("indx1", idxInfo
);
35 if (rv
!= OK
) { printf("Index creation failed\n"); return -1; }
36 printf("Index created\n");
38 Table
*table
= dbMgr
->openTable("t1");
39 if (table
== NULL
) { printf("Unable to open table\n"); return -1; }
41 char name
[6] = "PRABA";
42 table
->bindFld("f1", &id
);
43 table
->bindFld("f2", name
);
51 for(i
= 0; i
< 20; i
++)
54 for (int j
=0; j
< 100000; j
++)
56 rv
= conn
.startTransaction();
57 //if (rv != OK) exit(1);
59 dbMgr
->closeTable(table
);
60 dbMgr
->dropTable("t1");
65 strcpy(name
, "KARAN");
66 ret
= table
->insertTuple();
72 printf("Insert: %d %lld\n", icount
, timer
.last());
74 printf("%d rows inserted %lld %lld %lld\n",icount
, timer
.min(), timer
.max(), timer
.avg());
76 int offset1
= os::align(sizeof(int));
79 p1
.setTerm("f1", OpEquals
, &val1
);
80 table
->setCondition(&p1
);
85 for(i
= 0; i
< 20; i
++)
88 for (int j
=0 ; j
<100000; j
++)
90 rv
=conn
.startTransaction();
91 if (rv
!= OK
) exit(1);
94 tuple
= (char*)table
->fetch() ;
95 if (tuple
== NULL
) {printf("loop break in %d\n", i
);table
->closeScan();break;}
96 // printf(" %d tuple value is %d %s \n", i, *((int*)tuple), tuple+offset1);
102 printf("Select: %d %lld\n", icount
, timer
.last());
104 printf("%d rows selected %lld %lld %lld\n", icount
, timer
.min(), timer
.max(), timer
.avg());
107 dbMgr
->closeTable(table
);
108 dbMgr
->dropTable("t1");
109 printf("Table dropped\n");