[Mono-bugs] [Bug 55162][Blo] Changed - SqlParameter value set to null will not result in NULL in query.
Tue, 30 Mar 2004 15:11:09 -0500 (EST)
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 email@example.com.
--- shadow/55162 2004-03-30 11:27:50.000000000 -0500
+++ shadow/55162.tmp.7651 2004-03-30 15:11:09.000000000 -0500
@@ -46,6 +46,31 @@
the value null is required to signal NULL. This works in the .NET sqlserver
client and the Oracle ODP.NET client without a problem. If this doesn't
work on Mono, it will make porting code to Mono harder.
------- Additional Comments From firstname.lastname@example.org 2004-03-30 11:27 -------
Can you post a simple test case? It would be of great help.
+------- Additional Comments From email@example.com 2004-03-30 15:11 -------
+ object valueInField = dataSource[columnOrdinal];
+ bool isColumnValueDBNull = dataSource.IsDBNull(columnOrdinal);
+ bool isColumnValueDBNull = (dataSource[columnOrdinal] ==
+ rowDestination[i].IsNull = isColumnValueDBNull;
+dataSource is a SqlDataReader object, open, and it points to a current
+row. Per row I read the fields and store them in individual field
+objects. The code above shows a conditional compile statement I had to
+ add to make it work at runtime. The #else branche works on .NET 1.1,
+the #if MONO branche works on Mono (and .NET 1.1). Because IsDBNull is
+very slow on .NET 1.1, I use the much faster compare statement as
+shown in the #else branche. The #else branche code works with ODP.NET
+and SqlClient, I assume it's standard to store System.DBNull.Value as
+the value for the field if that field is NULL in the database.
+As I can't debug the mono code, I can't check what's in the datareader
+field at the ordinal specified, I assume 'null'. Other people have
+confirmed me that the postgresql provider for mono does store
+System.DBNull.Value as the field's value if a field is NULL.