• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Search Field and Database Field

 
Song Jing Lim
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My B&S Assignmnet requirement for find as below:
// Returns an array of record numbers that match the specified
// criteria. Field n in the database file is described by
// criteria[n]. A null value in criteria[n] matches any field
// value. A non-null value in criteria[n] matches any field
// value that begins with criteria[n]. (For example, "Fred"
// matches "Fred" or "Freddy".)
public int [] find(String [] criteria) throws RecordNotFoundException;

So the criteria[n] must match with database field[n]?

E.g.
Data[0] = name
Data[1] = location
Data[2] = specialties
Data[3] = size
Data[4] = rate
Data[5] = owner

let say criteria[] value as below:
criteria[0] = My name
criteria[1] = null
criteria[2] = My specialties
criteria[3..5] = null

So I need loop through all record and match the name and specialties value in database again the value in criteria?

 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, that's the idea.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic