It's not too hard.

Instantiante a static class method that matches the sqlite callback signature.  

When you register the callback with sqlite, you'll want to pass in the
this pointer to the instantiated class.

Within the static class method, cast the void pointer back to the
instantiated class, and reenter the class through an internal
(non-static) method.

Push all the results you find into the class member variables, and
voila, you have your container holding all results.

Be careful not to muck with the instatiated class object from other
threads much, though.

--Keith

On 8/26/05, Jay Sprenkle <[EMAIL PROTECTED]> wrote:
> On 8/26/05, Cam Crews <[EMAIL PROTECTED]> wrote:
> > Hi.  I'm new to sqlite and would like to use the sqlite C++ API to
> > return multiple rows from a SELECT statement.  I'm able to load a
> > single row's result into a struct & pass it back by reference through
> > the callback, but haven't been able to find any resources recommending
> > a method for returning *multiple* results (rows).  Anyone know if
> > there are sample code/suggestions for getting this to work?  I've thus
> > far seen only rudementry examples of printing results to stdout from
> > the callback.
> >
> > If these resources aren't already out there, I'll consider writing a
> > tutorial on performing this using a vector of structs...  thanks,
> 
> If you're using c++ you probably don't want to use the callback
> for retrieving results. It's difficult to reference members of an
> instantiated class from a callback. use sqlite_step().
> I used stl vectors to store my results.
> 
> 
> ---
> The Castles of Dereth Calendar: a tour of the art and architecture of
> Asheron's Call
> http://www.lulu.com/content/77264
>

Reply via email to