mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fixed yii\db\Command::upsert() for Cubrid/MSSQL/Oracle
This commit is contained in:
@ -85,7 +85,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
list(, $placeholders, $values, $params) = $this->prepareInsertValues($table, $insertColumns, $params);
|
||||
$mergeSql = 'MERGE INTO ' . $this->db->quoteTableName($table) . ' '
|
||||
. 'USING (' . (!empty($placeholders) ? 'VALUES (' . implode(', ', $placeholders) . ')' : ltrim($values, ' ')) . ') AS "EXCLUDED" (' . implode(', ', $insertNames) . ') '
|
||||
. 'ON ' . $on;
|
||||
. "ON ($on)";
|
||||
$insertValues = [];
|
||||
foreach ($insertNames as $name) {
|
||||
$quotedName = $this->db->quoteColumnName($name);
|
||||
|
@ -380,7 +380,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
list(, $placeholders, $values, $params) = $this->prepareInsertValues($table, $insertColumns, $params);
|
||||
$mergeSql = 'MERGE ' . $this->db->quoteTableName($table) . ' WITH (HOLDLOCK) '
|
||||
. 'USING (' . (!empty($placeholders) ? 'VALUES (' . implode(', ', $placeholders) . ')' : ltrim($values, ' ')) . ') AS [EXCLUDED] (' . implode(', ', $insertNames) . ') '
|
||||
. 'ON ' . $on;
|
||||
. "ON ($on)";
|
||||
$insertValues = [];
|
||||
foreach ($insertNames as $name) {
|
||||
$quotedName = $this->db->quoteColumnName($name);
|
||||
|
@ -236,7 +236,7 @@ EOD;
|
||||
}
|
||||
$mergeSql = 'MERGE INTO ' . $this->db->quoteTableName($table) . ' '
|
||||
. 'USING (' . (isset($usingValues) ? $usingValues : ltrim($values, ' ')) . ') "EXCLUDED" '
|
||||
. 'ON ' . $on;
|
||||
. "ON ($on)";
|
||||
$insertValues = [];
|
||||
foreach ($insertNames as $name) {
|
||||
$quotedName = $this->db->quoteColumnName($name);
|
||||
|
Reference in New Issue
Block a user