Mike Bayer avatar Mike Bayer committed 57aa3ae

- Fixed bug which was preventing out params of certain types
from being received; thanks a ton to huddlej at wwu.edu !
[ticket:1265]

Comments (0)

Files changed (3)

     - Fixed bug in exception raise when FK columns not present
       during reflection. [ticket:1241]
 
+- oracle
+    - Fixed bug which was preventing out params of certain types
+      from being received; thanks a ton to huddlej at wwu.edu !
+      [ticket:1265]
+
 0.4.8
 =====
 - orm

lib/sqlalchemy/databases/oracle.py

                  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()

test/dialect/oracle.py

 
     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', oracle.OracleString)]), 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")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.