[Mono-bugs] [Bug 50771][Nor] New - Specific query causes a null reference exception with sqliteclient

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 8 Aug 2004 21:51:50 -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 grompf@sublimeintervention.com.

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

--- shadow/50771	2004-08-08 21:51:50.000000000 -0400
+++ shadow/50771.tmp.21865	2004-08-08 21:51:50.000000000 -0400
@@ -0,0 +1,82 @@
+Bug#: 50771
+Product: Mono: Class Libraries
+Version: unspecified
+OS: unknown
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: richard@phpguru.org               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Specific query causes a null reference exception with sqliteclient
+
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+
+Using Mono.Data.SqliteClient on windows, the query:
+
+"SELECT COUNT(*) FROM myTable"
+
+causes a nullreference exception. It's thrown after the callback has 
+returned, but before the call to sqlite_exec() has returned. Stepping
+through the code shows that the query is executed and returns the correct
+data.
+
+
+Steps to reproduce the problem:
+1. Compile code with small sample app using the above query against a
+   basic database.
+2. Run it.
+3. Watch for the exception.
+
+Actual Results:
+
+
+Expected Results:
+
+
+How often does this happen? 
+
+Everytime.
+
+Additional Information:
+
+------- Additional Comments From grompf@sublimeintervention.com  2004-08-08 21:51 -------
+Please retry this with latest CVS; using the testcase below I get the expected output of:
+0
+1
+
+using System;
+using System.Data;
+using Mono.Data.SqliteClient;
+
+class Test {
+        static void Main(string[] args) {
+                SqliteConnection conn = new SqliteConnection();
+                conn.ConnectionString = "URI=file:test.db";
+                conn.Open();
+                SqliteCommand cmd = conn.CreateCommand();
+                cmd.CommandText = "CREATE TABLE testtable (id INTEGER)";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "SELECT COUNT(*) FROM testtable";
+                IDataReader reader = cmd.ExecuteReader();
+                while(reader.Read())
+                        Console.WriteLine(reader.GetInt32(0));
+
+                cmd.CommandText = "INSERT INTO testtable VALUES (1)";
+                cmd.ExecuteNonQuery();
+
+                cmd.CommandText = "SELECT COUNT(*) FROM testtable";
+                reader = cmd.ExecuteReader();
+                while(reader.Read())
+                        Console.WriteLine(reader.GetInt32(0));
+        }
+}