We most certainly are using sqlite3_prepare_v2.  This use case is a
bit more exotic.

We are currently working on an async database access API (discussion
thread [1]).  The idea is to have a user prepare and bind parameters
on the calling thread, then clone that statement to send it to the
background thread that will process the results.  Since a statement
object can only be accessed on one thread at a time (at least that's
my understanding of it), the original statement is still usable on the
calling thread (and could be used again immediately even if the other
thread is doing work).

Cheers,

Shawn

[1] 
http://groups.google.com/group/mozilla.dev.planning/browse_thread/thread/045fed0ecba487cc

On Tue, May 13, 2008 at 2:18 PM, D. Richard Hipp <[EMAIL PROTECTED]> wrote:
>
> On May 13, 2008, at 2:05 PM, Shawn Wilsher wrote:
>
>> I was looking through the documentation and was wondering why
>> sqlite3_transfer_bindings has been marked as obsolete.  It's something
>> that we use currently in our code, and I was looking to use it again
>> for something new.  Is there a new way to accomplish the same thing
>> that this function does?  What was the rational for removing it.
>>
>> If you need a use case for why Mozilla needs it, I'd be happy to
>> oblige.
>>
>
>
> We strive to avoid incompatibilities.  So even though
> sqlite3_transfer_bindings() is marked as obsolete, that just means (in
> the words of the documentation) that we are not going to tell you want
> it does.  :-)  It isn't going away.  There are tests in the test suite
> to make sure it works.
>
> sqlite3_transfer_bindings() was intended for use with
> sqlite3_prepare() when sqlite3_step() returns SQLITE_SCHEMA.  After
> the schema error, one creates a new prepared statement from the
> original SQL, uses sqlite3_transfer_bindings() to move the bindings
> from the old prepared statement to the new, finalizes the old prepared
> statement, then retries with the new prepared statement.  But all of
> that was made obsolete by sqlite3_prepare_v2().  Sqlite3_prepare_v2(),
> you will recall, handles the SQLITE_SCHEMA errors automatically so the
> use of sqlite3_transfer_bindings() is no longer required.
>
> I am curious to know what alternative use Mozilla has found for
> sqlite3_transfer_bindings(), though.  You are using
> sqlite3_prepare_v2() in place of sqlite3_prepare() I trust.  You
> should be if you are not since applications that use
> sqlite3_prepare_v2() are less prone to bugs in error handling logic
> (by virtue of the fact that they can essentially ignore SQLITE_SCHEMA).
>
> D. Richard Hipp
> [EMAIL PROTECTED]
>
>
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to