Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about recNo

 
Jofer Chan
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,Philippe:
In my DBAccess interface define follow:
public String [] readRecord(long recNo)
but in my DB file does not have the recNo,
How to get the recNo?
Is the recNo means a record's id?
if yes,but no fields(name,location,specialties,size,rate,owner) to storage it in the DB.
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jofer,
recNo is just a record number. The first one is numbered 0 (or possibly 1 or as you like - check your instructions). After having read the file header, you should know (directly or by computation) :
  • where the data section (the actual records) starts (dataSectionOffset below)
  • the length of each record


  • So, to read any record in the case your records are numbered starting with 1, you must read the file starting at position (dataSectionOffset + (recNo - 1) * recordLength), up to that position + recordLength.
    In the case your records numbers start with 0, the formula above becomes (dataSectionOffset + recNo * recordLength).
    How to get the recNo?

    Your application will get them as return values of your find() method.
    Best,
    Phil.
    [ October 24, 2003: Message edited by: Philippe Maquet ]
     
    Don't get me started about those stupid light bulbs.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic