Re:SQLite 3.32
by fauigerzigerk on Saturday May 23, 2020 @11:40AM
(#23283818)
I have a lot of Excel-like use cases for which SQLite would be a great fit if only it had a decimal type.
[ Parent
| on HN ]
Re:SQLite 3.32
by lifepillar on Sunday May 24, 2020 @02:18AM
(#23289570)
I have developed SQLiteDecimal: http://chiselapp.com/user/lifepillar/repository/sqlite3decim...
Still very rough, but usable.
Re:SQLite 3.32
by justinclift on Sunday May 24, 2020 @03:50AM
(#23289911)
> WARNING: this library is NOT ready for production. Use at your own risk!
How far off do you reckon it is from being "production" ready?
Asking because we've been adding useful SQLite extensions as optional extras in our (sqlitebrowser.org) installer. Can add yours too, if you reckon the code is reasonably cross platform and shouldn't cause (many) weird issues. :)
As in like Java Bigdecimal, with a BigInteger on the left side, and a fixed precision on the right?
Re:SQLite 3.32
by fauigerzigerk on Saturday May 23, 2020 @12:01PM
(#23284000)
As in other database systems such as Postgres. Even a C# style decimal floating point type would be sufficient.
Basically--it's a struct containing a byte array, weight, scale, and sign, and all the arithmetic operations are implemented in software. So it's really slow, and each RDBMS has to implement this type from scratch, or find a vendor lib that provides a suitable one, because C/C++ standard libraries don't provide one.
Re:SQLite 3.32
by darksaints on Saturday May 23, 2020 @03:26PM
(#23285648)
It does have a decimal type.
Re:SQLite 3.32
by fauigerzigerk on Saturday May 23, 2020 @05:14PM
(#23286519)
No, that's just an alias for numeric type affinity which results in a binary floating point type if there's a decimal point.
There's also a long tradition of "faking" decimals with integers. I have always found that to be extremely tedious and error prone.