diff --git a/product/ZMySQLDA/db.py b/product/ZMySQLDA/db.py
index a7dabb3fcbfb11efc020d7992add14ad3882795a..b3be29a474d30a1483ef0dfd01b69485469c2430 100644
--- a/product/ZMySQLDA/db.py
+++ b/product/ZMySQLDA/db.py
@@ -444,7 +444,7 @@ class DB(TM):
         # XXX deal with a typical mistake that the user appends
         # an unnecessary and rather harmful semicolon at the end.
         # Unfortunately, MySQLdb does not want to be graceful.
-        if query_string[-1] == ';':
+        if query_string.endswith(';'):
           query_string = query_string[:-1]
         for qs in filter(None, map(strip,split(query_string, '\0'))):
             qtype = upper(split(qs, None, 1)[0])