[Mono-bugs] [Bug 59476][Nor] New - OdbcDataReader.GetValue is incorrect for "binary(16)" database type

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 2 Jun 2004 12:52:25 -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 sebastien.robitaille@croesus.com.

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

--- shadow/59476	2004-06-02 12:52:25.000000000 -0400
+++ shadow/59476.tmp.29884	2004-06-02 12:52:25.000000000 -0400
@@ -0,0 +1,71 @@
+Bug#: 59476
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien.robitaille@croesus.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: OdbcDataReader.GetValue is incorrect for "binary(16)" database type
+
+Description of Problem:
+
+For many database types, the OdbcDataReader.GetValue() method returns an 
+object of type "System.String" when something else is expected.
+
+(Example: A "System.Byte[]" object is expected for a binary(16) database 
+type but a "System.String" is received).
+
+Steps to reproduce the problem:
+1. Create a database table with a binary(16) column and insert a row in 
+that table:
+
+create table MyTable (ID binary(16) UNIQUE)
+insert into MyTable (ID) values (127123645917568585638457243856234985)
+
+2. Use the follofing code to print the data type of the object returned 
+by the GetValue method:
+
+OdbcCommand command = new OdbcCommand("SELECT * FROM MyTable, 
+m_DatabaseConnection);
+OdbcDataReader dataReader = command.ExecuteReader();
+
+while(dataReader.Read()) 
+{
+    for (int nIndex = 0; nIndex < dataReader.FieldCount; nIndex++)
+    {
+        object myObject = dataReader.GetValue(nIndex);
+        Console.WriteLine("Object Type: " + myObject.GetType().ToString
+());
+    }
+}
+
+
+Actual Results:
+
+Output using mono:: on RedHat9:
+Object Type: System.String
+
+Expected Results:
+
+Output using MS.NET on Windows:
+Object Type: System.Byte[]
+
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+Sybase Database
+freetds-0.62.3
+unixODBC-2.2.8
+mono-0.93