self.binds[col.key] = bindparam
return self.bindparam_string(self._truncate_bindparam(bindparam))
- # no parameters in the statement, no parameters in the
- # compiled params - return binds for all columns
- if self.parameters is None and stmt.parameters is None:
- return [(c, create_bind_param(c, None)) for c in stmt.table.columns]
-
def create_clause_param(col, value):
self.traverse(value)
self.inline_params.add(col)
else:
return key
+ # no parameters in the statement, no parameters in the
+ # compiled params - return binds for all columns
+ if self.parameters is None and stmt.parameters is None:
+ return [(c, create_bind_param(c, None)) for c in stmt.table.columns]
+
# if we have statement parameters - set defaults in the
# compiled params
if self.parameters is None:
s = select([users], users.c.user_id==bindparam('id')).compile()
c = testbase.db.connect()
assert c.execute(s, id=7).fetchall()[0]['user_id'] == 7
+
+ def test_compiled_insert_execute(self):
+ users.insert().compile().execute(user_id = 7, user_name = 'jack')
+ s = select([users], users.c.user_id==bindparam('id')).compile()
+ c = testbase.db.connect()
+ assert c.execute(s, id=7).fetchall()[0]['user_id'] == 7
def test_repeated_bindparams(self):
"""test that a BindParam can be used more than once.