-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #275 from envms/fix/insert-execute
Add executeWithoutId() method for inserts into tables without a primary key
- Loading branch information
Showing
1 changed file
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
roquie
|
||
{ | ||
$result = parent::execute(); | ||
|
||
if ($result) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
|
$sequence
parameter real needed here?