define a regexp function in sqlite
This commit is contained in:
parent
8fbd58e2c6
commit
487e997a55
@ -49,6 +49,12 @@ class Module(object):
|
|||||||
self.conn = sqlite3.connect(dbfile)
|
self.conn = sqlite3.connect(dbfile)
|
||||||
self.conn.row_factory = sqlite3.Row
|
self.conn.row_factory = sqlite3.Row
|
||||||
|
|
||||||
|
# setup regexp function in sqlite
|
||||||
|
def regexp(expr, item):
|
||||||
|
reg = re.compile(expr)
|
||||||
|
return reg.match(item) is not None
|
||||||
|
self.conn.create_function('REGEXP', 2, regexp)
|
||||||
|
|
||||||
# set up database for this module
|
# set up database for this module
|
||||||
self.db_init()
|
self.db_init()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user