sqlite single transaction without foreign key or triggers

Rob Williscroft rtw at freenet.co.uk
Tue May 12 02:56:50 EDT 2009


Aahz wrote in news:guao50$1jv$1 at panix3.panix.com in comp.lang.python:

> In article <Xns9C08E179B66D8rtwfreenetREMOVEcouk at 216.196.109.145>,
> Rob Williscroft  <rtw at freenet.co.uk> wrote:
>>
>>db.execute( '''
>>         update "sessions" set "uid" = ?
>>         where "uid" = ? 
>>         and exists(
>>                  select * from "users" where "uid" = ?
>>           )
>>    ''',
>>    (v['uid'],s.SID, v['uid']) 
>>  )
> 
> This will be more efficient if you do "select uid from users".

What will be more efficient ?

Do you mean the "select * ..." or do you want to take the exists 
sub-query out and put it in a python if ? 

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/



More information about the Python-list mailing list