RAKESH HEMRAJANI <[email protected]> wrote:
> int i=0;
> rc = sqlite3_exec(db, "insert into emp values(i);", 0, 0, &zErrMsg);
Use sqlite3_prepare_v2, sqlite3_step, sqlite3_bind_* et al to run a
parameterized query. Something like this:
sqlite3_stmt* stmt;
sqlite3_prepare_v2(db, "insert into emp values(?);", -1, &stmt, NULL);
for (int i = 0; i < 10; ++i) {
sqlite3_bind_int(stmt, 1, i);
sqlite3_step(stmt);
sqlite3_reset(stmt);
}
sqlite3_finalize(stmt);
This example also shows how you can run the same statement multiple times with
different values for parameters.
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users