Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

B&S: the length of returned array

 
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the readRecord method, does it return an array of 7 fields, including flag?
Or it just return 6 field without flag?

// Reads a record from the file. Returns an array where each
// element is a record value.
public String [] readRecord(long recNo)
throws RecordNotFoundException;

In the updateRecord method, does it also accept an array of 7 fields?

2 byte numerica, number of fields in each record in db file is 6 when I read db file by readShort().

I hope to confirm this.
Thank you in advance for reply to me .
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

where do you guys get all those strange ideas? I find it only makes sense to handle the deleted flag as part of the file format specification that matters only for the part of the implementation that deals with the file directly rather than passing around deleted records.

I had B & S version 2.3.2, and the method signature in DBMain was public String[] read(int recNo). I got 24/40 for the GUI and 100 % for the rest (96 % total).

Conan
 
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Conan,

Please remember JavaRanch's primary rule: be nice! All questions are welcome here. Something that might be blindingly obvious to you might not be as obvious to others. And the reverse may also apply.

Thanks and regards, Andrew.
 
Andrew Monkhouse
author and jackaroo
Posts: 12199
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Steve,

I think that you would not want to pass the deleted flag back to the client. Logically you would never send a deleted record to a client, so that flag would have no meaning to the client.

Or, to look at it from a different perspective, consider the following from the instructions:

Data section.
Repeat to end of file:
1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record
Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information



The "deleted" flag is mentioned separately from the "Record" data. So it would not be included.

Regards, Andrew
 
Steve Taiwan
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Andrew, Conan

Thank you for the reply.
Now, I know the fields should not include flag.
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic