• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Record ID

 
Tony Bouer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are somebody using an ID for the records read from database file or just using the position where they are inside the file ? I'm figuring out if I should create an additional field ID.

Thanks,
Tony
[ August 03, 2006: Message edited by: Tony Bouer ]
 
Oricio Ocle
Ranch Hand
Posts: 284
Debian Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Tony
... I'm figuring out if I should create an additional field ID ...

why do you want to do that?
I am sure that your specs say something like:
"data file structure can not be modified", so no additional fields can be added.

Regards
 
Chulwoo Choi
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define Nth record's "record number" to be N.
This number should be unique as records are not physically deleted in the file (but just marked deleted (at least for my assignment)).

The location of Nth record in the database, then, can be found by the following psedu code:
location = lenght of start of file
+ length of schema section
+ (record number - 1) * record length

So consider the record number as ID.

Regards,
Chulwoo
 
Tony Bouer
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was wondering if I could use the file representation in the whole application. In this way I need to have a 0 (first array position) element.
By the way, thanks for your thoughts.

Tony
 
Mihai Radulescu
Ranch Hand
Posts: 918
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony,

If you choose to change your database file (field) architecture you can have problems because the database file is generated using an other application.
I have in my secs something like :

The company's IT department has a data file that contains the essential information for the company, but because the data must continue to be manipulated for reports using another custom-written application, the new system must reimplement the database code from scratch without altering the data file format.


Regards M.
 
Khaled Mahmoud
Ranch Hand
Posts: 361
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please see my comments about using the record ID to be the same as the record number.
http://www.coderanch.com/t/188502/java-developer-SCJD/certification/RecordID-implementation
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic