From 7a629b6d415ce6b43bf751fdb2fdba705826265d Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Fri, 26 Feb 2010 19:05:00 +0000 Subject: [PATCH] Changed bind parameters to be passed as a tuple. Some drivers don't like to receive a list. --- lib/sqlalchemy/engine/default.py | 4 ++-- test/engine/test_execute.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index 5499b34e75..74562a70e3 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -419,7 +419,7 @@ class DefaultExecutionContext(base.ExecutionContext): param.append(processors[key](compiled_params[key])) else: param.append(compiled_params[key]) - parameters.append(param) + parameters.append(tuple(param)) else: encode = not self.dialect.supports_unicode_statements for compiled_params in compiled_parameters: @@ -438,7 +438,7 @@ class DefaultExecutionContext(base.ExecutionContext): else: param[key] = compiled_params[key] parameters.append(param) - return parameters + return tuple(parameters) def should_autocommit_text(self, statement): return AUTOCOMMIT_REGEXP.match(statement) diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py index a498508d7e..4a45fceb31 100644 --- a/test/engine/test_execute.py +++ b/test/engine/test_execute.py @@ -151,20 +151,20 @@ class ProxyConnectionTest(TestBase): if not testing.against('oracle+zxjdbc'): # or engine.dialect.preexecute_pk_sequences: cursor = [ ("CREATE TABLE t1", {}, ()), - ("INSERT INTO t1 (c1, c2)", {'c2': 'some data', 'c1': 5}, [5, 'some data']), - ("SELECT lower", {'lower_2':'Foo'}, ['Foo']), - ("INSERT INTO t1 (c1, c2)", {'c2': 'foo', 'c1': 6}, [6, 'foo']), + ("INSERT INTO t1 (c1, c2)", {'c2': 'some data', 'c1': 5}, (5, 'some data')), + ("SELECT lower", {'lower_2':'Foo'}, ('Foo',)), + ("INSERT INTO t1 (c1, c2)", {'c2': 'foo', 'c1': 6}, (6, 'foo')), ("select * from t1", {}, ()), ("DROP TABLE t1", {}, ()) ] else: - insert2_params = [6, 'Foo'] + insert2_params = (6, 'Foo') if testing.against('oracle+zxjdbc'): from sqlalchemy.dialects.oracle.zxjdbc import ReturningParam insert2_params.append(ReturningParam(12)) cursor = [ ("CREATE TABLE t1", {}, ()), - ("INSERT INTO t1 (c1, c2)", {'c2': 'some data', 'c1': 5}, [5, 'some data']), + ("INSERT INTO t1 (c1, c2)", {'c2': 'some data', 'c1': 5}, (5, 'some data')), ("INSERT INTO t1 (c1, c2)", {'c1': 6, "lower_2":"Foo"}, insert2_params), # bind param name 'lower_2' might be incorrect ("select * from t1", {}, ()), ("DROP TABLE t1", {}, ()) -- 2.47.3