Skip to content

Commit

Permalink
Merge pull request #52 from vc-dhavaljoshi/main
Browse files Browse the repository at this point in the history
#48 resolve issue getTableSize(): Return value must be of type string
  • Loading branch information
vc-urvin authored Jun 4, 2024
2 parents 997ea50 + daa3236 commit 4a5cedc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Constants/Constant.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,6 @@ class Constant
public const ACTION = 'action';

public const STATUS = 'status';

public const DEFAULT_SIZE = '0.00';
}
5 changes: 3 additions & 2 deletions src/Traits/DBConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ public function getTableSize(string $tableName): string
ORDER BY
(DATA_LENGTH + INDEX_LENGTH) DESC';
$result = DB::select($query);

if ($result) {
return $result[0]->size;
return $result[0]->size ?? Constant::DEFAULT_SIZE;
}

} catch (Exception $exception) {
Log::error($exception->getMessage());
}
return Constant::NULL;
return Constant::DEFAULT_SIZE;
}

/**
Expand Down

0 comments on commit 4a5cedc

Please sign in to comment.