Skip to content
Snippets Groups Projects
Commit fdccf268 authored by Jared Hancock's avatar Jared Hancock
Browse files

orm: Implement __isnull match criteria

parent 8cf2c3c9
Branches
Tags
No related merge requests found
...@@ -808,7 +808,7 @@ class MySqlCompiler extends SqlCompiler { ...@@ -808,7 +808,7 @@ class MySqlCompiler extends SqlCompiler {
'lt' => '%1$s < %2$s', 'lt' => '%1$s < %2$s',
'gte' => '%1$s >= %2$s', 'gte' => '%1$s >= %2$s',
'lte' => '%1$s <= %2$s', 'lte' => '%1$s <= %2$s',
'isnull' => '%1$s IS NULL', 'isnull' => array('self', '__isnull'),
'like' => '%1$s LIKE %2$s', 'like' => '%1$s LIKE %2$s',
'hasbit' => '%1$s & %2$s != 0', 'hasbit' => '%1$s & %2$s != 0',
'in' => array('self', '__in'), 'in' => array('self', '__in'),
...@@ -830,6 +830,12 @@ class MySqlCompiler extends SqlCompiler { ...@@ -830,6 +830,12 @@ class MySqlCompiler extends SqlCompiler {
return sprintf('%s IN (%s)', $a, $b); return sprintf('%s IN (%s)', $a, $b);
} }
function __isnull($a, $b) {
return $b
? sprintf('%s IS NULL', $a)
: sprintf('%s IS NOT NULL', $a);
}
function compileJoin($tip, $model, $alias, $info) { function compileJoin($tip, $model, $alias, $info) {
$constraints = array(); $constraints = array();
$join = ' JOIN '; $join = ' JOIN ';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment