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
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to