• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

delete record, update gui

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was wondering how to solve the following problem:
When a client reads the data, it is in a certain order. When one is deleted through the interface that we have to implement(contractor assignement). The order is disturbed. If the client than books a record by referencing it by an integer, the changes are that the wrong record is booked.
Do I need to solve this?
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course you need to solve this

I don't know which assignment you have, but deleting a record shouldn't change the order of the other records. You just set the "deleted" flag, but the record numbers remain. This means there can been "gaps" in the record numbers and your application should be able to handle this.

Mathias
[ October 09, 2006: Message edited by: Mathias De Groof ]
 
Ernst Steenbrink
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mathias,

The assignement I have is with the B&S database(broker of contractors).
The Gap you mention is not the problem. It is the dynamic behavior that is my problem. When a client has a list of records that it is displaying and in the server, 1 record is deleted and the client wants to update a record, it will not update the correct record.
Example:
Existing :
0 record0
1 record1
2 record2
3 record3
4 record4

now this is send to the client.
then record2 is deleted in the database :
0 record0
1 record1
X record2 -> deleted
2 record3
3 record4
Now the client wants record3 to be updated. so it calls update(3,data);
but in the server id 3 no points to record 4.
I believe this problem exists because the records are not used with a unique key but based on their sequential number.
2 solutions I see are:
1) have an update function to notify the clients that the data has changed.
2) Keep record of the last list of data that a client has gotten with a find and read.
So the question is, do I need to go this far?
 
mmg
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think you should shift record numbers the way you do.

If your initial situation is (where "N" is the deleted flag):

0 record0 N
1 record1 N
2 record2 N
3 record3 N
4 record4 N

After you delete record 2, this should be:

0 record0 N
1 record1 N
2 record2 Y
3 record3 N
4 record4 N

When a new record is inserted, you can just overwrite the deleted record2, and the inserted record becomes the new record2. This way you don't have any "shifting".

Off course I don't know if you can use this solution with your assignment (I have the URLyBird one myself), since you will have to keep a "deleted" flag in your DB.
 
Ernst Steenbrink
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I see where I'am going wrong. In the client I have the following to get the data( in pseudo code):
while not exception:
read record

where I need to keep a list of non-deleted records in sequence without gaps.

I think I will have to replace this with an empty find to get a list of record numbers which don't have to be in sequence but can have gaps.
 
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic