Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[NX:URLyBird] About deleted record

 
Leo Tien
Ranch Hand
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.
Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.
Which condition should throws this Exception? Since the record has been deleted, why should query it, since shouldn't query it, why throw RecordNotFoundException?
In my DBMain interface have several methods throw this Exception, such as lock and unlock, since the record has been deleted, why lock it?
2. When the client click the "search all" button to search all the records in the db.db file, whether the deleted record is displayed too?
3.
1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record
Because the functions in this application only are search and update, don't include delete or create, what use this "deleted" flag is?
Now, I can think about the deleted record only above, can anybody add more? Post it on this thread, let's summarize it.
 
Philippe Maquet
Bartender
Posts: 1872
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leo,
Which condition should throws this Exception? Since the record has been deleted, why should query it, since shouldn't query it, why throw RecordNotFoundException?
In my DBMain interface have several methods throw this Exception, such as lock and unlock, since the record has been deleted, why lock it?

RecordNotFoundException is there to tell you that a record is deleted. How else would you know it ?
2. When the client click the "search all" button to search all the records in the db.db file, whether the deleted record is displayed too?

No, from the client point of view, deleted records simply don't exist.
Because the functions in this application only are search and update, don't include delete or create, what use this "deleted" flag is?

Your client application only needs search and update, but you must implement create and delete functionalities in your database system. Other applications may need it, or even yours for future enhancements.
Best,
Phil.
 
Leo Tien
Ranch Hand
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Philippe:
RecordNotFoundException is there to tell you that a record is deleted. How else would you know it ?

The assignment said that
Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.

Which condition is that I query the record that does not exist? Whether is the client search the record by name and/or location, but no result return, at this time, throws RecordNotFoundException and notify the user the result is null?
 
Vlad Rabkin
Ranch Hand
Posts: 555
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leo,
Which condition is that I query the record that does not exist

I am not sure I understand your question, but I hope my answer is what you want to know:
1.) you search for records. You found some.
2.) you try to book a record from those you just have found, but somebody
have just deleted a record. Your should get RecordNotFoundException.
Another scenario if you strictly use the interface provided by Sun:
1) you found some record and your find method returned array of int.
2) you loop through the array to read the found records
3) Some records can be in meantime deleted. So, you will get RecordNotFoundException.
Best,
Vlad
 
Leo Tien
Ranch Hand
Posts: 156
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Vlad.
These are just I want to know.
Thanks again.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic