Here my situation...I have a table which hold knowledgebase information, therefore some fields are:
keywords, content, date created, date updated, category, ranking...
Typically most users sort by rank or by relevance, etc...but they may occasionally include these criteria in their search patterns as well...
So now my trivial CRUD operations which previously worked on a single record using a PKID have faced a road block...
I could write seperate one-off search functions based on criteria:
- selectById()
- selectByKeywords() // paginated results & relevance ordering
- selectByAll() // paginated results & arbitrary ordering
I'm curious...given the situation, which I assume is quite common...how do you handle the situation?
Do you have a catch-all select function using advanced argument arrays/objects/structures or do you define and implement seperate functions like above? Perhaps you use a really cool SQL builder function passing it table names and generic filter criteria and have it return an query object as a parameter to all your high level SQL API functions??? The latter is what I'm trying to conceptualize...if it's possible...etc...
Cheers