Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Bold/Persistence    [ Add a report in this area ]  
Report #:  4870   Status: Closed
Association Objects & UpdateDatabaseWithList exceptions
Project:  Delphi Build #:
Version:    7.0 Submitted By:   Daniel Mauric
Report Type:  Basic functionality failure Date Reported:  6/28/2003 6:06:00 PM
Severity:    Serious / Highly visible problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   194582
Resolution: Fixed (Resolution Comments) Resolved in Build: :
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: 1
When adding/removing objects to a multilink association objects are automatically created/deleted. But there seems to be something wrong with the way these are counted internally, as an UpdateDatabaseWithList raises an List index out of bounds in certain situations.

I really can't describe it better at this point. The attached app does show the problem clearly. I will update the description when I get a better idea of the cause of the problem.
Steps to Reproduce:
Run the attached app, create DB & open system.

1. Create a Person
2. Create a Group
3. Press the 'Clear & Add' button 5 times or type 5 in the edit box & press once
4. Delete the Person
5. Press the 'FormSaver Apply' button
6. 'List index out of bounds (3)'

Exception is raised in TBoldFormSaver.SaveObjects method, in a call to UpdateDatabaseWithList. A second call to UpdateDatabaseWithList completes without exceptions.

If UpdateDatabase is executed instead of UpdateDatabaseWithList everything works fine.

You can repeat the process with a different number in the edit box, observe the difference in the index in the exception. Here are some results, I can't recognize a pattern though.

5x = 3
10x = 4
20x = 7
30x = 9
40x = 12
50x = 14
A second call to UpdateDatabaseWithList suceeds, so here's a workaround:

A general case:

    on e: EListError do

TBoldFormSaver.SaveObjects :

    TempList := Objects.Clone as TBoldObjectList;
        on e: EListError do
          on e: exception do
            if assigned(OnUpdateException) then

Inspiration Matters Ltd Director at 1/24/2004 6:37:06 AM -
I get the same error when deleting objects with cascade delete to other objects.  The ListIndexOutOfBounds happens on the next System.UpdateDatabase.  No need for UpdateDatabaseWithList to be involved.


Kjell Rilbe at 2/21/2004 2:57:45 PM -
I can consistently reproduce this error but am unable to publish the application for business reasons as well as for practical ones. This is a BoldExpress setup running under IIS.

I might be able to isolate the problem with some work but have not time to do so right now. If anyone (Jesper?) needs help isolating the bug, please contact me and I'll see what I can do, or rather, what we can do together.

Server Response from: ETNACODE01