From: Stephen Morris Date: Mon, 19 Mar 2012 17:28:57 +0000 (+0000) Subject: [963] Cosmetic upgrade to some error messages X-Git-Tag: trac2351_base~226^2~116^2~95^2~2^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=538350b7db14e063f716b040a5b0f0ca2aa35278;p=thirdparty%2Fkea.git [963] Cosmetic upgrade to some error messages --- diff --git a/src/bin/dbutil/dbutil.py.in b/src/bin/dbutil/dbutil.py.in index f7056ff31a..dc71b6b35c 100755 --- a/src/bin/dbutil/dbutil.py.in +++ b/src/bin/dbutil/dbutil.py.in @@ -277,7 +277,7 @@ class Database: if self.connection is not None: self.connection.close() - def execute(self, statement, what = None): + def execute(self, statement): """ @brief Execute Statement @@ -286,8 +286,6 @@ class Database: execution. @param statement SQL statement to execute - @param what Reason for the action (used in the error message if the - action fails) """ if self.verbose: sys.stdout.write(statement + "\n") @@ -295,10 +293,8 @@ class Database: try: self.cursor.execute(statement) except Exception as ex: - if (what is None): - raise DbutilException("SQL Error - " + str(ex)) - else: - raise DbutilException("failed to " + what + " - " + str(ex)) + error("failed to execute " + statement) + raise DbutilException(str(ex)) def result(self): """ @@ -397,7 +393,7 @@ def get_version(db): """ # Check only one row of data in the version table. - db.execute("SELECT COUNT(*) FROM schema_version", "get database version") + db.execute("SELECT COUNT(*) FROM schema_version") result = db.result() if result[0] == 0: raise DbutilException("unable to determine database version - " + @@ -407,7 +403,7 @@ def get_version(db): "too many rows in schema_version table") # Get the version information. - db.execute("SELECT * FROM schema_version", "get database version") + db.execute("SELECT * FROM schema_version") result = db.result() major = result[0] if (major == 1): @@ -451,13 +447,12 @@ def perform_upgrade(db, upgrade): action = "upgrading database from " + increment info(action) for statement in upgrade['statements']: - db.execute(statement, "upgrade database from " + increment) + db.execute(statement) # Update the version information - db.execute("DELETE FROM schema_version", "update version information") + db.execute("DELETE FROM schema_version") db.execute("INSERT INTO schema_version VALUES (" + - str(upgrade['to'][0]) + "," + str(upgrade['to'][1]) + ")", - "update version information") + str(upgrade['to'][0]) + "," + str(upgrade['to'][1]) + ")") def perform_all_upgrades(db):