Originally posted by Mike Vess:
Why should the client search for exact match and the DBMain interface find method search for records that starts with the values?
Client requrement:
"It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user."
DBMain requirement (find method):
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".)
This seems really strange because then you have to implement two different search functions? One in Data class and one somewhere else. I have solved this but i wanted to hear what you have to say about this anyway.
Actually you only need the one that does the "starts with" since the spec also says that the fields are zero delimited. If you want an exact match all you need to do is append a zero to the end of the search
string. This only works if you also trim the fields read from the data base and append a zero to them before the compare.