Why is this treated as a a single transaction?

Sreekumar
On Feb 6, 2012 6:27 PM, "Igor Tandetnik" <itandet...@mvps.org> wrote:

> Sreekumar TP <sreekumar...@gmail.com> wrote:
> > I have a nested transaction as follows -
> >
> > sqlite3_prepare_v2(db, stmt1..)
> > sqlite3_prepare_v2(db, stmt2..)
> >
> > sqlite3_step(stmt1)
> >   sqlite3_step(stmt2)
> >  sqlite3_reset(stmt2)
> > sqlite3_step(stmt1)
>
> There is only one transaction here - an implicit one, started by
> sqlite3_step(stmt1).
>
> > (1) SQLITE , as I understand does not support nested transaction
>
> Correct.
>
> > hence the
> > the above statement should have caused error
>
> Should not. The conclusion doesn't follow from the premise.
>
> > (2)  A transaction is complete only when sqlite3_reset is called.
>
> To be precise, an implicit transaction is committed when there are no more
> outstanding statements on a connection, that is, when the last active
> statement is reset or finalized. See
>
> http://sqlite.org/lang_transaction.html
>
> in particular the part about implicit transactions.
>
> > Hence the
> > sqlite3_step(stmt2) should have returned a "database locked" error.
>
> Should not. The conclusion doesn't follow from the premise.
>
> > Is SQLITE doing something under the hood ?
>
> SQLite is doing a lot under the hood. Is there anything in particular
> you'd like to know about?
> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to