Compare commits

...

2 Commits

Author SHA1 Message Date
Arsen Mirzaev Tatyano-Muradovich 93078df174 resolved #24 2025-03-27 09:29:24 +07:00
Arsen Mirzaev Tatyano-Muradovich e263eb3f0b resolved #22 2025-02-17 20:55:11 +07:00

View File

@ -493,11 +493,20 @@ class database
/** /**
* Count * Count
* *
* @throws exception_runtime If the database is corrupted (counting result is float)
*
* @return int Amount of records * @return int Amount of records
*/ */
public function count(): int{ public function count(): int
// Exit (success) {
return $this->length > 0 && file_exists($this->database) ? filesize($this->database) / $this->length : 0; // Deleting the database file cache
clearstatcache(true, $this->database);
// Counting
$amount = $this->length > 0 && file_exists($this->database) ? filesize($this->database) / $this->length : 0;
// Exit (success/fail)
return is_int($amount) ? $amount : throw new exception_runtime('The database is corrupted');
} }
/** /**