[Mono-bugs] [Bug 77262][Wis] New - [PATCH] Sqlite Support for
Multiple Result Sets
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sun Jan 15 01:36:30 EST 2006
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 jhill at arcfocus.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77262
--- shadow/77262 2006-01-15 01:36:30.000000000 -0500
+++ shadow/77262.tmp.24024 2006-01-15 01:36:30.000000000 -0500
@@ -0,0 +1,108 @@
+Bug#: 77262
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Sys.Data.SqlClient
+AssignedTo: tsenganal at novell.com
+ReportedBy: jhill at arcfocus.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: [PATCH] Sqlite Support for Multiple Result Sets
+
+Description of Problem:
+Currently, ExecuteReader returns only the result set from the last SQL
+statement executed in a command. The expected behavior is that each data
+returning SQL statement should return a result set. Each result set can be
+iterated to by executing NextResult().
+
+Executing NextResult() on a DataReader currently has the same effect as Read().
+
+Other problems caused by this behavior are that the last SQL statement of a
+command isn't always the data returning command (for instance, if a temp
+table is dropped after a select statement is executed against it). Also,
+SqliteDataAdapter.Fill(DataSet) will only ever fill one table.
+
+The attached patch addresses all of these issues by making SqliteDataReader
+a collection of SqliteResultSets.
+
+Steps to reproduce the problem:
+1. Create and populate sqlite database:
+
+CREATE TABLE `FirstTable` (
+ `Name` TEXT NOT NULL default ''
+);
+
+CREATE TABLE `SecondTable` (
+ `Name` TEXT NOT NULL default ''
+);
+
+INSERT INTO FirstTable Values ("FirstTable FirstRow");
+INSERT INTO FirstTable Values ("FirstTable SecondRow");
+INSERT INTO FirstTable Values ("FirstTable ThirdRow");
+
+INSERT INTO SecondTable Values ("SecondTable FirstRow");
+INSERT INTO SecondTable Values ("SecondTable SecondRow");
+
+
+2. Create a C# program to access this data:
+using System;
+using System.Data;
+using Mono.Data.SqliteClient;
+
+namespace AppX
+{
+ class X
+ {
+ static void Main(string[] args)
+ {
+ SqliteCommand cmd = new SqliteCommand();
+ SqliteConnection connection = new
+SqliteConnection(@"version=3,URI=file:C:\Temp\x.db");
+ connection.Open();
+ cmd.Connection = connection;
+ cmd.CommandText = "SELECT * FROM FirstTable; SELECT * FROM SecondTable;";
+ cmd.CommandType = CommandType.Text;
+
+ SqliteDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
+
+ while(dr.Read()) {
+ Console.WriteLine(dr[0].ToString());
+ }
+ dr.NextResult();
+
+ while(dr.Read()) {
+ Console.WriteLine(dr[0].ToString());
+ }
+ }
+ }
+}
+
+3. Build x.cs:
+mcs x.cs -r:Mono.Data.SqliteClient -r:System.Data
+
+4. Execute x.exe
+mono x.exe
+
+Actual Results:
+SecondTable FirstRow
+SecondTable SecondRow
+
+Expected Results:
+FirstTable FirstRow
+FirstTable SecondRow
+FirstTable ThirdRow
+SecondTable FirstRow
+SecondTable SecondRow
+
+How often does this happen?
+Always
+
+Additional Information:
+Patch attached.
More information about the mono-bugs
mailing list