Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Record ID

 
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 ]
 
Ranch Hand
Posts: 284
Netbeans IDE Firefox Browser Debian
  • 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
 
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
 
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.
 
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.
https://coderanch.com/t/188502/java-developer-SCJD/certification/RecordID-implementation
 
Crusading Chameleon likes the size of this ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic