Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/Pixie/QueryBuilder/QueryBuilderHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ public function subQuery(QueryBuilderHandler $queryBuilder, $alias = null)
*
* @return array|string
*/
private function doInsert($data, $type)
private function doInsert($data, $type, $sequence = null)
{
$eventResult = $this->fireEvents('before-insert');
if (!is_null($eventResult)) {
Expand All @@ -324,7 +324,7 @@ private function doInsert($data, $type)

list($result, $executionTime) = $this->statement($queryObject->getSql(), $queryObject->getBindings());

$return = $result->rowCount() === 1 ? $this->pdo->lastInsertId() : null;
$return = $result->rowCount() === 1 ? $this->pdo->lastInsertId($sequence) : null;
} else {
// Its a batch insert
$return = array();
Expand All @@ -336,7 +336,7 @@ private function doInsert($data, $type)
$executionTime += $time;

if ($result->rowCount() === 1) {
$return[] = $this->pdo->lastInsertId();
$return[] = $this->pdo->lastInsertId($sequence);
}
}
}
Expand All @@ -351,29 +351,29 @@ private function doInsert($data, $type)
*
* @return array|string
*/
public function insert($data)
public function insert($data, $sequence = null)
{
return $this->doInsert($data, 'insert');
return $this->doInsert($data, 'insert', $sequence);
}

/**
* @param $data
*
* @return array|string
*/
public function insertIgnore($data)
public function insertIgnore($data, $sequence = null)
{
return $this->doInsert($data, 'insertignore');
return $this->doInsert($data, 'insertignore', $sequence);
}

/**
* @param $data
*
* @return array|string
*/
public function replace($data)
public function replace($data, $sequence = null)
{
return $this->doInsert($data, 'replace');
return $this->doInsert($data, 'replace', $sequence);
}

/**
Expand Down