Permalink
Browse files

Merge pull request #152 from FrenkyNet/develop

Added support for short WHERE statements in Database_Query_Builder_Where.
  • Loading branch information...
2 parents 7aad3a1 + ab9a8e9 commit d8b496f5024456eae565c26e1de4f3ca1ec15cb0 Jelmer Schreuder committed May 26, 2011
Showing with 12 additions and 5 deletions.
  1. +12 −5 classes/database/query/builder/where.php
@@ -25,14 +25,11 @@
/**
* Alias of and_where()
*
- * @param mixed column name or array($column, $alias) or object
- * @param string logic operator
- * @param mixed column value
* @return $this
*/
- public function where($column, $op = null, $value = null)
+ public function where()
{
- return $this->and_where($column, $op, $value);
+ return call_user_func_array(array($this, 'and_where'), func_get_args());
}
/**
@@ -61,6 +58,11 @@ public function and_where($column, $op = null, $value = null)
}
else
{
+ if(func_num_args() === 2)
+ {
+ $value = $op;
+ $op = '=';
+ }
$this->_where[] = array('AND' => array($column, $op, $value));
}
@@ -93,6 +95,11 @@ public function or_where($column, $op = null, $value = null)
}
else
{
+ if(func_num_args() === 2)
+ {
+ $value = $op;
+ $op = '=';
+ }
$this->_where[] = array('OR' => array($column, $op, $value));
}
return $this;

0 comments on commit d8b496f

Please sign in to comment.