performance fixes and fix for core dump in test tools/csql/test029.ksh
[csql.git] / tmptest / del.c
blobf2d12e7c210bc6d18e7ada424b3a942929e5f371
1 #include <SqlStatement.h>
2 #include<NanoTimer.h>
3 int main()
5 DbRetVal rv = OK;
6 SqlConnection *con = new SqlConnection();
7 con->connect("praba", "manager");
8 SqlStatement *stmt = new SqlStatement();
9 stmt->setConnection(con);
10 char statement[1024];
11 strcpy(statement, "DELETE FROM t1 WHERE f1 =0");
12 int rows =0;
13 rv = stmt->prepare(statement);
14 if (rv != OK) {delete stmt; delete con; return 1; }
15 int id1 =100, id2 = 100;
16 int icount=0;
17 void *tuple;
18 NanoTimer timer;
19 timer.start();
20 con->beginTrans();
21 stmt->execute(rows);
22 printf(" Rows returned %d\n", rows);
23 /*while(true)
25 tuple = (char*)stmt->fetch() ;
26 if (tuple == NULL) { break; }
27 printf("f1=%d f2=%d\n", id1, id2);
28 icount++;
29 }*/
30 con->commit();
31 timer.stop();
33 printf("Select %d %lld %lld %lld\n", icount, timer.min(), timer.max(), timer.avg());
36 stmt->free();
37 delete stmt;
38 delete con;
39 return 0;