From: Mike Bayer Date: Sat, 3 Jan 2009 18:58:52 +0000 (+0000) Subject: - Fixed bug which was preventing out params of certain types X-Git-Tag: rel_0_5_0~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=67909d9645d73b4d852f1abeea3bac7c276517e3;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed bug which was preventing out params of certain types from being received; thanks a ton to huddlej at wwu.edu ! [ticket:1265] --- diff --git a/CHANGES b/CHANGES index 03c833a643..0b63ab8883 100644 --- a/CHANGES +++ b/CHANGES @@ -352,6 +352,10 @@ CHANGES NVARCHAR2 reflects into this type automatically so these columns pass unicode on a reflected table with no explicit convert_unicode=True flags. [ticket:1233] + + - Fixed bug which was preventing out params of certain types + from being received; thanks a ton to huddlej at wwu.edu ! + [ticket:1265] - mysql - "%" signs in text() constructs are automatically escaped to "%%". diff --git a/lib/sqlalchemy/databases/oracle.py b/lib/sqlalchemy/databases/oracle.py index 5a305ffd2b..5cc7c5bd0e 100644 --- a/lib/sqlalchemy/databases/oracle.py +++ b/lib/sqlalchemy/databases/oracle.py @@ -345,7 +345,11 @@ class OracleExecutionContext(default.DefaultExecutionContext): for bind, name in self.compiled.bind_names.iteritems(): if name in self.out_parameters: type = bind.type - self.out_parameters[name] = type.dialect_impl(self.dialect).result_processor(self.dialect)(self.out_parameters[name].getvalue()) + result_processor = type.dialect_impl(self.dialect).result_processor(self.dialect) + if result_processor is not None: + self.out_parameters[name] = result_processor(self.out_parameters[name].getvalue()) + else: + self.out_parameters[name] = self.out_parameters[name].getvalue() else: for k in self.out_parameters: self.out_parameters[k] = self.out_parameters[k].getvalue() diff --git a/test/dialect/oracle.py b/test/dialect/oracle.py index 3eaba8fb3c..2186f22595 100644 --- a/test/dialect/oracle.py +++ b/test/dialect/oracle.py @@ -15,19 +15,19 @@ class OutParamTest(TestBase, AssertsExecutionResults): def setUpAll(self): testing.db.execute(""" -create or replace procedure foo(x_in IN number, x_out OUT number, y_out OUT number) IS +create or replace procedure foo(x_in IN number, x_out OUT number, y_out OUT number, z_out OUT varchar) IS retval number; begin retval := 6; x_out := 10; y_out := x_in * 15; + z_out := NULL; end; """) def test_out_params(self): - result = testing.db.execute(text("begin foo(:x, :y, :z); end;", bindparams=[bindparam('x', Numeric), outparam('y', Numeric), outparam('z', Numeric)]), x=5) - assert result.out_parameters == {'y':10, 'z':75}, result.out_parameters - print result.out_parameters + result = testing.db.execute(text("begin foo(:x_in, :x_out, :y_out, :z_out); end;", bindparams=[bindparam('x_in', Numeric), outparam('x_out', Numeric), outparam('y_out', Numeric), outparam('z_out', String)]), x_in=5) + assert result.out_parameters == {'x_out':10, 'y_out':75, 'z_out':None}, result.out_parameters def tearDownAll(self): testing.db.execute("DROP PROCEDURE foo")