• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

key field in find method

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The following is the comment of the find method from my Data class. From the body of the method, I can tell it is using the first element of the String array expression of a record, which is the flight number. I am confused about: "For this assignment, the key field is the record number field.". What is this record number field?
Thanks in advance!
/**
* This method searches the database for an entry which has a first
* field which exactly matches the string supplied. If the required
* record cannot be found, this method returns null. For this
* assignment, the key field is the record number field.
*
* @param toMatch The key field value to match upon for
* a successful find.
* @return DataInfo The matching record.
* @exception DatabaseException Thrown when database file could not be accessed.
*/
public synchronized DataInfo find(String toMatch) throws DatabaseException {
...
}
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The find method compares the argument String to the flight number field. This is the character based field in the db.db. Do not confuse this field with the actual record number, which you pass to the locking mechanism.
Mark
 
michael opto
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!
reply
    Bookmark Topic Watch Topic
  • New Topic