Unverified Commit b2649783 authored by CHARLES's avatar CHARLES 🐧
Browse files

Code cleaning

parent 5824ff38
......@@ -22,7 +22,7 @@ FILE_URL_SEPARATOR = " -|- "
class Constant(object):
# SQLite table: constants_infos
# Database table: constants_infos
def __init__(self, id_execution, title, data, id=None):
self.id = id
self.id_execution = id_execution
......@@ -37,7 +37,7 @@ class Constant(object):
class ExecInfo(object):
# SQLite table: exec_infos
# Database table: exec_infos
def __init__(self, id_execution, date, title, data, id=None):
assert date is None or isinstance(date, datetime)
self.id = id
......@@ -54,7 +54,7 @@ class ExecInfo(object):
class Execution(object):
# SQLite table: executions
# Database table: executions
def __init__(self, date_start, date_stop, valid_execution, id=None):
assert isinstance(date_start, datetime)
assert date_stop is None or isinstance(date_stop, datetime)
......@@ -71,7 +71,7 @@ class Execution(object):
class File(object):
# SQLite table: files
# Database table: files
def __init__(self, id_execution, filename, isDirectory, isSymLink, size, mtime, sensingtime):
assert mtime is None or isinstance(mtime, datetime)
assert sensingtime is None or isinstance(sensingtime, datetime)
......@@ -152,13 +152,10 @@ class SqliteBaseFilesInfos(object):
pg.paramstyle = "qmark"
log.debug("Open SQLite db: %s", self.database_path)
log.debug("Open PGSQL db: %s", self.database_path)
self.connection = pg.connect(user="downloader_daemon", host="127.0.0.1", database="downloader_bfi")
# self.connection = pg.connect(self.database_path, detect_types=sqlite3.PARSE_DECLTYPES)
# self.connection.row_factory = sqlite3.Row
cursor = self.connection.cursor()
# cursor.execute("PRAGMA foreign_keys=ON")
dbVersion = 0
try:
......@@ -167,7 +164,6 @@ class SqliteBaseFilesInfos(object):
if res is not None:
dbVersion = int(res[0])
except pg.DatabaseError:
# except pg.OperationalError:
self.connection.rollback()
log.debug("%s version is %d", self.database_path, dbVersion)
......@@ -247,9 +243,6 @@ class SqliteBaseFilesInfos(object):
valid_execution=None,
)
eDict = e.toDict()
# paramList = []
# for i in range(0, len(eDict.keys())):
# paramList.append(":%d" % (i + 1))
cursor = self.connection.cursor()
cursor.execute(
......@@ -306,9 +299,6 @@ class SqliteBaseFilesInfos(object):
sensingtime=file.sensingtime,
)
fDict = f.toDict()
# paramList = []
# for i in range(0, len(fDict.keys())):
# paramList.append(":%d" % (i + 1))
cursor = self.connection.cursor()
cursor.execute(
......@@ -328,9 +318,6 @@ class SqliteBaseFilesInfos(object):
data=data,
)
cDict = c.toDict()
# paramList = []
# for i in range(0, len(cDict.keys())):
# paramList.append(":%d" % (i + 1))
cursor = self.connection.cursor()
cursor.execute(
......@@ -353,9 +340,6 @@ class SqliteBaseFilesInfos(object):
data=data,
)
eiDict = ei.toDict()
# paramList = []
# for i in range(0, len(eiDict.keys())):
# paramList.append(":%d" % (i + 1))
cursor = self.connection.cursor()
cursor.execute(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment