Hi,

Is it possible to negate a condition of a database-query
I know its no problem to nest conditions via db_or|and|xor. But is it possible to negate such a condition on an arbitrary position.
For example sth like:

$condition = db_not()->condition('b.date' , $date, '=');

I know i can change the operator to "!=". But there are cases where such a method would be useful.

Greetings Peter

Comments

RoloDMonkey’s picture

As far as I know there isn't a way to do this, and there might be good reasons. For instance, how would it handle comparisons to NULL values? It is probably better to explicitly state the conditional operator, rather than hide what is really going on in a class.

--

Read more at iRolo.net