Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beta Question: findByCriteria

 
Tybon Wu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
According to the interface, findByCriteria(String [] criteria) will return the record numbers that match any non-null element of the criteria array. It also says null fields are treated as wild cards. I'm not sure what this means. Sounds like if the criteria array contains a null element, then every record number in the database will be returned. Am I intepreting this right?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds good to me.
I would assume null in the search array and not in the db.db file.
Mark
 
Ruby Wong
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Tybon Wu:
Hi.
According to the interface, findByCriteria(String [] criteria) will return the record numbers that match any non-null element of the criteria array. It also says null fields are treated as wild cards. I'm not sure what this means. Sounds like if the criteria array contains a null element, then every record number in the database will be returned. Am I intepreting this right?

May you tell me what do the criteria array contains? I'm confused after reading your question and the supplied doc.
Thanks.
 
Tybon Wu
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The criteria array is an array of strings where each element of the array is compared to every field of every record in the database. If a field starts with one of the strings in the criteria array, then the record number of that field returned. The interface also states that null is considered as wildcards, which means that if the criteria array contains one or more null element, then every record number in the database will be returned. At least that's what I think.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic