sqlite single transaction without foreign key or triggers

Aahz aahz at pythoncraft.com
Tue May 12 04:50:08 CEST 2009


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".
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan



More information about the Python-list mailing list