From 14b6cc5650f3ba91e3145f94f33cc97c9e30034b Mon Sep 17 00:00:00 2001 From: mdipierro Date: Tue, 17 Jul 2012 17:11:23 -0500 Subject: [PATCH] fixed issue 864, thanks Niphlod --- VERSION | 2 +- gluon/dal.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 39753ff6..5d5a641e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.00.0 (2012-07-17 16:15:26) dev +Version 2.00.0 (2012-07-17 17:11:20) dev diff --git a/gluon/dal.py b/gluon/dal.py index d1203c52..b652126e 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -1878,17 +1878,15 @@ class SQLiteAdapter(BaseAdapter): return '(%s REGEXP %s)' % (self.expand(first), self.expand(second,'string')) - def _select(self, query, fields, attributes): + def select(self, query, fields, attributes): """ Simulate SELECT ... FOR UPDATE with BEGIN IMMEDIATE TRANSACTION. Note that the entire database, rather than one record, is locked (it will be locked eventually anyway by the following UPDATE). """ - sql = super(SQLiteAdapter, self)._select(query, fields, attributes) - if attributes.get('for_update', False): - sql = 'BEGIN IMMEDIATE TRANSACTION; ' + sql - return sql - + if attributes.get('for_update', False) and not 'cache' in attributes: + self.execute('BEGIN IMMEDIATE TRANSACTION;') + return super(SQLiteAdapter, self).select(query, fields, attributes) class SpatiaLiteAdapter(SQLiteAdapter):