]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
key/value params on execute() are based off the from objects, not the select list
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Jan 2006 07:11:51 +0000 (07:11 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Jan 2006 07:11:51 +0000 (07:11 +0000)
lib/sqlalchemy/ansisql.py

index 92db3b1ba2cbf8b93939f2494ef80716c21e08a9..f0e0203e9b6c88d3c9ce22ad31ae39a5bb6ae32b 100644 (file)
@@ -278,25 +278,24 @@ class ANSICompiler(sql.Compiled):
         
         whereclause = select.whereclause
         
-        # look at our own parameters, see if they
-        # are all present in the form of BindParamClauses.  if
-        # not, then append to the above whereclause column conditions
-        # matching those keys
-        if self.parameters is not None:
-            revisit = False
-            for c in inner_columns.values():
-                if sql.is_column(c) and self.parameters.has_key(c.key) and not self.binds.has_key(c.key):
-                    value = self.parameters[c.key]
-                else:
-                    continue
-                clause = c==value
-                clause.accept_visitor(self)
-                whereclause = sql.and_(clause, whereclause)
-                self.visit_compound(whereclause)
-                
         froms = []
         for f in select.froms:
 
+            if self.parameters is not None:
+                # look at our own parameters, see if they
+                # are all present in the form of BindParamClauses.  if
+                # not, then append to the above whereclause column conditions
+                # matching those keys
+                for c in f.columns:
+                    if sql.is_column(c) and self.parameters.has_key(c.key) and not self.binds.has_key(c.key):
+                        value = self.parameters[c.key]
+                    else:
+                        continue
+                    clause = c==value
+                    clause.accept_visitor(self)
+                    whereclause = sql.and_(clause, whereclause)
+                    self.visit_compound(whereclause)
+
             # special thingy used by oracle to redefine a join
             w = self.get_whereclause(f)
             if w is not None: