Skip to content

Commit

Permalink
Handle SQLite without ENABLE_DBSTAT_VTAB enabled. Fixes #44860 (#44867)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrooksuk authored Nov 7, 2022
1 parent f14b34b commit 3c5bdfd
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/Illuminate/Database/Console/DatabaseInspectionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Database\ConnectionInterface;
use Illuminate\Database\MySqlConnection;
use Illuminate\Database\PostgresConnection;
use Illuminate\Database\QueryException;
use Illuminate\Database\SQLiteConnection;
use Illuminate\Database\SqlServerConnection;
use Illuminate\Support\Arr;
Expand Down Expand Up @@ -151,11 +152,15 @@ protected function getPostgresTableSize(ConnectionInterface $connection, string
*/
protected function getSqliteTableSize(ConnectionInterface $connection, string $table)
{
$result = $connection->selectOne('SELECT SUM(pgsize) AS size FROM dbstat WHERE name=?', [
$table,
]);
try {
$result = $connection->selectOne('SELECT SUM(pgsize) AS size FROM dbstat WHERE name=?', [
$table,
]);

return Arr::wrap((array) $result)['size'];
return Arr::wrap((array) $result)['size'];
} catch (QueryException $e) {
return null;
}
}

/**
Expand Down

0 comments on commit 3c5bdfd

Please sign in to comment.