[Mono-bugs] [Bug 63539][Min] New - OdbcDataReader: TINYINT retrieved as System.Int16 instead of System.Byte
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Fri, 20 Aug 2004 11:33:43 -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=63539
--- shadow/63539 2004-08-20 11:33:43.000000000 -0400
+++ shadow/63539.tmp.27746 2004-08-20 11:33:43.000000000 -0400
@@ -0,0 +1,89 @@
+Bug#: 63539
+Product: Mono: Class Libraries
+Version: unspecified
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Minor
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: sebastien.robitaille@croesus.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: OdbcDataReader: TINYINT retrieved as System.Int16 instead of System.Byte
+
+Description of Problem:
+OdbcDataReader: TINYINT retrieved as System.Int16 instead of System.Byte
+
+Steps to reproduce the problem:
+1. Execute the following method:
+
+static void TestTinyIntDataType(string connectionString)
+{
+ using(IDbConnection dbConnection = new OdbcConnection
+(connectionString))
+ {
+ dbConnection.Open();
+ IDbCommand dbCommand = dbConnection.CreateCommand();
+
+ System.Console.WriteLine("CREATE TABLE");
+ dbCommand.CommandText = "CREATE TABLE MyTable (MyField
+TINYINT NOT NULL)";
+ dbCommand.ExecuteNonQuery();
+
+ System.Console.WriteLine("INSERT INTO");
+ dbCommand.CommandText = "INSERT INTO MyTable (MyField)
+VALUES (12)";
+ dbCommand.ExecuteNonQuery();
+
+ System.Console.WriteLine("SELECT * FROM");
+ dbCommand.CommandText = "SELECT * FROM MyTable";
+
+ using(IDataReader reader = dbCommand.ExecuteReader())
+ {
+ while(reader.Read())
+ {
+ for(int index = 0; index <
+reader.FieldCount; index++)
+ {
+ object dataValue = reader.GetValue
+(index);
+ System.Console.WriteLine
+(dataValue.GetType().ToString() + "\t" + dataValue.ToString());
+ }
+ }
+ }
+
+ System.Console.WriteLine("DROP TABLE");
+ dbCommand.CommandText = "DROP TABLE MyTable";
+ dbCommand.ExecuteNonQuery();
+ }
+}
+
+Actual Results:
+CREATE TABLE
+INSERT INTO
+SELECT * FROM
+System.Int16 12
+DROP TABLE
+
+
+Expected Results:
+CREATE TABLE
+INSERT INTO
+SELECT * FROM
+System.Byte 12
+DROP TABLE
+
+
+How often does this happen?
+Always
+
+Additional Information:
+RedHat9
+unixODBC
+freeTDS