nette / database

💾 A database layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.
https://doc.nette.org/database
Other
492 stars 105 forks source link

double fetch()ed as string #289

Closed Honzy closed 2 years ago

Honzy commented 2 years ago

Version: 3.1.4

Bug Description

Double in database is returned as string.

Steps To Reproduce

Double with a lot of zeros is returned as string (f.e. 0.000074601974431321)

(float)0.000074601974431321 -> 7.4601974431321e-5 $row[$key] = (string) $float === $value ? $float : $value;// FALSE, return string -> Helpers->normalizeRow() row 210

Expected Behavior

Return float

Possible Solution

$row[$key] = preg_match("/^-{0,1}\d+\.\d+$/", $value) === 1 ? $float : $value;

double