Anonymous avatar Anonymous committed 44769f7

Added input/output parameters support to Cursor.callproc(). I.e. Allow BYREF dbproc parameter types to work (with Ingres).

Comments (0)

Files changed (1)

dbapi/dbapi/generic.py

 # 2010-12-31 clach04 Added decimal support (for input bind parameters)
 # 2010-12-31 clach04 Added preliminary Cursor.callproc() support for database procedures. Does not support parameters, or results (return codes, rows, etc.)
 # 2010-12-31 clach04 Added input parameters support to Cursor.callproc().
+# 2010-12-31 clach04 Added input/output parameters support to Cursor.callproc().
 
 import clr
 clr.AddReference('System.Data')
                     parameter = DBNull.Value
                 p = command.CreateParameter()
                 p.ParameterName = parameter_name
+                p.Direction = System.Data.ParameterDirection.InputOutput  # Always assume In and Out (aka BYREF or By Reference in Ingres, which is the default semantics for DDL of dbprocs)
                 p.Value, tmptype = _from_python(parameter)
                 if tmptype:
                     p.DbType = tmptype
                 command.Parameters.Add(p)
-                # FIXME currently this is INPUT only
         
         command.ExecuteNonQuery()
         
-        result = None
+        if len(command.Parameters) == 0:
+            result = None
+        else:
+            #result = (,)  # IronPython 2.6 seems to have problems with empty Tuples
+            result = []  # IronPython 2.6 seems to have problems with empty Tuples
+            print 'command.Parameters', command.Parameters
+            for x in command.Parameters:
+                result.append(x.Value)
+            result = tuple(result)
+        
         self.description = None
         return result
     
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.