Re: [sqlite] Write locking - subquery

2011-07-16 Thread Simon Slavin
On 16 Jul 2011, at 9:30pm, Kevin Martin wrote: > If I run an update query which has a subquery, will the database be > locked before the subquery is run. Yes. The transaction does the locking. The transaction encloses the entire UPDATE. If you want to do the SELECT yourself as a separate s

Re: [sqlite] Write locking - subquery

2011-07-16 Thread Kevin Martin
On 16 Jul 2011, at 21:30, Kevin Martin wrote: > insert into x values ('abc', -1); > update x set pos = 1+max(0,(select max(pos) from x)); Oops, deliberate mistake there. As I'm sure you all realise that should be update x set pos = 1+max(0,(select max(pos) from x)) where name='abc'; Kevin _