From 77b943e8ae97eb1a8ec08f349b882a6ef0ba13e3 Mon Sep 17 00:00:00 2001 From: polaris Date: Thu, 8 Jan 2015 17:07:56 -0500 Subject: [PATCH] Added method to close sqlite3 connection --- gamespy/gs_database.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gamespy/gs_database.py b/gamespy/gs_database.py index 9a1c714..f5d2e18 100644 --- a/gamespy/gs_database.py +++ b/gamespy/gs_database.py @@ -94,7 +94,15 @@ class GamespyDatabase(object): self.conn.row_factory = sqlite3.Row #self.initialize_database() + + def __del__(self): + self.close() + def close(self): + if self.conn != None: + self.conn.close() + self.conn = None + def initialize_database(self): with Transaction(self.conn) as tx: row = tx.queryone("SELECT COUNT(*) FROM sqlite_master WHERE name = 'users' AND type = 'table'")