Add insert method

Method inserts log entry to database
This commit is contained in:
George Lacey 2016-09-20 20:55:25 +01:00
parent 75beecf584
commit f6bd684b97

View File

@ -34,3 +34,14 @@ class Database(object):
return False
else:
return True
def insert(self, log_entry, table):
result = self.conn.execute("""INSERT INTO %s(NAME,
FINGERPRINT, START_TIME, DURATION, FILE_COUNT) VALUES(?,?,?,?,?)"""
% table,
(log_entry.name,
log_entry.fingerprint,
log_entry.datetime_string(),
"1",
log_entry.file_count))
self.conn.commit()