]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- update all the visit_mod() functions with new naming scheme
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 14 Aug 2012 21:24:57 +0000 (17:24 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 14 Aug 2012 21:24:57 +0000 (17:24 -0400)
- 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.

lib/sqlalchemy/connectors/mysqldb.py
lib/sqlalchemy/dialects/firebird/base.py
lib/sqlalchemy/dialects/informix/base.py
lib/sqlalchemy/dialects/maxdb/base.py
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/dialects/postgresql/pg8000.py
lib/sqlalchemy/dialects/postgresql/psycopg2.py

index 3e192e7806c2b28cbd6651ae18714af56179ebda..613a8f5b27313ffe37306cc170f312579c0559f8 100644 (file)
@@ -23,8 +23,9 @@ class MySQLDBExecutionContext(Connector):
             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('%', '%%')
index f3ab7346743a8ded711b15710b69a1e18c163398..ad6dcee54d51d1c62e75aa899855672451d5cfd1 100644 (file)
@@ -200,12 +200,10 @@ class FBTypeCompiler(compiler.GenericTypeCompiler):
 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:
index d1c5933f4ca395e633cfbc2b9dda3c529b2dac28..eff563a1d1808e26231532981451ad2277e3da22 100644 (file)
@@ -249,8 +249,9 @@ class InfoSQLCompiler(compiler.SQLCompiler):
         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):
index c2bcfa91390200f3909308190e8ee3c6f58f427e..03f7ef2154cf39a3eb34fded0b4f16da96c77f29 100644 (file)
@@ -534,9 +534,10 @@ class MaxDBCompiler(compiler.SQLCompiler):
         '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'
index 9aa4b392248e738212e2e5bc9b25ff45bfa98357..45ca47b8e5492be54447edf80c052367fc34a3e0 100644 (file)
@@ -32,8 +32,9 @@ class MySQLExecutionContext_mysqlconnector(MySQLExecutionContext):
 
 
 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('%', '%%')
index 7279f254bb8feb5a13086a79f84621b4349f53b9..88bc15bcc9d15fb8d96007efa44a3d754d2ccf72 100644 (file)
@@ -407,8 +407,9 @@ class OracleCompiler(compiler.SQLCompiler):
         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"
index cd90486132f1481c55f12d61d67082ad3eac2b86..d7f74bb986d327c255e04322e8e5bea9f7e2ef3e 100644 (file)
@@ -66,8 +66,9 @@ class PGExecutionContext_pg8000(PGExecutionContext):
 
 
 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:
index 8a4360b3412d647c2699794d9d8c14f8ffca3d1e..1b67a552178126ef8753c4f078b1e86d873f6196 100644 (file)
@@ -257,8 +257,9 @@ class PGExecutionContext_psycopg2(PGExecutionContext):
 
 
 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('%', '%%')