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 c79acbe0518..cb4d19638b1 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']; } }