Skip to content

Commit 66696e6

Browse files
authored
update getNextAutoincrement
update getNextAutoincrement to not use showTableStatus for performants reasons. See also magento#28516
1 parent bf4cdad commit 66696e6

File tree

1 file changed

+13
-4
lines changed
  • app/code/Magento/ImportExport/Model/ResourceModel

1 file changed

+13
-4
lines changed

app/code/Magento/ImportExport/Model/ResourceModel/Helper.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,20 @@ public function getMaxDataSize()
5353
public function getNextAutoincrement($tableName)
5454
{
5555
$connection = $this->getConnection();
56-
$entityStatus = $connection->showTableStatus($tableName);
57-
58-
if (empty($entityStatus['Auto_increment'])) {
56+
$sql = sprintf(
57+
'SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = %s AND TABLE_SCHEMA = DATABASE()',
58+
$this->quote($tableName),
59+
$fromDbName
60+
);
61+
$entityStatus = $connection->fetchRow($sql);
62+
if (empty($entityStatus['AUTO_INCREMENT']))
63+
{
5964
throw new \Magento\Framework\Exception\LocalizedException(__('Cannot get autoincrement value'));
6065
}
61-
return $entityStatus['Auto_increment'];
66+
67+
return $entityStatus['AUTO_INCREMENT'];
68+
69+
70+
6271
}
6372
}

0 commit comments

Comments
 (0)