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

Calculating OffSet

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Guys, I am confuse about calculating Offset Values.

For the first record.. it should be

the header ... but for the 2nd and next...

do use

1) headersize + (a record size * currentRecordNo) + deleteflag(1)

or

2) headersize + (a record size * (currentRecordNo)) + currentRecordNo;

it seems the 2nd way works.. I don't understand why must i add the current record count and not + 1 for delete flag.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it is just working because your deleted flag is 1. If it was 2 I guess your 2nd formula would not work at all.

I would expect something like: headerSize + ((record length + deleted flag) * recNo)
 
Ixus See
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
same here.. I would also expect that + 1 for delete flag(but it didn't work all the words are jumble up)... BUT the 2nd formula works!!! I don't know why.. can some guru explain to me~??~
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please notice the difference in my formula against your 1st formula! They give complete different results!
 
Ixus See
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roel De Nijs wrote:Please notice the difference in my formula against your 1st formula! They give complete different results!



oh!! pardon me, I haven't been sleeping much for days.. and still stuck @ database layer..

Thanks once again
 
Ranch Hand
Posts: 590
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd suggest opening the file with a Hex Editor and starting comparing the schema to the file contents. Then everything will be clear. This thread here should help you to understand the schema and read the data file.
 
Onion rings are vegetable donuts. Taste this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic