UnionOfRAD/lithium — Issue #165: Operators in SET clause (MySql)
Author: jblotus
Created: 2011-10-20 23:31:18+00:00
State: open

I am having trouble getting something like this going:

UPDATE list_items SET completed = NOT completed;

This works in mysql to basically toggle the field based on the value that already exists. Very handy.

Something similar to this would be good since we already have it in the conditions parsing:

Model::update(array(
'completed' => array('NOT' => 'completed')
), $conditions, $options);

After working with the MySql adapter as it stands, I end up having to use my own methods to take advantange of native mysql functions in some cases. Luckily #li3 makes this easy to implement.

also, is it reasonable to request a generic model::query() method?