diff --git a/astrodatagui/db/StarsDB.py b/astrodatagui/db/StarsDB.py index 86f44ec..4722477 100644 --- a/astrodatagui/db/StarsDB.py +++ b/astrodatagui/db/StarsDB.py @@ -26,6 +26,7 @@ class StarDB(): if(dbName in StarDB.__dbNames): raise Exception(f"StarDB {dbName} cannot be instantiated more than once!") else: + self.dbName = dbName StarDB.__dbNames.append(dbName) StarDB.__instances.append(self) @@ -42,6 +43,11 @@ class StarDB(): else: self.initializeDB() + def close(self): + StarDB.__instances.remove(self) + StarDB.__dbNames.remove(self.dbName) + self.connection.close() + def initializeDB(self): print("Initializing database") self.dbCursor.execute("""CREATE TABLE IF NOT EXISTS starnames