• 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

B&S - find criteria

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to make sure about discussion "B&S - serching" below.
I am doing B&S 2.1.1.

I have
"public int[] find(String[] criteria)."

And I have a sentese in The User Interface specification:
"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."

In the DB schema, name is first field and location is second field.

Therefore, can i call find method like :
String[] criteria = new String[];
criteria[0]="fred";
criteria[1]="adel";

int[] returnResult = DBImp.find(criteria);

and result will have int array of record numbers matching the value in name field( i.e both of "fred" and "freddy") and/or match the value in location (i.e both of "adel" and "adelaide")

Am i right?

another question is about "AND/OR" in "where the name AND/OR location fields exactly match values specified by the user."

I have no idea how i can make code "name and location" and "name or location".
if i pass the criteria array value below

String[] criteria = new String[];
criteria[0]="fred";
criteria[1]="adel";
criteria[2]="and"; or criteria[2]="or";

do you think it will be fine?
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my program, I use the following:

Name only:
criteria[0] = "fred";
criteria[1] = ""; (Any in my GUI)

Location only:
criteria[0] = ""; (Any in my GUI)
criteria[1] = "atlantis";

Name & Location:
criteria[0] = "fred";
criteria[1] = "atlantis";

each values use for one column. First value for first column, ... null values will return all records.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic