From 0118962a8f7468a394ace980b4c487677e0fc262 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Wed, 10 Nov 2021 16:34:22 +0900 Subject: [PATCH] Insert NULL instead of 0 for next sequence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://xetown.com/questions/1627614 sql_mode에 NO_AUTO_VALUE_ON_ZERO가 포함되어 있는 경우 0을 입력하면 AUTO_INCREMENT가 작동하지 않음 --- common/framework/db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/framework/db.php b/common/framework/db.php index 20915fb9f..79759080d 100644 --- a/common/framework/db.php +++ b/common/framework/db.php @@ -678,7 +678,7 @@ class DB */ public function getNextSequence() { - $this->_handle->exec(sprintf('INSERT INTO `%s` (seq) VALUES (0)', $this->addQuotes($this->_prefix . 'sequence'))); + $this->_handle->exec(sprintf('INSERT INTO `%s` (seq) VALUES (NULL)', $this->addQuotes($this->_prefix . 'sequence'))); $sequence = $this->getInsertID(); if ($this->isError()) {