Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unique record number

 
Daniel Bevenius
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
does anyone have any input about the unique recordnumber that is to go into the database. I�ve used the flight number but I�m not sure that these are unique, even if they are in the text file.
thanks
Danny
 
scott irwin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Data::add() method checks the first column via a find() at the beginning of the method. If a row is returned, it is a duplicate key and throws an exception. What are you using this column for? It is not an integer, therefore can not be used for locking (unless you convert the signature to use String vs. row number).
 
Daniel Bevenius
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by scott irwin:
The Data::add() method checks the first column via a find() at the beginning of the method. If a row is returned, it is a duplicate key and throws an exception. What are you using this column for? It is not an integer, therefore can not be used for locking (unless you convert the signature to use String vs. row number).

The question that I have is in regard to the first column. Currently I am using the flightnumber a unique key which is ok because these are unique in the text file, but if additional flights will be added in the future how do I know that they won�t "recycle" the flightnumbers.
I use a separate class for lockning and the type of object or primitve to be locked does not matter. Please explain why locking on an int or a String would be a problem.
 
scott irwin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're right. Nothing prevents adding a row with an old flight number (readRecord returns null if deleted). But what doesn't change is the record number (unless you unload, remove dead records and reload.) I suggested that you could not use the flight number as the key for locking because the signature and semantics require the row id (an integer.) Your design may have changed my premise.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic