Skip to content

Commit f2acd8c

Browse files
Enhance BIGINT size limit validation in Database class
- Added handling for VAR_BIGINT in the size limit validation logic. - Implemented exception throwing for oversized BIGINT attributes to ensure proper error handling.
1 parent 909d8a5 commit f2acd8c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Database/Database.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,6 +2584,7 @@ protected function validateDefaultTypes(string $type, mixed $default): void
25842584
}
25852585
break;
25862586
case self::VAR_INTEGER:
2587+
case self::VAR_BIGINT:
25872588
case self::VAR_FLOAT:
25882589
case self::VAR_BOOLEAN:
25892590
if ($type !== $defaultType) {
@@ -2912,6 +2913,12 @@ public function updateAttribute(string $collection, string $id, ?string $type =
29122913
throw new DatabaseException('Max size allowed for int is: ' . number_format($limit));
29132914
}
29142915
break;
2916+
case self::VAR_BIGINT:
2917+
$limit = ($signed) ? $this->adapter->getLimitForBigInt() / 2 : $this->adapter->getLimitForBigInt();
2918+
if ($size > $limit) {
2919+
throw new DatabaseException('Max size allowed for bigint is: ' . number_format($limit));
2920+
}
2921+
break;
29152922
case self::VAR_FLOAT:
29162923
case self::VAR_BOOLEAN:
29172924
case self::VAR_DATETIME:

0 commit comments

Comments
 (0)