Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update getNextAutoincrement #33433

Open
wants to merge 22 commits into
base: 2.4-develop
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
66696e6
update getNextAutoincrement
jonashrem Jul 6, 2021
fba3c85
removed unused parameter inside getNextAutoincrement
jonashrem Jul 6, 2021
acb5080
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
engcom-Lima Jan 4, 2022
7e13fe7
[BUGFIX] - Corrected breaking code
engcom-Lima Jan 4, 2022
187dd29
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
engcom-Lima Jan 14, 2022
9be9c25
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
engcom-Lima Jan 19, 2022
2e472f2
[BUGFIX] - Fixed static build failures
engcom-Lima Jan 19, 2022
69c3a83
[BUGFIX] - Fixed static build failures
engcom-Lima Jan 19, 2022
1ae248e
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
engcom-Lima Jan 20, 2022
21a400a
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
engcom-Lima Feb 14, 2022
ba203fc
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
engcom-Lima Feb 22, 2022
88e78d7
Merge branch '2.4-develop' of https://github.com/magento/magento2 int…
engcom-Lima Mar 1, 2022
d98f8e9
Merge remote-tracking branch 'magento/2.4-develop' into patch-5
engcom-Charlie Jun 13, 2022
1f8cf99
Merge remote-tracking branch 'magento/2.4-develop' into patch-5
engcom-Charlie Jun 14, 2022
8e25bc1
Merge remote-tracking branch 'magento/2.4-develop' into patch-5
engcom-Charlie Jun 16, 2022
b343f17
Merge remote-tracking branch 'magento/2.4-develop' into patch-5
engcom-Charlie Jun 21, 2022
a1f49b8
Merge branch '2.4-develop' into patch-5
ishakhsuvarov Oct 20, 2022
f2fb780
Merge branch '2.4-develop' into patch-5
engcom-Echo Jan 27, 2023
3b0381c
Merge branch '2.4-develop' into patch-5
engcom-Echo Feb 1, 2023
16bc249
Merge branch '2.4-develop' into patch-5
engcom-Echo Feb 2, 2023
abbf247
Merge branch '2.4-develop' into patch-5
engcom-Echo Feb 6, 2023
a2ef34e
Merge branch '2.4-develop' into patch-5
engcom-Echo Feb 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions app/code/Magento/ImportExport/Model/ResourceModel/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ class Helper extends \Magento\Framework\DB\Helper
/**
* Constants to be used for DB
*/
const DB_MAX_PACKET_SIZE = 1048576;
public const DB_MAX_PACKET_SIZE = 1048576;

// Maximal packet length by default in MySQL
const DB_MAX_PACKET_COEFFICIENT = 0.85;
public const DB_MAX_PACKET_COEFFICIENT = 0.85;

// The coefficient of useful data from maximum packet length

/**
* @param \Magento\Framework\App\ResourceConnection $resource
* @param string $modulePrefix
* phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod
*/
public function __construct(\Magento\Framework\App\ResourceConnection $resource, $modulePrefix = 'importexport')
{
Expand Down Expand Up @@ -53,11 +54,15 @@ public function getMaxDataSize()
public function getNextAutoincrement($tableName)
{
$connection = $this->getConnection();
$entityStatus = $connection->showTableStatus($tableName);

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'])) {
throw new \Magento\Framework\Exception\LocalizedException(__('Cannot get autoincrement value'));
}
return $entityStatus['Auto_increment'];

return $entityStatus['AUTO_INCREMENT'];
}
}