Skip to content

Commit

Permalink
Add executeWithoutId() method for inserts into tables without a prima…
Browse files Browse the repository at this point in the history
…ry key
  • Loading branch information
cbornhoft committed Oct 30, 2018
1 parent ff4e2fb commit d3b39d9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/Queries/Insert.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,37 @@ public function onDuplicateKeyUpdate($values)
*
* @throws Exception
*
* @return integer last inserted id or false
* @return int|bool - Last inserted primary key
*/
public function execute($sequence = null)
{
$result = parent::execute();

if ($result) {
return $this->fluent->getPdo()->lastInsertId($sequence);
}

return false;
}

/**
* @param null $sequence
*
* @throws Exception
*
* @return bool
*/
public function executeWithoutId($sequence = null)
{
$result = parent::execute();

if ($result) {
return true;
}

return false;
}

/**
* @return string
*/
Expand Down

0 comments on commit d3b39d9

Please sign in to comment.