Toby Roworth wrote:
> 
> Looking at the API reference. it would apear you can send an extra 
> "custom" argument to the callback fro sqlite3_exec, using the 4th 
> parameter - how does this work, 

It works well. :-)

> and inperticular, could I pass an object 
> through to the call back, 

Yes.

> and if so, how?
> 

You need to cast a pointer to your object to a void pointer in order to 
pass it to sqlite3_exec(). Sqlite3_exec() will pass this void pointer as 
the first argument to your callback function. Inside the callback 
function you need to cast the void pointer argument back to an object 
pointer. Now you can use the object pointer to call object methods etc.

Note, the callback function itself can be an object method, but if so, 
it must be a static method (i.e. no this pointer). You can effectively 
pass the object's instance pointer through to the callback method using 
the context argument above. Then you can call the instance methods for 
that particular object.

HTH
Dennis Cote
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to