On Fri, Nov 4, 2011 at 6:59 PM, Paxdo Presse <pa...@mac.com> wrote:

>
> Hello,
>
> a question from beginner please :
>
> In this transaction (with wal-mode) :
>
>
> BEGIN TRANSACTION
>
> INSERT INTO....
>
> SELECT last_insert_rowid()
>
> COMMIT
>
>
> Are we sure that another process is not going to create another row
> between my "INSERT" and "SELECT LAST ROWID"?
>

Yes.  Isolation in SQLite is SERIALIZABLE.



> The "LAST ROWID" is it for sure the id of "INSERT INTO" of the transaction?
>

Yes.  Actually, this is true even without the BEGIN...COMMIT.  The
last_insert_rowid() is the rowid of the most recent insert on the same
database connection.



>
> In fact, is the lock that starts with INSERT is set to COMMIT? Or the
> write lock is it only when the INSERT? (so no lock between INSERT and
> COMMIT)
>

I do not exactly understand the question, so I'm guessing:  The lock that
is acquire at INSERT is held until COMMIT.



>
> Thank you
>
> olivier
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to