Kohana v3.3.5
This commit is contained in:
@@ -31,7 +31,7 @@ class Kohana_Database_Query_Builder_Insert extends Database_Query_Builder {
|
||||
if ($table)
|
||||
{
|
||||
// Set the inital table name
|
||||
$this->_table = $table;
|
||||
$this->table($table);
|
||||
}
|
||||
|
||||
if ($columns)
|
||||
@@ -47,11 +47,14 @@ class Kohana_Database_Query_Builder_Insert extends Database_Query_Builder {
|
||||
/**
|
||||
* Sets the table to insert into.
|
||||
*
|
||||
* @param mixed $table table name or array($table, $alias) or object
|
||||
* @param string $table table name
|
||||
* @return $this
|
||||
*/
|
||||
public function table($table)
|
||||
{
|
||||
if ( ! is_string($table))
|
||||
throw new Kohana_Exception('INSERT INTO syntax does not allow table aliasing');
|
||||
|
||||
$this->_table = $table;
|
||||
|
||||
return $this;
|
||||
@@ -86,8 +89,11 @@ class Kohana_Database_Query_Builder_Insert extends Database_Query_Builder {
|
||||
|
||||
// Get all of the passed values
|
||||
$values = func_get_args();
|
||||
|
||||
$this->_values = array_merge($this->_values, $values);
|
||||
|
||||
foreach ($values as $value)
|
||||
{
|
||||
$this->_values[] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@@ -309,7 +309,7 @@ class Kohana_Database_Query_Builder_Select extends Database_Query_Builder_Where
|
||||
*/
|
||||
public function offset($number)
|
||||
{
|
||||
$this->_offset = $number;
|
||||
$this->_offset = ($number === NULL) ? NULL : (int) $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -404,13 +404,14 @@ class Kohana_Database_Query_Builder_Select extends Database_Query_Builder_Where
|
||||
|
||||
if ( ! empty($this->_union))
|
||||
{
|
||||
$query = '('.$query.')';
|
||||
foreach ($this->_union as $u) {
|
||||
$query .= ' UNION ';
|
||||
if ($u['all'] === TRUE)
|
||||
{
|
||||
$query .= 'ALL ';
|
||||
}
|
||||
$query .= $u['select']->compile($db);
|
||||
$query .= '('.$u['select']->compile($db).')';
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -172,7 +172,7 @@ abstract class Kohana_Database_Query_Builder_Where extends Database_Query_Builde
|
||||
*/
|
||||
public function limit($number)
|
||||
{
|
||||
$this->_limit = $number;
|
||||
$this->_limit = ($number === NULL) ? NULL : (int) $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user