From 4993e9eeaa4c72f729dbefe25a3b7b5df38c650d Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Mon, 15 May 2023 21:12:34 +0100 Subject: [PATCH] rebase --- .../ImportExport/Model/Resource/Helper/Mysql4.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php index 16bf62c3e66..a3eb3783198 100644 --- a/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php @@ -48,12 +48,17 @@ public function getMaxDataSize() */ public function getNextAutoincrement($tableName) { - $adapter = $this->_getReadAdapter(); - $entityStatus = $adapter->showTableStatus($tableName); + $connection = $this->_getReadAdapter(); - if (empty($entityStatus['Auto_increment'])) { + $sql = sprintf( + 'SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = %s AND TABLE_SCHEMA = DATABASE()', + $connection->quote($tableName) + ); + $entityStatus = $connection->fetchRow($sql); + if (empty($entityStatus['AUTO_INCREMENT'])) { Mage::throwException(Mage::helper('importexport')->__('Cannot get autoincrement value')); } - return $entityStatus['Auto_increment']; + + return $entityStatus['AUTO_INCREMENT']; } }