Adding data type tests
[csql.git] / tmptest / upd.c
blob99c3d0c14d412d71d2ad93d111fe9e12357c26c6
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, "UPDATE t1 SET f2 = 299 WHERE f1 >97");
12 strcpy(statement, "UPDATE t1 SET f1=? WHERE f2 > ?");
13 int rows =0;
14 rv = stmt->prepare(statement);
15 if (rv != OK) {delete stmt; delete con; return 1; }
16 int id1 =160, id2 = 96;
17 stmt->bindParam(1, &id1);
18 stmt->bindParam(2, &id2);
19 int icount=0;
20 void *tuple;
21 NanoTimer timer;
22 timer.start();
23 con->beginTrans();
24 stmt->execute(rows);
25 con->commit();
26 timer.stop();
28 printf("Update %d %lld %lld %lld\n", rows, timer.min(), timer.max(), timer.avg());
30 stmt->free();
31 delete stmt;
32 delete con;
33 return 0;