Ref #649 - Added query builder support for BETWEEN clauses

Signed-off-by: Stan Bondi <stan@stanley-pc.(none)>
This commit is contained in:
Stan Bondi
2012-10-17 23:36:18 +02:00
parent 2e8364994f
commit 5f4838726e
2 changed files with 88 additions and 0 deletions

27
laravel/database/query/grammars/grammar.php Normal file → Executable file
View File

@@ -242,6 +242,33 @@ class Grammar extends \Laravel\Database\Grammar {
return $this->wrap($where['column']).' NOT IN ('.$parameters.')';
}
/**
* Compile a WHERE BETWEEN clause
*
* @param array $where
* @return string
*/
protected function where_between($where)
{
$min = $this->parameter($where['min']);
$max = $this->parameter($where['max']);
return $this->wrap($where['column']).' BETWEEN '.$min.' AND '.$max;
}
/**
* Compile a WHERE NOT BETWEEN clause
* @param array $where
* @return string
*/
protected function where_not_between($where)
{
$min = $this->parameter($where['min']);
$max = $this->parameter($where['max']);
return $this->wrap($where['column']).' NOT BETWEEN '.$min.' AND '.$max;
}
/**
* Compile a WHERE NULL clause.
*