"Rich Rattanni" <[EMAIL PROTECTED]> wrote:
> All:
>     I am using SQlite to store several rows of binary data into a
> database.  In my code I have a several character arrays containing
> data.  I then do the following...
> 
> 1.Begin Transaction
> 2.For each blob...
> 2a.sqlite3_prepare("Insert statement...")
> 2b.call sqlite3_bind_blob(stmt, col#, dataPointer, sizeOfData, 
> SQLITE_TRANSIENT)
> 2c.sqlite3_step()
> 2d.end
> 3.Free data pointers.
> 4.Commit Transaction
> 
> This code segfaults.   Now If i move the free data pointers to outside
> the commit, everything is fine.  According to the API documentation,
> "If the fifth argument has the value SQLITE_TRANSIENT, then SQLite
> makes its own private copy of the data immediately, before the
> sqlite3_bind_*() routine returns."  I may be misinterperting the
> documentation, or perhaps this is a bug in sqlite (course I am
> assuming the former is true).
> 
> Could anyone shed some light on my mystery?  I am wondering if I need
> to enable (when sqlite is compiled) support for SQLITE_TRANSIENT?
> 

The documentation is correct - SQLITE_TRANSIENT causes SQLite
to make a copy of the data before sqlite3_bind_blob() returns.
You should be able to free the dataPointer prior to the sqlite3_step().
No special compile-time optimizations are required.

If you have a reproducible test case, we will look into the problem.

--
D. Richard Hipp <[EMAIL PROTECTED]>


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to