File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes find method from database side in B&S Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "find method from database side in B&S" Watch "find method from database side in B&S" New topic
Author

find method from database side in B&S

pramod karnani
Ranch Hand

Joined: May 22, 2007
Posts: 88

Hi All,
find method is given like this in instruction:
// 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)



Here I am talking about search from database side not from User Interface

I implemented find method like this way:

If user will specify criteria array like this

criteria[0]="SubContractor name";
criteria[1]=null
criteria[2]=null
criteria[3]=null
criteria[4]=null
criteria[5]=null


then find method will return record number array of those records those are matches with criteria[0]="SubContractor name"
since only criteria[0](sub contractor name ) is specified.

If user will specify criteria array like this

criteria[0]="SubContractor name";
criteria[1]="city"
criteria[2]=null
criteria[3]=null
criteria[4]=null
criteria[5]=null


then find method will return record number array of those records those are matches with this condition (criteria[0]="SubContractor name" OR criteria[1]="city")
since only criteria[0](sub contractor name ) and criteria[1](city) are specified.


If user will specify criteria array like this

criteria[0]="SubContractor name";
criteria[1]="city"
criteria[2]="services"
criteria[3]=null
criteria[4]=null
criteria[5]=null


then find method will return record number array of those records those are matches with this condition (criteria[0]="SubContractor name" OR criteria[1]="city" OR criteria[2]="specialities")


so on.

It is like OR condition of criteria string array elements.

is it okay?

Regards
Pramod

Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Pramod!


It is like OR condition of criteria string array elements.

is it okay?


That's exactly it!


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
 
Consider Paul's rocket mass heater.
 
subject: find method from database side in B&S
 
Similar Threads
find method in B&S
B&S: Requirement Clarification
find method in B&S
Do we need to filter the search result data?
find and RecordNotFoundException in B&S