Added a delete database function
This commit is contained in:
@ -9,6 +9,11 @@ class SQL_Database:
|
|||||||
|
|
||||||
sql_type_list = [int, float, str]
|
sql_type_list = [int, float, str]
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.conn = None
|
||||||
|
self.config_id = None
|
||||||
|
self._database_name = 'database.db'
|
||||||
|
|
||||||
def default_config_id(method):
|
def default_config_id(method):
|
||||||
"""Decorator used to set the default config_id"""
|
"""Decorator used to set the default config_id"""
|
||||||
|
|
||||||
@ -37,13 +42,6 @@ class SQL_Database:
|
|||||||
|
|
||||||
return new_method
|
return new_method
|
||||||
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.conn = None
|
|
||||||
self.config_id = None
|
|
||||||
self._database_name = 'database.db'
|
|
||||||
|
|
||||||
|
|
||||||
def get_current_config(self):
|
def get_current_config(self):
|
||||||
"""Get the current config_id from the config table."""
|
"""Get the current config_id from the config table."""
|
||||||
return self.query_one_item("SELECT MAX(id) FROM config")
|
return self.query_one_item("SELECT MAX(id) FROM config")
|
||||||
@ -226,6 +224,10 @@ class SQL_Database:
|
|||||||
cur.execute(query)
|
cur.execute(query)
|
||||||
return cur.fetchone()
|
return cur.fetchone()
|
||||||
|
|
||||||
|
def remove_database(self):
|
||||||
|
"""Remove the current database file using the database_name attribute."""
|
||||||
|
os.remove(self._database_name)
|
||||||
|
|
||||||
|
|
||||||
def past_runs(self):
|
def past_runs(self):
|
||||||
"""Show a summerization of the past runs that the user has done."""
|
"""Show a summerization of the past runs that the user has done."""
|
||||||
|
|||||||
Reference in New Issue
Block a user