diff --git a/product/ZMySQLDA/db.py b/product/ZMySQLDA/db.py
index fadb5cc1098ab0fc78b3aacd0df5fb836a2822c9..80858aaf55bc6da2ea66d5f402de74955b4c3bce 100644
--- a/product/ZMySQLDA/db.py
+++ b/product/ZMySQLDA/db.py
@@ -406,8 +406,8 @@ class DB(TM):
             self.db.query(query)
         except ProgrammingError, exception:
           LOG('ZMySQLDA', ERROR, 'query failed: %s' % (query,))
-          if exception[0] == 1064:
-            # 1064 = You have an error in your SQL syntax
+          if exception[0] == ER.PARSE_ERROR:
+            # You have an error in your SQL syntax
             # Replace MySQL brain dead error message with a more meaningful
             # one. (MySQL only reports the SQL query *from* the error place,
             # which strips important contextual information).