Round function doesn't work with SQLite3
Database management in a single PHP file
Brought to you by:
jakubvrana
When I execute SQL command select round(vcc,2) as vcc2 from tab;
from Adminer, vcc2's column values (type real) are not rounded. When I execute the same SQL command from my Nodejs app, sqlite3 command line or even my own PHP app, it is ok.
I use login-sqlite plugin, tested on PHP 7.1.8 and PHP 5.6.31
This is not specific to Adminer, PHP does this. My guess is that the field is transferred as float which is unprecise.
How this could be PHP related when my own PHP script below is working fine?
While
"select round(vcc,2) as vcc2 from tab;"
in Adminer is not working (values are not rounded).Last edit: Pablo 2018-01-22
Adminer sets precision to 20.
I've decreased the display precision to 17 which is the PHP's internal float precision.