mail-archives/mono-bugs/2010-October/105682.html

156 строки
5.7 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 650402] New: ForeignKeyConstraint enforced on deleted rows
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20650402%5D%20New%3A%20ForeignKeyConstraint%20enforced%20on%0A%09deleted%20rows&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="105693.html">
<LINK REL="Next" HREF="105684.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 650402] New: ForeignKeyConstraint enforced on deleted rows</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20650402%5D%20New%3A%20ForeignKeyConstraint%20enforced%20on%0A%09deleted%20rows&In-Reply-To="
TITLE="[Mono-bugs] [Bug 650402] New: ForeignKeyConstraint enforced on deleted rows">bugzilla_noreply at novell.com
</A><BR>
<I>Sun Oct 31 15:44:14 EDT 2010</I>
<P><UL>
<LI>Previous message: <A HREF="105693.html">[Mono-bugs] [Bug 650398] Nested relation FKs not populated correctly on xml deserialization, with ColumnMapping=MappingType.Hidden
</A></li>
<LI>Next message: <A HREF="105684.html">[Mono-bugs] [Bug 650406] New: UIImagePickerController.ReferenceUrl is an empty string
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#105682">[ date ]</a>
<a href="thread.html#105682">[ thread ]</a>
<a href="subject.html#105682">[ subject ]</a>
<a href="author.html#105682">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>
<A HREF="https://bugzilla.novell.com/show_bug.cgi?id=650402">https://bugzilla.novell.com/show_bug.cgi?id=650402</A>
<A HREF="https://bugzilla.novell.com/show_bug.cgi?id=650402#c0">https://bugzilla.novell.com/show_bug.cgi?id=650402#c0</A>
Summary: ForeignKeyConstraint enforced on deleted rows
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: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">cvolzke at live.com.au</A>
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
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
If there is a foreign key on a row and a child row is deleted, the deleted row
is attempted to be read setting EnforceConstraints to false and then true.
Reproducible: Always
Steps to Reproduce:
1. Create a foreign key constraint.
2. Add a parent row and a child row.
3. childRow.AcceptChangs(); cihldRow.Delete();
4. EnforceConstraints = false; EnforceConstraints = true;
Actual Results:
A DeletedRowInaccessibleException is raised
Expected Results:
An exception should not be raised
Test case to reproduce
----------------------
DataSet data = new DataSet();
DataTable parent = new DataTable(&quot;parent&quot;);
DataColumn pk = parent.Columns.Add(&quot;PK&quot;);
DataTable child = new DataTable(&quot;child&quot;);
DataColumn fk = child.Columns.Add(&quot;FK&quot;);
data.Tables.Add(parent);
data.Tables.Add(child);
data.Relations.Add(pk, fk);
parent.Rows.Add(&quot;value&quot;);
child.Rows.Add(&quot;value&quot;);
data.AcceptChanges();
child.Rows[0].Delete();
parent.Rows[0][0] = &quot;value2&quot;;
data.EnforceConstraints = false;
data.EnforceConstraints = true;
Proposed fix
------------
Add line
if (row.RowState == DataRowState.Deleted) continue;
to
internal override bool IsConstraintViolated()
{
if (Table.DataSet == null || RelatedTable.DataSet == null)
return false;
bool hasErrors = false;
foreach (DataRow row in Table.Rows) {
// first we check if all values in _childColumns place are nulls.
// if yes we return.
--&gt; if (row.RowState == DataRowState.Deleted) continue; // LINE
ADDED
if (row.IsNullColumns(_childColumns))
continue;
--
Configure bugmail: <A HREF="https://bugzilla.novell.com/userprefs.cgi?tab=email">https://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="105693.html">[Mono-bugs] [Bug 650398] Nested relation FKs not populated correctly on xml deserialization, with ColumnMapping=MappingType.Hidden
</A></li>
<LI>Next message: <A HREF="105684.html">[Mono-bugs] [Bug 650406] New: UIImagePickerController.ReferenceUrl is an empty string
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#105682">[ date ]</a>
<a href="thread.html#105682">[ thread ]</a>
<a href="subject.html#105682">[ subject ]</a>
<a href="author.html#105682">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>