]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fixed bug which was preventing out params of certain types
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 3 Jan 2009 18:58:52 +0000 (18:58 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 3 Jan 2009 18:58:52 +0000 (18:58 +0000)
from being received; thanks a ton to huddlej at wwu.edu !
[ticket:1265]

CHANGES
lib/sqlalchemy/databases/oracle.py
test/dialect/oracle.py

diff --git a/CHANGES b/CHANGES
index 03c833a64373e61fd174448072cd2c58dd6925ac..0b63ab8883fa25dbe276431a053b49aaa3dd6d7d 100644 (file)
--- 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 "%%".
index 5a305ffd2bcff0fd1f490b3090a5ecb19ff7cc6e..5cc7c5bd0eef463e9971fee2ed37f817c55a181e 100644 (file)
@@ -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()
index 3eaba8fb3cf483dbcd0476a2ac00391f6aa1d16d..2186f22595b30739e0f5b0429dd9cd30b0671d50 100644 (file)
@@ -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")