D. Richard Hipp wrote:
On Thu, 2005-03-31 at 17:08 -0500, Kervin L. Pierre wrote:

Are there plans for supporting nested transactions
in the future?


No.


Shucks. :)


Instead of calling sqlite3_exec("BEGIN") and sqlite3_exec("END") directly, put them in a wrapper function that counts the number of nested invocations. Only execute the SQL at the top level.

Thanks for that workaround. I will to to make that work but...

It gets hairy when the API needs
to be thread safe and the function
prototypes are dictated to you. Eg.
a plugin for a multithreaded
application.

One alternative seems to be to
serialize access to the counter
variable.  But I'd like to avoid
that for performance and debugging
reasons.

Having an internal version of each
function that takes those SQLite
parameters, and having the external
version call those only with the
sqlite helper object, seems like a
fix as well.

Please let me know what you think...

internal_func1( sqliteHelper *sql, int param, ....){

        some_Other_Object_That_Also_Uses_SQLite *otherObj;
        otherObj->internal_func1(sql, ....);
        [...]
}

exposed_func1( int param, ....){
        sqliteHelper *sql;
        
        sql->Begin();
        internal_func1(sql, param, ...)
        sql->End();
}

But that requires a lot of code for
a single problem. Is there an
elegant solution?

-
Kervin




Reply via email to