changeset 252:00cbec2d663a

Revoke privileges on 'transactions' table on database drop.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Fri, 04 Jan 2013 18:41:19 +0100
parents cbbc747949f9
children 8c966992e7bc
files src/ltpdarepo/database.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ltpdarepo/database.py	Thu Apr 26 19:03:39 2012 +0200
+++ b/src/ltpdarepo/database.py	Fri Jan 04 18:41:19 2013 +0100
@@ -72,13 +72,15 @@
         curs = g.db.cursor()
 
         # remove database from ltpda databases list
-        curs.execute('DELETE FROM available_dbs WHERE db_name=%s', self.id)
+        curs.execute("DELETE FROM available_dbs WHERE db_name=%s", self.id)
         # drop database
-        curs.execute('DROP DATABASE `%s`' % self.id)
-        # revoke privileges assigned for the database
-        curs.execute('DELETE FROM mysql.db WHERE Db=%s', self.id)
+        curs.execute("DROP DATABASE `%s`" % self.id)
+        # revoke privileges assigned on the database
+        curs.execute("DELETE FROM mysql.db WHERE Db=%s", self.id)
+        # revoke privileges assigned on the transactions table
+        curs.execute("DELETE FROM mysql.tables_priv WHERE Db=%s AND Table_name='transactions'", self.id)
         # flush privileges
-        curs.execute('FLUSH PRIVILEGES')
+        curs.execute("FLUSH PRIVILEGES")
 
         g.db.commit()