Just seen this new bit added to the spec:
- $selectwhere is supposed to be a limited sql predicate.
- The set of operators allowed in $selectwhere are :- =, <>, >, >=, <, <=, !=
- The set of keywords allowed in $selectwhere are :- IN, BETWEEN, LIKE, IS NULL, IS NOT NULL
- Use of anything besides the mentioned keywords/operators is strictly forbidden.
I assume that means something like a string "userid = 123 AND value > 3 AND time BETWEEN 1234567890 AND 1234567900".
Note you, have not said AND is an allowed operator! Also, I see no need or advantage in allowing both <> and !=. <> is the SQL standard operator. Let us insist on that.
Instead of invention some new thing (pseudo-SQL string that then each implementation has to parse) why not instead do something like we already do in $DB, e.g. the above would become
array('userid' => 123, 'value' => array('>', 3), 'time' = array('BETWEEN', 1234567890, 1234567900))
This would be nicer if we used the new PHP array syntax:
['userid' => 123, 'value' => ['>', 3], 'time' = ['BETWEEN', 1234567890, 1234567900]]
If we decided that this format is nice, we could even start using in in $DB methods like get_records as well as here.