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)

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Dominique Devienne
Gesendet: Freitag, 10. Februar 2017 15:00
An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Betreff: Re: [sqlite] thousand separator for printing large numbers

On Fri, Feb 10, 2017 at 2:41 PM, Arjen Markus <arjen.mar...@deltares.nl>
wrote:

> > -----Original Message-----
> > From: sqlite-users
> > [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf
> > Of Simon Slavin
> > Sent: Friday, February 10, 2017 2:36 PM
> > To: SQLite mailing list
> > Subject: Re: [sqlite] thousand separator for printing large numbers
> >
> >
> > On 10 Feb 2017, at 1:25pm, Arjen Markus <arjen.mar...@deltares.nl>
> wrote:
> >
> > > Not entirely, in German-spoken countries the apostrophe (') is
> > > often
> used as a
> > thousands-separator.
> >
> > That's Switzerland, right ?  Not a member of the EU.  I didn't know
> > it
> covered other
> > countries too.  Thanks.
> >
> > To make it worse still, the ISO standard says we should all be using
> > a
> non-breaking
> > space, regardless of country.
> >
> I have seen it in presentations by German speakers (the nationality,
> not the language), mostly as an unnoticed mistake or perhaps an
> automatic correction by "helpful" presentation software. (Another fun 
> exercise:
> collect the various date formats in use in various countries)
>

You guys are all beside the point! ;)

Once you can do select printf("%,d", an_int) which gets you a "hard-coded"
1,234,567,
you can always replace(select printf("%,d", an_int), ',', '.') or whatever 
separator you want (char(160) for non-breakeable space Simon).

But right now, you cannot, and have to resort to ugly SQL, which is also less 
efficient.

Thus this post to:
1) ask SQL experts on the best way to emulate thousand-sep in SQL
2) ask DRH to consider enhancing SQLite's built-in printf() to support it 
out-of-the-box.

Thanks,  --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to