From ae47cc326f06dfe56f249c4713ea864e7d951f80 Mon Sep 17 00:00:00 2001 From: Paolo Bolettieri Date: Wed, 7 Sep 2022 11:15:49 +0200 Subject: [PATCH] Eliminare 'src/LFDB.py' --- src/LFDB.py | 55 ----------------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 src/LFDB.py diff --git a/src/LFDB.py b/src/LFDB.py deleted file mode 100644 index da368d5..0000000 --- a/src/LFDB.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -import sqlite3 -from sqlite3 import Error -from werkzeug.datastructures import FileStorage - - -class LFDB: - - def __init__(self, db_path): - # self.lf = LFUtilities.load(settings.DATASET_BEBLID) - # self.ids = np.loadtxt(settings.DATASET_IDS, dtype=str).tolist() - # self.bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True) - self.conn = sqlite3.connect(db_path, check_same_thread=False) - - def close(self): - if self.conn: - self.conn.close() - - def put(self, docId, features): - try: - self.conn.text_factory = str - #print("[INFO] : Successful connection!") - cur = self.conn.cursor() - insert_file = '''INSERT INTO lf(docId, features) VALUES(?, ?)''' - cur = self.conn.cursor() - cur.execute(insert_file, (docId, features,)) - #print("[INFO] : The blob for ", docId, " is in the database.") - except Error as e: - print(e) - - def commit(self): - try: - if self.conn: - self.conn.commit() - print("committing...") - except Error as e: - print(e) - - def get(self, docId): - try: - self.conn.text_factory = str - cur = self.conn.cursor() - # print("[INFO] : Connected to SQLite to read_blob_data") - sql_fetch_blob_query = """SELECT * from lf where docId = ?""" - cur.execute(sql_fetch_blob_query, (docId,)) - record = cur.fetchall() - for row in record: - converted_file_name = row[1] - blob = row[2] - # parse out the file name from converted_file_name - cur.close() - except sqlite3.Error as error: - print("[INFO] : Failed to read blob data from sqlite table", error) - return blob -