Skip to content
Open
Changes from 3 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
26 changes: 15 additions & 11 deletions MysqliDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -779,34 +779,38 @@ public function insertMulti($tableName, array $multiInsertData, array $dataKeys
// only auto-commit our inserts, if no transaction is currently running
$autoCommit = (isset($this->_transaction_in_progress) ? !$this->_transaction_in_progress : true);
$ids = array();

$options = [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use old Array() syntax since we still support old php version

'_queryOptions' => $this->_queryOptions,
'_nestJoin' => $this->_nestJoin,
'_forUpdate' => $this->_forUpdate,
'_lockInShareMode' => $this->_lockInShareMode
];
if($autoCommit) {
$this->startTransaction();
}

foreach ($multiInsertData as $insertData) {
if($dataKeys !== null) {
// apply column-names if given, else assume they're already given in the data
$insertData = array_combine($dataKeys, $insertData);
}

foreach ($options as $k => $v) {
$this->${'k'} = $v;
}
$id = $this->insert($tableName, $insertData);
if(!$id) {
if($autoCommit) {
if(!$id ) {
if($autoCommit && !in_array('IGNORE', $options['_queryOptions'])) {
$this->rollback();
}
return false;
$id = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still should be return false; plus previous comments are not addressed

}
$ids[] = $id;
}

}
if($autoCommit) {
$this->commit();
}

}
return $ids;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove all whitespace changes

/**
* Replace method to add new row
*
Expand Down