SQLite Forum

Slow insert with prepare/step
Login
Enclosing the loop in Test2() between

`sqlite3_exec(db, "BEGIN TRANSACTION;", NULL, NULL, NULL);`

and

`sqlite3_exec(db, "COMMIT;", NULL, NULL, NULL);`

should be sufficient.

If the code is going to be used in production, you'll need robust error handling for sqlite3_exec() returns.