sqlite3_column_blob(...) and finalize

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

sqlite3_column_blob(...) and finalize

Aidan Reel
Hi

I have a select statement that returns some BLOBs.

When I finalize the select statement, the memory pointed to
by the pointer returned by

const void * sqlite3_column_blob(...)


is cleared.

Is this the expected behaviour?

What should I do in order to obtain a pointer to memory that is
under my control with regard to freeing  it
a later time?


Thanks in advance


Aidan

Reply | Threaded
Open this post in threaded view
|

Re: sqlite3_column_blob(...) and finalize

Dan Kennedy
> When I finalize the select statement, the memory pointed to
> by the pointer returned by
>
> const void * sqlite3_column_blob(...)
>
> is cleared.
>
> Is this the expected behaviour?

The pointers returned by column_blob(), column_text() and column_text16()
are only valid until the next call to sqlite3_step(), reset() or finalize()
on the statement handle.

> What should I do in order to obtain a pointer to memory that is
> under my control with regard to freeing  it
> a later time?

I don't think you can do that. You might have to take a copy the blob.



               
____________________________________________________
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
http://football.fantasysports.yahoo.com