On 29 Apr 2013, at 8:56pm, Igor Korot <[email protected]> wrote:

> Yes, I read this link. But I don't understand how it applies here.
> Can you make some pseudo code, please?

I'm sorry, but if you're using a class someone else wrote you may not be able 
to use sqlite3_reset().  It depends on what the class assumes about _step().

The idea is that instead of

_prepare(statement1)
_step(statement1), _step(statement1) ...
_finalize(statement1)

_prepare(statement2)
_step(statement2), _step(statement2) ...
_finalize(statement2)

you can do this

_prepare(statement1)
_step(statement1), _step(statement1) ...
_reset(statement1)
_bind(statement1)
_step(statement1), _step(statement1) ...
_finalize(statement1)

As you correctly noted, it's the _prepare() step that takes a lot of time.  
This second form conforms to your original request

> Problem is sqlite3_prepare_v2() wastes time by compiling SQL statements and
> I'd like to avoid it by making this call only once and just
> bind the appropriate parameters on each loop iteration.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to