On Fri, Feb 10, 2017 at 4:44 PM, Hick Gunter <h...@scigames.at> wrote:
> The beauty of SQLite lies in its user extensability. If you want a > presentation layer function in SQLite you can always write your own custom > function, without forcing your specific needs on the community as a whole. > > e.g. print_money(<amount> [, <format>]) > > with a check that <amount> is actually an integer (and not a float, > because you should not be storing money in floats, see threads wrt rounding) > and format being a string <scale><decimal><thousands> and defaulting to > "2.," (for values is in cents of major currency unit or whatever your > application is using) > First, SQLite is useful outside of purely embedded cases. When it's embedded, sure, write your own UDF, and be done with it. But when you use SQLite to create databases to be viewed in any SQLite client, as is the case here, you're limited to what SQLite provides out-of-the-box. The DB in question are a mix of a few raw-data tables in human-unfriendly form, and many views which are human friendly and slice-and-dice the raw data for easy analysis, and such views use functions like datetime(), printf(), etc... My integers have nothing to do with money, and the mere fact most modern printf or formatting libraries have thousand-separate clearly shows it's a general purpose and common enough need. It's no different from the currently formatting capabilities already provided by printf(). Sometime I wonder what's wrong with this community about the so called "lightness" of SQLite as justification to refuse all request for enhancements, however small or generally useful they are. Probably the same people who'd have cried fool over FKs, CTEs, JSON, row-values, table-valued functions / epo-vtable, etc... when SQLite was even "lighter" then, had these been proposed on list. They all just appeared magically out of DRH's hat one day, mostly unannounced until the last minute when ready for the world. Substantial and complex additions that make SQLite even greater, albeit less light... (OMG!) and overall we're all grateful of course. Oh well, maybe this one little useful addition will also come eventually (or not, given this rant...). --DD _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users