Insert NULL instead of 0 for next sequence

https://xetown.com/questions/1627614

sql_mode에 NO_AUTO_VALUE_ON_ZERO가 포함되어 있는 경우
0을 입력하면 AUTO_INCREMENT가 작동하지 않음
This commit is contained in:
Kijin Sung 2021-11-10 16:34:22 +09:00
parent 093fa43e37
commit 0118962a8f

View file

@ -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())
{