This commit is contained in:
MatteoPistorello 2022-04-20 17:29:20 +02:00
commit 513d9be396
1 changed files with 5 additions and 0 deletions

View File

@ -254,6 +254,7 @@ abstract class AppResource extends Resource implements RetrieveInterface, Create
$db_name = $database->getDatabaseName(); $db_name = $database->getDatabaseName();
// Ottiene il valore successivo della colonna di tipo AUTO_INCREMENT // Ottiene il valore successivo della colonna di tipo AUTO_INCREMENT
$database->query('ANALYZE TABLE '.prepare($table_name));
$next_autoincrement = $database->fetchOne('SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '.prepare($table_name).' AND TABLE_SCHEMA = '.prepare($db_name))['AUTO_INCREMENT']; $next_autoincrement = $database->fetchOne('SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '.prepare($table_name).' AND TABLE_SCHEMA = '.prepare($db_name))['AUTO_INCREMENT'];
/* /*
@ -291,6 +292,10 @@ abstract class AppResource extends Resource implements RetrieveInterface, Create
$step['end'] = $next_autoincrement - 1; $step['end'] = $next_autoincrement - 1;
} }
if ($step['end'] == '-1') {
$step['end'] = $next_autoincrement;
}
if ($step['end'] >= $step['start']) { if ($step['end'] >= $step['start']) {
$total = array_merge($total, range($step['start'], $step['end'])); $total = array_merge($total, range($step['start'], $step['end']));
} }