]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
moved "c.name" to "c.key" for processing defaults since bind params use column key
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 12 Sep 2006 21:44:17 +0000 (21:44 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 12 Sep 2006 21:44:17 +0000 (21:44 +0000)
lib/sqlalchemy/engine/default.py

index f73ede7565323dd9e90aacf91ae1cb8288a7c252..dd9a0d278c6f5911a8ddcb82f8b770d92bcca6be 100644 (file)
@@ -186,18 +186,18 @@ class DefaultExecutionContext(base.ExecutionContext):
                 last_inserted_ids = []
                 need_lastrowid=False
                 for c in compiled.statement.table.c:
-                    if not param.has_key(c.name) or param[c.name] is None:
+                    if not param.has_key(c.key) or param[c.key] is None:
                         if isinstance(c.default, schema.PassiveDefault):
                             self._lastrow_has_defaults = True
                         newid = drunner.get_column_default(c)
                         if newid is not None:
-                            param[c.name] = newid
+                            param[c.key] = newid
                             if c.primary_key:
-                                last_inserted_ids.append(param[c.name])
+                                last_inserted_ids.append(param[c.key])
                         elif c.primary_key:
                             need_lastrowid = True
                     elif c.primary_key:
-                        last_inserted_ids.append(param[c.name])
+                        last_inserted_ids.append(param[c.key])
                 if need_lastrowid:
                     self._last_inserted_ids = None
                 else:
@@ -213,10 +213,10 @@ class DefaultExecutionContext(base.ExecutionContext):
             self._lastrow_has_defaults = False
             for param in plist:
                 for c in compiled.statement.table.c:
-                    if c.onupdate is not None and (not param.has_key(c.name) or param[c.name] is None):
+                    if c.onupdate is not None and (not param.has_key(c.key) or param[c.key] is None):
                         value = drunner.get_column_onupdate(c)
                         if value is not None:
-                            param[c.name] = value
+                            param[c.key] = value
                 self._last_updated_params = param