Commits

Mike Bayer  committed 2986924

- update all the visit_mod() functions with new naming scheme
- visit_mods all seemed to not propagate **kw down to process().
this is [ticket:2548] which may be backported to 0.7 pending
a test case to illustrate wrong behavior.

  • Participants
  • Parent commits 0ca155a

Comments (0)

Files changed (8)

File lib/sqlalchemy/connectors/mysqldb.py

             return self.cursor.rowcount
 
 class MySQLDBCompiler(Connector):
-    def visit_mod(self, binary, **kw):
-        return self.process(binary.left) + " %% " + self.process(binary.right)
+    def visit_mod_binary(self, binary, operator, **kw):
+        return self.process(binary.left, **kw) + " %% " + \
+                    self.process(binary.right, **kw)
 
     def post_process_text(self, text):
         return text.replace('%', '%%')

File lib/sqlalchemy/dialects/firebird/base.py

 class FBCompiler(sql.compiler.SQLCompiler):
     """Firebird specific idiosyncrasies"""
 
-    def visit_mod(self, binary, **kw):
-        # Firebird lacks a builtin modulo operator, but there is
-        # an equivalent function in the ib_udf library.
+    def visit_mod_binary(self, binary, operator, **kw):
         return "mod(%s, %s)" % (
-                                self.process(binary.left),
-                                self.process(binary.right))
+                                self.process(binary.left, **kw),
+                                self.process(binary.right, **kw))
 
     def visit_alias(self, alias, asfrom=False, **kwargs):
         if self.dialect._version_two:

File lib/sqlalchemy/dialects/informix/base.py

         else:
             return compiler.SQLCompiler.visit_function(self, func, **kw)
 
-    def visit_mod(self, binary, **kw):
-        return "MOD(%s, %s)" % (self.process(binary.left), self.process(binary.right))
+    def visit_mod_binary(self, binary, operator, **kw):
+        return "MOD(%s, %s)" % (self.process(binary.left, **kw),
+                                self.process(binary.right, **kw))
 
 
 class InfoDDLCompiler(compiler.DDLCompiler):

File lib/sqlalchemy/dialects/maxdb/base.py

         'TIMEZONE', 'TRANSACTION', 'TRUE', 'USER', 'UID', 'USERGROUP',
         'UTCDATE', 'UTCDIFF'])
 
-    def visit_mod(self, binary, **kw):
+    def visit_mod_binary(self, binary, operator, **kw):
         return "mod(%s, %s)" % \
-                    (self.process(binary.left), self.process(binary.right))
+                    (self.process(binary.left, **kw),
+                            self.process(binary.right, **kw))
 
     def default_from(self):
         return ' FROM DUAL'

File lib/sqlalchemy/dialects/mysql/mysqlconnector.py

 
 
 class MySQLCompiler_mysqlconnector(MySQLCompiler):
-    def visit_mod(self, binary, **kw):
-        return self.process(binary.left) + " %% " + self.process(binary.right)
+    def visit_mod_binary(self, binary, operator, **kw):
+        return self.process(binary.left, **kw) + " %% " + \
+                        self.process(binary.right, **kw)
 
     def post_process_text(self, text):
         return text.replace('%', '%%')

File lib/sqlalchemy/dialects/oracle/base.py

         self._quoted_bind_names = {}
         super(OracleCompiler, self).__init__(*args, **kwargs)
 
-    def visit_mod(self, binary, **kw):
-        return "mod(%s, %s)" % (self.process(binary.left), self.process(binary.right))
+    def visit_mod_binary(self, binary, operator, **kw):
+        return "mod(%s, %s)" % (self.process(binary.left, **kw),
+                                self.process(binary.right, **kw))
 
     def visit_now_func(self, fn, **kw):
         return "CURRENT_TIMESTAMP"

File lib/sqlalchemy/dialects/postgresql/pg8000.py

 
 
 class PGCompiler_pg8000(PGCompiler):
-    def visit_mod(self, binary, **kw):
-        return self.process(binary.left) + " %% " + self.process(binary.right)
+    def visit_mod_binary(self, binary, operator, **kw):
+        return self.process(binary.left, **kw) + " %% " + \
+                        self.process(binary.right, **kw)
 
     def post_process_text(self, text):
         if '%%' in text:

File lib/sqlalchemy/dialects/postgresql/psycopg2.py

 
 
 class PGCompiler_psycopg2(PGCompiler):
-    def visit_mod(self, binary, **kw):
-        return self.process(binary.left) + " %% " + self.process(binary.right)
+    def visit_mod_binary(self, binary, operator, **kw):
+        return self.process(binary.left, **kw) + " %% " + \
+                self.process(binary.right, **kw)
 
     def post_process_text(self, text):
         return text.replace('%', '%%')