[Mono-bugs] [Bug 58602][Maj] New - OdbcCommand does not bind out parameters to out values when executing stored procedures

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 17 May 2004 10:53:18 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by spatar@mail.nnov.ru.

http://bugzilla.ximian.com/show_bug.cgi?id=58602

--- shadow/58602	2004-05-17 10:53:18.000000000 -0400
+++ shadow/58602.tmp.8495	2004-05-17 10:53:18.000000000 -0400
@@ -0,0 +1,83 @@
+Bug#: 58602
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 080 Two weeks
+Priority: Major
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: spatar@mail.nnov.ru               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: OdbcCommand does not bind out parameters to out values when executing stored procedures
+
+Description of Problem:
+When OdbcCommand executes stored procedure its out parameters remain 
+unchanged, i.e. out values are not put to binded variables
+
+
+Following code reproduces the problem:
+--cut--
+OdbcConnection m_dbConnection = null;
+OdbcCommand command = null;
+try
+{
+    // Open connection with Oracle database
+    m_dbConnection = new OdbcConnection("DSN=ORACLE;Server=UVOIPDB;
+Uid=voip;Pwd=1" );
+    m_dbConnection.Open();
+
+    // Create ODBC command
+    command = m_dbConnection.CreateCommand();
+    command.CommandText = "{call pkg_auth_dev.ip_authentic7 (?)}";
+    command.CommandType = CommandType.StoredProcedure;
+
+    // Create out parameter
+    OdbcParameter param = new OdbcParameter("p_login", OdbcType.VarChar, 20 
+);
+    if( param == null ) {
+        Console.WriteLine( "if( param == null )" );
+    }
+    param.Direction = ParameterDirection.Output;
+    param.Value="init_value";
+    // Add parameter to command
+    command.Parameters.Add( param );
+
+    Console.WriteLine( "ExecuteNonQuery...\n" );
+    // Execute command
+    command.ExecuteNonQuery();
+    Console.WriteLine( "OK" );
+    // Print parameter's value
+    Console.WriteLine("Result: " + (string)(command.Parameters[ "p_login" ]
+.Value));
+
+}
+catch(OdbcException e)
+{
+    Console.WriteLine( e.Message );
+}
+finally
+{
+    command.Dispose();
+    m_dbConnection.Dispose();
+}
+--cut--
+No exceptions happened while executing this code, but console output is
+--cut--
+ExecuteNonQuery
+OK
+Result: init_value
+--cut--
+
+
+How often does this happen? 
+Always
+
+
+Additional Information:
+I used EasySoft unixODBC-2.2.3-6 with odbc-oracle-1.3.1 driver