[Mono-bugs] [Bug 65342][Nor] New - GetInt64(fieldnumber).ToString() always returns 0.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 3 Sep 2004 22:20:48 -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 bugzilla@ego.gen.nz.

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

--- shadow/65342	2004-09-03 22:20:48.000000000 -0400
+++ shadow/65342.tmp.6007	2004-09-03 22:20:48.000000000 -0400
@@ -0,0 +1,99 @@
+Bug#: 65342
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Debian Potato
+OS Details: Debian, Kernel 2.6.7,  mono from .deb pkg, 1.0.1-1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: bugzilla@ego.gen.nz               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: GetInt64(fieldnumber).ToString() always returns 0.
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+Connecting to an ODBC database (MySql on localhost), and issueing 
+a "SELECT" which returns an int64 (e.g. "SELECT count(*)", or "SELECT 1", 
+or "SELECT myint64column"), all attempts at GetInt64(fieldnumber) returns 
+0.
+
+Steps to reproduce the problem:
+1. Save the attached file as "break.cs".
+-------
+using System;
+using System.Data.Odbc;
+class Hello {
+        static void Main() {
+                string 
+connectString="DRIVER=MySQL;SERVER=localhost;DATABASE=mysql;UID=root;PASSW
+ORD=;";
+                OdbcConnection dbConn = new OdbcConnection(connectString);
+                dbConn.Open();
+                OdbcCommand dbCommand = new OdbcCommand("SELECT 'Hello',1 
+FROM user",dbConn);
+                OdbcDataReader queryReader = dbCommand.ExecuteReader();
+                queryReader.Read();
+
+                System.Console.WriteLine(
+                                queryReader.GetString(0)+
+                                " "+
+                                queryReader.GetInt64(1).ToString());
+        }
+}
+------
+2. Tweak the connectString to connect to a database.
+3. mcs -r:System.Data break.cs
+4. mono break.exe
+
+OR:
+
+1. Use SqlSharp to connect to a MySql DB over ODBC
+2. select 1 from user limit 1;
+
+
+Actual Results:
+(method 1)
+Hello 0
+(method 2)
+Execute SQL: select 1 from user limit 1;
+Display any result sets...
+Display the result set 1
+Fields in Query Result: 1
+
+1 
+= 
+
+0 
+
+
+Expected Results:
+(method 1)
+Hello 1
+(method 2)
+Execute SQL: select 1 from user limit 1;
+Display any result sets...
+Display the result set 1
+Fields in Query Result: 1
+
+1 
+= 
+
+1
+
+
+
+How often does this happen? 
+Every time I've tried to GetInt64. Running the same on an int32 is fine. 
+mysql shows it correctly, as does MS Access over ODBC.
+
+Additional Information:
+
+This was also reported in bugzilla 62978, but that report got ignored as 
+it reported 4 bugs in one report.