I want to do multiple parameterized inserts with SQLite in my code. For this :
I have a single prepare statement outside of my loop as :
error = sqlite3_prepare(connection, insert_sql, strlen(insert_sql), &stmt, NULL);
I want inserts within a loop as:
while ( not reached end of datafile ) {
// Insert into server table
sqlite3_bind_int(stmt, 1, id1);
sqlite3_bind_double(stmt, 2, latitude);
sqlite3_bind_double(stmt, 3, longitude);
sqlite3_step(stmt);
}
The API docs for the function : http://ift.tt/1F8ex1U mention that :
sqlite3_step() has been called more recently than sqlite3_reset(), then the call will return SQLITE_MISUSE
Bindings are not cleared by the sqlite3_reset() routine
If any sqlite3_bind_() routine is passed a prepared statement that has been finalized, the result is undefined and probably harmful.
I am really confused as to how do I do repeated inserts with parameterized query in SQLite?
Aucun commentaire:
Enregistrer un commentaire