Author: duncan
Date: Sun Jun 17 10:05:31 2007
New Revision: 9716

Modified:
   branches/rel-1/freevo/src/audio/plugins/album_tree.py
   branches/rel-1/freevo/src/util/dbutil.py

Log:
Corrected shutdown to close the database first


Modified: branches/rel-1/freevo/src/audio/plugins/album_tree.py
==============================================================================
--- branches/rel-1/freevo/src/audio/plugins/album_tree.py       (original)
+++ branches/rel-1/freevo/src/audio/plugins/album_tree.py       Sun Jun 17 
10:05:31 2007
@@ -200,6 +200,13 @@
         else:
             self.load_spec(config.AUDIO_ALBUM_TREE_SPEC)
 
+    def shutdown(self):
+        """
+        shut down the sqlite database
+        """
+        _debug_('shutdown', 2)
+        db.close()
+
     def load_spec(self,spec_list):
         """
         load definitions from config

Modified: branches/rel-1/freevo/src/util/dbutil.py
==============================================================================
--- branches/rel-1/freevo/src/util/dbutil.py    (original)
+++ branches/rel-1/freevo/src/util/dbutil.py    Sun Jun 17 10:05:31 2007
@@ -2,7 +2,7 @@
 # -----------------------------------------------------------------------
 # util/dbutil.py - database wrapper
 # -----------------------------------------------------------------------
-# $Id: dbutil.py,v #
+# $Id$
 #
 # Notes:
 # Todo:
@@ -88,7 +88,9 @@
         self.cursor = self.db.cursor()
 
     def runQuery(self,query, close=False):
+        '''Execute a sql query on the database'''
         try:
+            _debug_('query=%s' % (query))
             self.cursor.execute(query)
         except TypeError:
             traceback.print_exc()
@@ -104,10 +106,13 @@
             return self.cursor.fetchall()
 
     def close(self):
-        self.db.commit()
-        self.db.close()
+        '''close the database, committing any open transactions first'''
+        if not self.db.closed:
+            self.db.commit()
+            self.db.close()
 
     def commit(self):
+        '''commit transactions'''
         self.db.commit()
 
     def checkTable(self,table=None):

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to