SDataSet.removeRecord(SRecordInstance rinst)

damien hostin <[email protected]> Mon, 16 Feb 2009 11:27:44 +0100
Newsgroups gmane.comp.java.orm.simpleorm
Message-ID <[email protected]>
Hello,

I just find a bug in the method removeRecord from the SDataSet object. 
It seems that each SRecordInstance in the dataset have a updateListIndex 
attribute. This attribute is used to quickly find the index in the dirty 
record list from a dataset. When removeRecord is used, the dirty record 
list shifts all elements from the deleted one to the end of the list, so 
that the deleted record is removed ! All the record updateListIndex from 
this point are no longer correct. They bind their old position in the 
list, not the new.

I don't know which way is better to avoid the bug, substract 1 from all 
index that have been shifted or not remove the record but set the array 
entry to null ... ? Setting to null is quicker but may be the cause of 
futur bugs. I could trust the unit test to validate the fix. I think 
shifting the updateListIndex is more reliable even if it add more cpu work.



-- 
HOSTIN Damien - Equipe R&D
Tel:+33(0)4 63 05 95 40
Société Axège
23 rue Saint Simon
63000 Clermont Ferrand
www.axege.com




------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/SimpleORM/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/SimpleORM/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/