summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/compiler.py
diff options
context:
space:
mode:
authorCatherine Devlin <catherine.devlin@gmail.com>2008-03-20 02:47:46 +0000
committerCatherine Devlin <catherine.devlin@gmail.com>2008-03-20 02:47:46 +0000
commit50206ec2adcd1c38bc4dad98c7775c7ea8ecd10c (patch)
tree76028e874491e03dbccebc01c403086638855008 /lib/sqlalchemy/sql/compiler.py
parent869f9e0a2a177a246e7d20205634ea9584b1ee59 (diff)
downloadsqlalchemy-50206ec2adcd1c38bc4dad98c7775c7ea8ecd10c.tar.gz
adding zzzeek's patch from ticket #994, which fixed virtually all remaining broken unit tests in the Oracle module
Diffstat (limited to 'lib/sqlalchemy/sql/compiler.py')
-rw-r--r--lib/sqlalchemy/sql/compiler.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py
index 6a048a780..4a45d6c15 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -649,6 +649,11 @@ class DefaultCompiler(engine.Compiled):
self.stack.pop(-1)
return text
+
+ def create_insert_update_bind(self, col, value):
+ bindparam = sql.bindparam(col.key, value, type_=col.type)
+ self.binds[col.key] = bindparam
+ return self.bindparam_string(self._truncate_bindparam(bindparam))
def _get_colparams(self, stmt):
"""create a set of tuples representing column/string pairs for use
@@ -656,18 +661,13 @@ class DefaultCompiler(engine.Compiled):
"""
- def create_bind_param(col, value):
- bindparam = sql.bindparam(col.key, value, type_=col.type)
- self.binds[col.key] = bindparam
- return self.bindparam_string(self._truncate_bindparam(bindparam))
-
self.postfetch = []
self.prefetch = []
# no parameters in the statement, no parameters in the
# compiled params - return binds for all columns
if self.column_keys is None and stmt.parameters is None:
- return [(c, create_bind_param(c, None)) for c in stmt.table.columns]
+ return [(c, self.create_insert_update_bind(c, None)) for c in stmt.table.columns]
# if we have statement parameters - set defaults in the
# compiled params
@@ -686,7 +686,7 @@ class DefaultCompiler(engine.Compiled):
if c.key in parameters:
value = parameters[c.key]
if sql._is_literal(value):
- value = create_bind_param(c, value)
+ value = self.create_insert_update_bind(c, value)
else:
self.postfetch.append(c)
value = self.process(value.self_group())
@@ -699,7 +699,7 @@ class DefaultCompiler(engine.Compiled):
not self.dialect.supports_pk_autoincrement) or
(c.default is not None and
not isinstance(c.default, schema.Sequence))):
- values.append((c, create_bind_param(c, None)))
+ values.append((c, self.create_insert_update_bind(c, None)))
self.prefetch.append(c)
elif isinstance(c.default, schema.ColumnDefault):
if isinstance(c.default.arg, sql.ClauseElement):
@@ -708,7 +708,7 @@ class DefaultCompiler(engine.Compiled):
# dont add primary key column to postfetch
self.postfetch.append(c)
else:
- values.append((c, create_bind_param(c, None)))
+ values.append((c, self.create_insert_update_bind(c, None)))
self.prefetch.append(c)
elif isinstance(c.default, schema.PassiveDefault):
if not c.primary_key:
@@ -725,7 +725,7 @@ class DefaultCompiler(engine.Compiled):
values.append((c, self.process(c.onupdate.arg.self_group())))
self.postfetch.append(c)
else:
- values.append((c, create_bind_param(c, None)))
+ values.append((c, self.create_insert_update_bind(c, None)))
self.prefetch.append(c)
elif isinstance(c.onupdate, schema.PassiveDefault):
self.postfetch.append(c)