Hum.. I'm sorry but I've followed your explanations, but I can't use it as I
want..

The code is really simple : 

  int i =0;
  for(i=0;i<=3;i++)
  {
    sqlite3_step(Stmt);
    callback;
  }

 sqlite3_reset(Stmt); (And after, _finalize, when I don't need it anymore).

Is there an error in it?

I've only one line in my table, ans 4 columns, that's why I've done i=0 to
3.




Simon Slavin-3 wrote:
> 
> 
> 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
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Prepare-and-exec-tp31681326p31681900.html
Sent from the SQLite mailing list archive at Nabble.com.

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

Reply via email to