On 23 May 2011, at 2:05pm, Dev_lex wrote:
> Well I know that _step is not a callback, but I have a callback to call..
> With _exec I can call it without any problem, because I can pass it in the
> third argument.. But with the _prepare and _step method, I don't know how to
> bind my callback with the SELECT statement.. ?
The _exec() function involves many calls to _step(). It does something like
this:
sqlite3_prepare_v2()
ONE OR MORE TIMES:
sqlite3_step()
call your callback function
sqlite3_finalize()
(I have omitted result-checking for clarity). With _exec, as above, you can
supply a callback and _exec() will call it immediately after each time it calls
_step().
But if you're calling _step(), then instead of calling _exec() you are calling
each of these three functions yourself, (i.e. writing your own C code to
implement the above pseudocode). You don't need a callback function because
you can put whatever code you want after calling _step(). And before it. It
could be one line that just calls another function, or many lines with whatever
logic you like.
There are other places for callback functions which are called while aggregate
functions are evaluated, or long procedures are being run, or to handle _BUSY
errors, or at various other times. But you don't seem to be referring to
these. If I misunderstood, please post again.
Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users