From 45b4d2f853a25f12da61ba9098e95bc4a7a31a8a Mon Sep 17 00:00:00 2001 From: Massimo DiPierro Date: Tue, 28 Feb 2012 10:18:23 -0600 Subject: [PATCH] fixed sqlite regex --- VERSION | 2 +- gluon/dal.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 31297b58..41c6756e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.4 (2012-02-28 10:10:28) stable +Version 1.99.4 (2012-02-28 10:18:22) stable diff --git a/gluon/dal.py b/gluon/dal.py index a1e83855..f3b8b825 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -1693,6 +1693,10 @@ class SQLiteAdapter(BaseAdapter): except: return None + @staticmethod + def web2py_regexp(expression, item): + return re.compile(expression).search(item) is not None + def __init__(self, db, uri, pool_size=0, folder=None, db_codec ='UTF-8', credential_decoder=lambda x:x, driver_args={}, adapter_args={}): @@ -1719,7 +1723,10 @@ class SQLiteAdapter(BaseAdapter): def connect(dbpath=dbpath, driver_args=driver_args): return self.driver.Connection(dbpath, **driver_args) self.pool_connection(connect) - self.connection.create_function('web2py_extract', 2, SQLiteAdapter.web2py_extract) + self.connection.create_function('web2py_extract', 2, + SQLiteAdapter.web2py_extract) + self.connection.create_function("REGEXP", 2, + SQLiteAdapter.web2py_regexp) def _truncate(self, table, mode=''): tablename = table._tablename