Commit 816d3117 authored by screeper's avatar screeper

Added update "column = !column"

Useful for changing booleans in DB.
Update like this:

...
$db->update("table", array("col_boolean" => $db->not()));
parent bc5116f8
...@@ -477,6 +477,10 @@ class MysqliDb ...@@ -477,6 +477,10 @@ class MysqliDb
} }
} }
break; break;
case '[N]':
if($val == null) $this->_query .= "!" . $column . ", ";
else $this->_query .= "!" . $val . ", ";
break;
default: default:
die ("Wrong operation"); die ("Wrong operation");
} }
...@@ -754,6 +758,14 @@ class MysqliDb ...@@ -754,6 +758,14 @@ class MysqliDb
return Array ("[I]" => "-" . (int)$num); return Array ("[I]" => "-" . (int)$num);
} }
/**
* Method generates change boolean function call
* @param string column name. null by default
*/
public function not ($col = null) {
return Array ("[N]" => (string)$col);
}
/** /**
* Method generates user defined function call * Method generates user defined function call
* @param string user function body * @param string user function body
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment