Last modified: 2011-11-25 07:37:30 UTC
array( 'colname' => array( 'BETWEEN', array( 1, 5 ) ) ) or array( 'colname' => array( 'BETWEEN', 1, 5 ) ) maybe? Would be applicable syntax... Or something. Similar to LEFT JOIN, I suppose Shouldn't be too difficult, might poke it later...
We don't have any good support for the more common operators like != < > <= etc... besides inline sql, we should come up with proper support for those before we add BETWEEN. Also, we can't support those syntaxes. 'colname' => array( [...] ) is already used to create a 'colname IN (...)'. We'll need to come up with a new way of writing queries. We could make a "real" query building object: DBQuery::conds() ->column('colname')->eq($foo) ->column('colname')->in($arr) ->column('colname')->like("{0}%", $foo) // perhaps something better, but I didn't like the idea of a pile more buildLike-like stuff ->column('colname')->between(1,5) ->column('colname')->compare('>=', 3) Then again, what I really want myself is abstraction that kills the need to depend heavily on database structure.
(In reply to comment #1) > We don't have any good support for the more common operators like != < > <= > etc... besides inline sql, we should come up with proper support for those > before we add BETWEEN. Maybe that's a different bug to log? ;) But you're right, it'd be nicer to be able to support the numerous "basic" operations
There appears to be some movement lately that might open up an easy way to choose an implementation. The '!' (bang, not) operator is not supported by passing it in the column-key separated by a space. > array( 'user_name !' => 'krinkle' ) That could be extended to allow something like this: > array( 'colname BETWEEN' => array( 1, 5 );