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
diff options
context:
space:
mode:
authorUmadevi S <uma@mono-cvs.ximian.com>2004-06-18 14:33:17 +0400
committerUmadevi S <uma@mono-cvs.ximian.com>2004-06-18 14:33:17 +0400
commit41e1f3ce9fde18d01947a3b7bdbc60c189ba1782 (patch)
tree4cb338e49280083d29cc311c26c1e1ca1d689a43 /mcs/class/System.Data/System.Data.Common
parenta5eaabf6f167e67b323a8f18d7291d29326fc6b2 (diff)
2004-06-18 Umadevi S <sumadevi@novell.com>
* DataContainer.cs - CheckedforNull before calling the relavant setmethods in each of the SetItemForDataRecord method for all the classes. svn path=/trunk/mcs/; revision=29866
Diffstat (limited to 'mcs/class/System.Data/System.Data.Common')
-rwxr-xr-xmcs/class/System.Data/System.Data.Common/ChangeLog4
-rw-r--r--mcs/class/System.Data/System.Data.Common/DataContainer.cs40
2 files changed, 28 insertions, 16 deletions
diff --git a/mcs/class/System.Data/System.Data.Common/ChangeLog b/mcs/class/System.Data/System.Data.Common/ChangeLog
index f416e72befb..f3d069de7bc 100755
--- a/mcs/class/System.Data/System.Data.Common/ChangeLog
+++ b/mcs/class/System.Data/System.Data.Common/ChangeLog
@@ -1,3 +1,7 @@
+2004-06-18 Umadevi S <sumadevi@novell.com>
+ * DataContainer.cs - CheckedforNull before calling the relavant setmethods in each of the
+ SetItemForDataRecord method for all the classes.
+
2004-06-17 Boris Kirzner <borisk@mainsoft.com>
* RecordCache.cs : Added CopyRecord mathod that copies single record from one table to another.
diff --git a/mcs/class/System.Data/System.Data.Common/DataContainer.cs b/mcs/class/System.Data/System.Data.Common/DataContainer.cs
index 2799ed4fe21..5b627d7d8ba 100644
--- a/mcs/class/System.Data/System.Data.Common/DataContainer.cs
+++ b/mcs/class/System.Data/System.Data.Common/DataContainer.cs
@@ -164,6 +164,13 @@ namespace System.Data.Common
SetNull(index,false,isDbNull);
}
+ protected bool CheckAndSetNull( int index, IDataRecord record, int field)
+ {
+ bool isDbNull = record.IsDBNull(field);
+ SetNull(index,false,isDbNull);
+ return isDbNull;
+ }
+
protected int CompareNulls(int index1, int index2)
{
bool null1 = IsNull(index1);
@@ -244,8 +251,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetInt16(field));
- base.SetItemFromDataRecord(index,record,field);
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetInt16(field));
}
internal override void CopyValue(int fromIndex, int toIndex)
@@ -356,8 +363,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetInt32(field));
- base.SetItemFromDataRecord(index,record,field);
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetInt32(field));
}
internal override void CopyValue(int fromIndex, int toIndex)
@@ -468,8 +475,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetInt64(field));
- base.SetItemFromDataRecord(index,record,field);
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetInt64(field));
}
internal override void CopyValue(int fromIndex, int toIndex)
@@ -571,8 +578,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetFloat(field));
- base.SetItemFromDataRecord(index,record,field);
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetFloat(field));
}
internal override void CopyValue(int fromIndex, int toIndex)
@@ -674,8 +681,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetDouble(field));
- base.SetItemFromDataRecord(index,record,field);
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetDouble(field));
}
internal override void CopyValue(int fromIndex, int toIndex)
@@ -777,8 +784,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetByte(field));
- base.SetItemFromDataRecord(index,record,field);
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetByte(field));
}
internal override void CopyValue(int fromIndex, int toIndex)
@@ -881,7 +888,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetBoolean(field));
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetBoolean(field));
}
internal override void CopyValue(int fromIndex, int toIndex)
@@ -969,7 +977,7 @@ namespace System.Data.Common
internal override void SetItemFromDataRecord(int index, IDataRecord record, int field)
{
// if exception thrown, it should be caught
- // in the caller method
+ // in the caller metho
SetValue(index,record.GetValue(field));
base.SetItemFromDataRecord(index,record,field);
}
@@ -1050,8 +1058,8 @@ namespace System.Data.Common
{
// if exception thrown, it should be caught
// in the caller method
- SetValue(index,record.GetString(field));
- base.SetItemFromDataRecord(index,record,field);
+ if (!CheckAndSetNull ( index, record,field))
+ SetValue(index,record.GetString(field));
}
internal override int CompareValues(int index1, int index2)