From eec306d4cffea8846a68559019ffe3dff3fdaeef Mon Sep 17 00:00:00 2001 From: 5ini99 <5ini99@sohu.com> Date: Tue, 9 Feb 2016 09:18:35 +0800 Subject: [PATCH] Update Driver.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改模型类中使用addAll方法时,第三个replace参数无效问题 --- library/think/db/Driver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/db/Driver.php b/library/think/db/Driver.php index bdcae0a6..fc9fe036 100644 --- a/library/think/db/Driver.php +++ b/library/think/db/Driver.php @@ -960,7 +960,7 @@ abstract class Driver } $values[] = 'SELECT ' . implode(',', $value); } - $sql = 'INSERT INTO ' . $this->parseTable($options['table']) . ' (' . implode(',', $fields) . ') ' . implode(' UNION ALL ', $values); + $sql = (true === $replace ? 'REPLACE' : 'INSERT') . ' INTO ' . $this->parseTable($options['table']) . ' (' . implode(',', $fields) . ') ' . implode(' UNION ALL ', $values); $sql .= $this->parseComment(!empty($options['comment']) ? $options['comment'] : ''); return $this->execute($sql, $this->getBindParams(true), !empty($options['fetch_sql']) ? true : false); }