Win a copy of AWS Security this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

End of the Data file

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers,
I am working on B&S assignment.I understood the file format and i have printed the start of the file and the schema description and also the first record.But how do I know in advance how many records are there in the file.Thanks for your reply and your time
 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can apply an algorithm like the following:



But you won't be able to know how many valid/deleted records you have in that file, only the total number of records.
 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Alecsandru Cocarla for your reply
 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi;

how do I know in advance how many records are there in the file.



simply,
- read the start of data section or the location of first record in the database and put it in dbStart integer variable.
- read the length of the hole file and put it in dbFileLength integer variable.
- In advance you know the size of the one record. as you calculate this size during the looping on the fields name and size of each field, so put the size of one record in recordSize integer variable.
- So numOfRecordInDB = (dbFileLength - dbStart) / recordSize; .......... ;-)


best regards.
Mohamed Sulibi.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sree,

see this post: https://coderanch.com/t/424600/Developer-Certification-SCJD/start-position-of-data-db

 
sree visu
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
Carlos Lacerda and mohamed sulibi for your reply
 
Do not set lab on fire. Or this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic