[Mono-bugs] [Bug 650397] New: DataRow.GetParentRows doesn't work with > 1 parent records

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 31 14:28:21 EDT 2010



           Summary: DataRow.GetParentRows doesn't work with > 1 parent
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.6.x
          Platform: Other
        OS/Version: Other
            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/ Safari/532.5

When DataRow.GetParentRows() should return more than 1 record (assuming 1
column), an IndexOutOfRangeException is thrown.

Reproducible: Always

Steps to Reproduce:
1. Create a DataRow that has 2 parent rows for a relation
2. Call DataRow.GetParentRows

Actual Results:  

Expected Results:  
All parent rows returned

The fix is simple and would look like this:

try {
    Index index = relation.ParentTable.FindIndex(parentColumns);
    if (index != null) { // get the parent rows from the index
        int [] parentRecords = index.FindAll (tmpRecord);
        for (int i = 0; i < parentRecords.Length; i++)
            // CHANGED HERE         \/ - i must be 0 to get the correct table
otherwise u get an IndexOutOfRangeException
            rows.Add (parentColumns [0].Table.RecordCache [parentRecords [i]]);
    } else { // no index so we have to search manualy.

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