File Removed
[csql.git] / tmptest / upd.c
blob1dcfbf5b4d6e1d8637beb34cf06a67960b69d7d8
1 #include <SqlStatement.h>
2 #include<NanoTimer.h>
3 int main()
5 DbRetVal rv = OK;
6 SqlConnection *con = new SqlConnection();
7 con->connect("root", "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=290 WHERE f2 > ?");
13 strcpy(statement, "UPDATE t1 SET f2 = 290 ");
14 int rows =0;
15 rv = stmt->prepare(statement);
16 if (rv != OK) {delete stmt; delete con; return 1; }
17 int id1 =160, id2 = 7;
18 //stmt->bindParam(1, &id1);
19 //stmt->bindParam(2, &id2);
20 int icount=0;
21 void *tuple;
22 NanoTimer timer;
23 timer.start();
24 con->beginTrans();
25 stmt->execute(rows);
26 con->commit();
27 timer.stop();
29 printf("Update %d %lld %lld %lld\n", rows, timer.min(), timer.max(), timer.avg());
31 stmt->free();
32 delete stmt;
33 delete con;
34 return 0;