1 #include<SqlStatement.h>
6 SqlConnection *con = new SqlConnection();
7 con->connect("root", "manager");
9 SqlStatement *stmt = new SqlStatement();
10 stmt->setConnection(con);
12 //strcpy(statement, "INSERT INTO t1 (f1, f2) VALUES (100, 200);");
13 strcpy(statement, "INSERT INTO t1 (f1, f2, f3) VALUES (?, ?, ?);");
14 //strcpy(statement, "INSERT INTO t1 VALUES (100, 200);");
15 //strcpy(statement, "INSERT INTO t1 ");
17 rv = stmt->prepare(statement);
18 printf("Prepeared\n");
19 int id1 =100, id2 = 100;
20 if (rv != OK) {delete stmt; delete con; return -1; }
22 for (int i = 0 ; i < 100000 ; i++)
27 stmt->setIntParam(1, id1);
28 stmt->setIntParam(2, id1);
29 stmt->setIntParam(3, id1);
35 //{printf("Sleeping\n"); sleep(10);}
36 printf("Insert %lld %lld %lld\n", timer.min(), timer.max(), timer.avg());