On Aug 19, 2009, at 12:35 AM, Pavel Ivanov wrote:

> You can always do
>
> insert into table (id, count) values (?1, (select count(*) + 1 from
> table where id = ?1))
>
> Though I'd be cautious about race condition that seems like possible
> here when after select returned some value and before insert was made
> another process made another insert with the same id...

Cannot happen. If not executed within an implicit transaction, each
SQL statement is effectively wrapped in a transaction all of its own.

Dan.

_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to