[web2py] Re: lock table possible?

2012-10-16 Thread vince
well, i think i did some test before and update from other connect was allowed in between the query and update. i will test it again with a time.sleep in between. On Wednesday, October 17, 2012 3:19:42 AM UTC+8, Niphlod wrote: > > Disclaimer: I may be wrong > Reading your example code, you a

[web2py] Re: lock table possible?

2012-10-16 Thread Niphlod
Disclaimer: I may be wrong Reading your example code, you are updating a single record. If done in a single request, web2py wraps all commands in a transaction. In your code, that means that when you want to remove from photolist an item of your publication row, that operation is atomic. Why

[web2py] Re: lock table possible?

2012-10-16 Thread vince
forget it. it's weird that read lock for mysql is read only, i have to obtain write lock. it seems not possible to block write access only. On Wednesday, October 17, 2012 2:55:49 AM UTC+8, vince wrote: > > i tried to lock table but with error > (1099, u"Table > 'publication' was locked with

[web2py] Re: lock table possible?

2012-10-16 Thread vince
i tried to lock table but with error (1099, u"Table 'publication' was locked with a READ lock and can't be updated") db.executesql('LOCK TABLE publication READ;') result = db(db.publication.id==pubid).select()[0] newlist = result.photo_list newlist.remove(int(pid)) db(db.publicati

[web2py] Re: lock table possible?

2012-10-12 Thread Massimo Di Pierro
Open a ticket and we will look to include it. The problem is that not all databases support it. On Friday, 12 October 2012 20:47:06 UTC-5, vince wrote: > > oh db.executesql, thx. > > will we have any table locking implement on web2py? say an option to lock > all queried table read only until com

[web2py] Re: lock table possible?

2012-10-12 Thread vince
oh db.executesql, thx. will we have any table locking implement on web2py? say an option to lock all queried table read only until commit? On Thursday, October 11, 2012 9:32:14 PM UTC+8, Massimo Di Pierro wrote: > > You can try: > > db.executesql('LOCK TABLE tablename READ;') > > > http://aark

[web2py] Re: lock table possible?

2012-10-11 Thread Massimo Di Pierro
You can try: db.executesql('LOCK TABLE tablename READ;') http://aarklondatabasetrivia.blogspot.com/2009/04/how-to-lock-and-unlock-tables-in-mysql.html On Thursday, 11 October 2012 01:44:14 UTC-5, vince wrote: > > can i lock a table as readonly during the transaction? the case is i need > to i