Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorKamil Skalski <kamil@mono-cvs.ximian.com>2006-03-08 00:56:49 +0300
committerKamil Skalski <kamil@mono-cvs.ximian.com>2006-03-08 00:56:49 +0300
commit83ef4b0864e389abd1d3a1142631cca3deb53cff (patch)
tree854f7f226e02c9fac5bbf49b01867ceb93d15cda /mcs
parent3550047da3e68af9b00c18a239037c55fa604294 (diff)
Handle null values in result as having string type
svn path=/trunk/mcs/; revision=57667
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/ChangeLog5
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs7
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Test/ChangeLog5
-rw-r--r--mcs/class/Mono.Data.SqliteClient/Test/SqliteDataReaderTest.cs21
4 files changed, 37 insertions, 1 deletions
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/ChangeLog b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/ChangeLog
index b80709d580e..6ec1db8fc76 100644
--- a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/ChangeLog
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-07 Kamil Skalski <nazgul@nemerle.org>
+
+ * SqliteDataReader.cs: Handle null values in result as having
+ string type
+
2006-02-10 Joshua Tauberer <tauberer@for.net>
* SqliteDataReader: Made 64bit clean. Patch from
diff --git a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs
index 8cfe2257480..11ec18095bd 100644
--- a/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs
+++ b/mcs/class/Mono.Data.SqliteClient/Mono.Data.SqliteClient/SqliteDataReader.cs
@@ -368,7 +368,12 @@ namespace Mono.Data.SqliteClient
int row = current_row;
if (row == -1 && rows.Count == 0) return typeof(string);
if (row == -1) row = 0;
- return ((object[]) rows[row])[i].GetType();
+ object element = ((object[]) rows[row])[i];
+ if (element != null)
+ return element.GetType();
+ else
+ return typeof (string);
+
// Note that the return value isn't guaranteed to
// be the same as the rows are read if different
// types of information are stored in the column.
diff --git a/mcs/class/Mono.Data.SqliteClient/Test/ChangeLog b/mcs/class/Mono.Data.SqliteClient/Test/ChangeLog
index a56a829f212..cf272fa4d2f 100644
--- a/mcs/class/Mono.Data.SqliteClient/Test/ChangeLog
+++ b/mcs/class/Mono.Data.SqliteClient/Test/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-07 Kamil Skalski <nazgul@nemerle.org>
+
+ * SqliteDataReaderTest.cs: Add test for getting field type of null
+ value
+
2006-01-29 Joshua Tauberer <tauberer@for.net>
* Added tests from Thomas Zoechling <thomas.zoechling@gmx.at>.
diff --git a/mcs/class/Mono.Data.SqliteClient/Test/SqliteDataReaderTest.cs b/mcs/class/Mono.Data.SqliteClient/Test/SqliteDataReaderTest.cs
index 65d5faf09f1..9b3e40f8303 100644
--- a/mcs/class/Mono.Data.SqliteClient/Test/SqliteDataReaderTest.cs
+++ b/mcs/class/Mono.Data.SqliteClient/Test/SqliteDataReaderTest.cs
@@ -75,5 +75,26 @@ namespace MonoTests.Mono.Data.SqliteClient
}
}
}
+
+ [Test]
+ public void TypeOfNullInResultTest ()
+ {
+ _conn.ConnectionString = _connectionString;
+ SqliteDataReader reader = null;
+ using (_conn) {
+ _conn.Open ();
+ SqliteCommand cmd = _conn.CreateCommand ();
+ cmd.CommandText = "select null from test";
+ reader = cmd.ExecuteReader ();
+ try {
+ Assert.IsTrue (reader.Read());
+ Assert.IsNotNull (reader.GetFieldType (0));
+ } finally {
+ if (reader != null && !reader.IsClosed)
+ reader.Close ();
+ _conn.Close ();
+ }
+ }
+ }
}
}