This commit is contained in:
Roman 2021-04-08 19:24:17 +02:00
parent 4cd6dd2067
commit adf7f19df7
3 changed files with 3 additions and 7 deletions

@ -347,7 +347,8 @@ class MySQL extends SQL {
if ($param instanceof CurrentTable) {
$values[] = $this->getUnsafeValue($trigger->getTable());
} else {
$values[] = $this->columnName("NEW." . $param->getName());
$prefix = ($trigger->getEvent() !== "DELETE" ? "NEW." : "OLD.");
$values[] = $this->columnName($prefix . $param->getName());
}
}

@ -37,11 +37,6 @@ class Insert extends Query {
return $this;
}
public function execute() {
$fetchResult = !empty($this->sql->getReturning($this->returning));
return $this->sql->executeQuery($this, $fetchResult);
}
public function getTableName(): string { return $this->tableName; }
public function getColumns(): array { return $this->columns; }
public function getRows(): array { return $this->rows; }

@ -129,7 +129,7 @@ abstract class SQL {
// fetch generated serial ids for Insert statements
$generatedColumn = ($query instanceof Insert ? $query->getReturning() : null);
if($success && $fetchResult && $generatedColumn) {
if($success && $generatedColumn) {
$this->fetchReturning($res, $generatedColumn);
}