[Mono-dev] DataTable.Select() bug

Konstantin Triger kostat at mainsoft.com
Mon Dec 12 05:47:50 EST 2005

Hello all,


Attached a fix for the following bug:


static void Main(string[] args)


            DataTable d = new DataTable();

            d.Columns.Add (new DataColumn ("aaa"));

            DataRow [] rows = d.Select (null, null,

            Console.Out.WriteLine (rows.Length.ToString ());

            d.Rows.Add (new object [] {"bbb"});

            d.Rows.Add (new object [] {"bbb"});

            rows = d.Select (null, null, DataViewRowState.Deleted);

            Console.Out.WriteLine (rows.Length.ToString ());



0 should be printed in both cases, but we print 2 in the second.


The reason for this behavior is wrong Index.Update() logic.

Actually we did several errors there:

1.	We were validating before the indices were updated.
2.	Not in all the cases the update was called.
3.	The update logic was broken as it did not provide enough info to
decide what has changed.


The attached patch fixes this. Please review.

If no one objects I'll commit.



Konstantin Triger


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051212/3edf8ebd/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: index_update.diff
Type: application/octet-stream
Size: 19174 bytes
Desc: index_update.diff
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051212/3edf8ebd/attachment.obj 

More information about the Mono-devel-list mailing list