def insert(data): try: control.makeFile(control.dataPath) cacheFile = os.path.join(control.dataPath, 'regex.db') dbcon = database.connect(cacheFile) dbcur = dbcon.cursor() dbcur.execute("CREATE TABLE IF NOT EXISTS regex (""regex TEXT, ""response TEXT, ""UNIQUE(regex)"");") for i in data: try: dbcur.execute("INSERT INTO regex Values (?, ?)", (i['regex'], i['response'])) except: pass dbcon.commit() except: return
def _get_connection_providers(): control.makeFile(control.dataPath) conn = db.connect(control.providercacheFile) conn.row_factory = _dict_factory return conn
def _get_connection_search(): control.makeFile(control.dataPath) conn = db.connect(control.searchFile) conn.row_factory = _dict_factory return conn
def _get_connection_meta(): control.makeFile(control.dataPath) conn = db.connect(control.metacacheFile) conn.row_factory = _dict_factory return conn