summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-01-01 20:30:53 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-01-01 20:30:53 +0000
commit943bb0b0e08fec9bc0ccc784a4dd154783031e8d (patch)
tree6a487a53b1fe33b7a69a051db8106731210fa9d8 /lib/sqlalchemy/engine.py
parent7228b4210c15bcde37ca3f58730674afae579252 (diff)
downloadsqlalchemy-943bb0b0e08fec9bc0ccc784a4dd154783031e8d.tar.gz
postgres oids say byebye by default, putting hooks in for engines to determine column defaults externally to it having a 'default' property, beefed up unittests to support inserts with/without defaults (will fix oracle unit tests too)
Diffstat (limited to 'lib/sqlalchemy/engine.py')
-rw-r--r--lib/sqlalchemy/engine.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sqlalchemy/engine.py b/lib/sqlalchemy/engine.py
index f23701424..f3cc8efad 100644
--- a/lib/sqlalchemy/engine.py
+++ b/lib/sqlalchemy/engine.py
@@ -129,6 +129,12 @@ class DefaultRunner(schema.SchemaVisitor):
self.proxy = proxy
self.engine = engine
+ def get_column_default(self, column):
+ if column.default is not None:
+ return column.default.accept_visitor(self)
+ else:
+ return None
+
def visit_sequence(self, seq):
"""sequences are not supported by default"""
return None
@@ -425,11 +431,7 @@ class SQLEngine(schema.SchemaEngine):
need_lastrowid=False
for c in compiled.statement.table.c:
if not param.has_key(c.key) or param[c.key] is None:
- if c.default is not None:
- newid = c.default.accept_visitor(drunner)
- else:
- newid = None
-
+ newid = drunner.get_column_default(c)
if newid is not None:
param[c.key] = newid
if c.primary_key:
@@ -481,6 +483,7 @@ class SQLEngine(schema.SchemaEngine):
post-processing on result-set values.
commit - if True, will automatically commit the statement after completion. """
+
if parameters is None:
parameters = {}
@@ -545,6 +548,7 @@ class SQLEngine(schema.SchemaEngine):
post-processing on result-set values.
commit - if True, will automatically commit the statement after completion. """
+
if parameters is None:
parameters = {}