comparison query_db.py @ 21:357fe86f245d draft

Uploaded
author jjohnson
date Fri, 14 Jul 2017 17:34:22 -0400
parents ab27c4bd14b9
children bed5018e7ae3
comparison
equal deleted inserted replaced
20:ab27c4bd14b9 21:357fe86f245d
26 26
27 def regex_sub(expr, replace, item): 27 def regex_sub(expr, replace, item):
28 return re.sub(expr, replace, item) 28 return re.sub(expr, replace, item)
29 29
30 30
31 def get_connection(sqlitedb_path, addfunctions=False): 31 def get_connection(sqlitedb_path, addfunctions=True):
32 conn = sqlite.connect(sqlitedb_path) 32 conn = sqlite.connect(sqlitedb_path)
33 if addfunctions: 33 if addfunctions:
34 conn.create_function("re_match", 2, regex_match) 34 conn.create_function("re_match", 2, regex_match)
35 conn.create_function("re_search", 2, regex_search) 35 conn.create_function("re_search", 2, regex_search)
36 conn.create_function("re_sub", 3, regex_sub) 36 conn.create_function("re_sub", 3, regex_sub)