[Mono-bugs] [Bug 650589] New: Changing parent row value while child column in edit (ie. DataRow.BeginEdit) fails
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Nov 1 17:42:29 EDT 2010
https://bugzilla.novell.com/show_bug.cgi?id=650589
https://bugzilla.novell.com/show_bug.cgi?id=650589#c0
Summary: Changing parent row value while child column in edit
(ie. DataRow.BeginEdit) fails
Classification: Mono
Product: Mono: Class Libraries
Version: 2.6.x
Platform: x86
OS/Version: Windows 7
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Sys.Data
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: cvolzke at live.com.au
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1036 Safari/532.5
When changing a parent row value (no changes to pk values) while a
ForeignKeyConstraint is in place causes an exception if the child row is in
edit and changed (no changes to fk values).
Reproducible: Always
Steps to Reproduce:
Test case:
DataSet data = new DataSet();
DataTable parent = new DataTable();
DataColumn pk = parent.Columns.Add("fk");
DataColumn parentColumn = parent.Columns.Add("parentColumn");
DataTable child = new DataTable();
DataColumn fk = child.Columns.Add("fk");
DataColumn childColumn = child.Columns.Add("childColumn");
data.Tables.Add(parent);
data.Tables.Add(child);
DataRelation relation = data.Relations.Add(pk, fk);
relation.ChildKeyConstraint.UpdateRule = Rule.None;
DataRow parentRow = parent.Rows.Add("key");
DataRow childRow = child.Rows.Add("key");
childRow.BeginEdit();
childRow["childColumn"] = "hello";
parentRow["parentColumn"] = "hello"; // expect no exception
childRow.EndEdit();
Actual Results:
An exception is raised when modifying parent row value.
Expected Results:
A ConstraintException is thrown incorrectly.
Proposed fix (not necessarily best or optimised):
DataRow.CheckChildRows
----------------------
case Rule.None: // throw an exception if there are any child rows.
if (HasVersion(DataRowVersion.Proposed))
{
bool changed = false;
for (int i = 0; i < fkc.RelatedColumns.Length; i++)
if (!object.Equals(this[fkc.RelatedColumns[i],
DataRowVersion.Proposed], this[fkc.RelatedColumns[i], DataRowVersion.Current]))
changed = true;
if (!changed)
return;
}
for (int j = 0; j < childRows.Length; j++) {
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list