"Ahmed Sulaiman" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have tried this question in the forum with no answer, so I decide to
> give it a try here :)
>
> I am using the "Using" statements in C# to handle the closing of SQLite
> connection, transaction and command objects. I have this setup in
> different places in my code (Generic methods returning SQLite objects)
>
> using (IDbConnection conn = CreateConnection())
> {
> conn.Open();
> using (IDbTransaction transaction = conn.BeginTransaction())
> {
> Dosomething();
> transaction.Commit();
> }
> }
>
> My question, what happens if there was an exception inside the
> transaction using block? I know that the transaction object would be
> closed and disposed, but does the traction roll back automatically by
> the SQLite engine, or do I need to have special logic for that? What is
> the suggested best practices in this case?
>
In the equivalent code in TCL, the transaction would
rollback automatically. But I do not know anything
about the C# bindings that you are using, so I do not
know what will happen in your case. Have you tried it
to see? What does the documentation that comes with
your SQLite C# bindings say? It is the C# bindings,
not the SQLite core, that will determine this behavior.
--
D. Richard Hipp <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------