Re: [sqlite] thousand separator for printing large numbers

2017-03-09 Thread Dominique Devienne
On Thu, Mar 9, 2017 at 11:59 AM, Dominique Devienne wrote: > On Fri, Feb 10, 2017 at 10:46 AM, Dominique Devienne > wrote: > >> What would be the [...] most efficient way to do this (NDR: thousand >> separator) in SQL? >> > > Here's a little demo that

Re: [sqlite] thousand separator for printing large numbers

2017-03-09 Thread Dominique Devienne
On Fri, Feb 10, 2017 at 10:46 AM, Dominique Devienne wrote: > What would be the [...] most efficient way to do this (NDR: thousand > separator) in SQL? > Here's a little demo that evaluates the 3 approaches proposed in this thread. Formatting 10M numbers takes ~2s using

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread Scott Robison
On Feb 11, 2017 7:15 PM, "James K. Lowden" wrote: On Fri, 10 Feb 2017 10:46:24 +0100 Dominique Devienne wrote: > PS: In this context, I don't want to use a host-program provided UDF. > This is data meant to be viewed with any SQLite client, so

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread James K. Lowden
On Fri, 10 Feb 2017 10:46:24 +0100 Dominique Devienne wrote: > PS: In this context, I don't want to use a host-program provided UDF. > This is data meant to be viewed with any SQLite client, so kind of > "report". https://github.com/jklowden/sqlrpt While Clemens was

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread Michael Falconer
Congrats to all contributors to this thread. Robust discussions like this make this my absolute favourite list. For the record I like the OP's suggestion which was more about the features of the printf() function than anything else. Everybody wins though, because of the great discussion and the

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread R Smith
On 2017/02/11 6:50 PM, Clemens Ladisch wrote: James K. Lowden wrote: I doubt you'll win that argument. You should have checked before writing this. ;-) http://www.sqlite.org/cgi/src/info/064445b12f99f76e Pfff, my subsequent points all made moot. Well done and thanks for this!

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread R Smith
On 2017/02/11 1:36 AM, Jens Alfke wrote: On Feb 10, 2017, at 2:45 AM, Dominique Devienne wrote: Honestly Clemens? There wouldn't be a built-in printf() and substr() etc... if that was the case. Not really. Those aren’t necessarily intended to format data for display,

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread E.Pasma
10 feb 2017, Dominique Devienne: There's http://sqlite.1065341.n5.nabble.com/printf-with-thousands-separator-td85022.html And my feeble attempt below. But there's got to be a better way, no? What would be the shortest and/or most efficient way to do this in SQL? .. sqlite> with s(v) as (

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread Dominique Devienne
On Sat, Feb 11, 2017 at 5:51 PM Clemens Ladisch wrote: > James K. Lowden wrote: > > I doubt you'll win that argument. > > You should have checked before writing this. ;-) > http://www.sqlite.org/cgi/src/info/064445b12f99f76e > > I saw that too this morning. Made my day.

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread R Smith
On 2017/02/10 8:15 PM, Dominique Devienne wrote: On Fri, Feb 10, 2017 at 6:56 PM, Dominique Devienne wrote: I'm sure DRH could probably add it in his sleep in [1] , around the switch line 236 with a new flag, with room to spare in et_info.flags to store it, and with the

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread jose isaias cabrera
om: Dominique Devienne Sent: Friday, February 10, 2017 1:06 PM To: SQLite mailing list Subject: Re: [sqlite] thousand separator for printing large numbers On Fri, Feb 10, 2017 at 6:53 PM, Stephen Chrzanowski <pontia...@gmail.com> wrote: Bringing in "Other Database Engines do it!" disc

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread Clemens Ladisch
James K. Lowden wrote: > I doubt you'll win that argument. You should have checked before writing this. ;-) http://www.sqlite.org/cgi/src/info/064445b12f99f76e Regards, Clemens ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread Keith Maxwell
If the `printf` function could add a thousands separator there I are times I would have used it! Instead I've ended up using a recursive CTE and `||` operators to build up the string. I can't find the query right now. Maybe the CLI tool is a better place for the feature, I suggest either as a

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread James K. Lowden
On Fri, 10 Feb 2017 20:57:34 +0100 Dominique Devienne wrote: > the view itself calls printf. I see now. Your request is very specific: to support a thousands separator in the SQL printf. You don't want to write a UDF, and you don't want to use any facilities above the API

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Jens Alfke
> On Feb 10, 2017, at 2:45 AM, Dominique Devienne wrote: > > Honestly Clemens? There wouldn't be a built-in printf() and substr() etc... > if that was the case. Not really. Those aren’t necessarily intended to format data for display, and I’ve never used them for that.

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Clemens Ladisch
Dominique Devienne wrote: > On Fri, Feb 10, 2017 at 6:53 PM, Stephen Chrzanowski > wrote: >> The date and time are stored as a number, not >> "Friday, February 10, 2017 12:43:33pm". > > And that's exactly why SQLite has date and time functions. > Notably the one converting a

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
On Fri, Feb 10, 2017 at 7:40 PM, James K. Lowden wrote: > On Fri, 10 Feb 2017 10:46:24 +0100 > Dominique Devienne wrote: > > > Couldn't SQLite's built-in printf gain a thousand-separator formatting > > argument, which doesn't need to be locale

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread James K. Lowden
On Fri, 10 Feb 2017 10:46:24 +0100 Dominique Devienne wrote: > Couldn't SQLite's built-in printf gain a thousand-separator formatting > argument, which doesn't need to be locale aware or could be even > explicit after the arg? ... > This is data meant to be viewed with any

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
On Fri, Feb 10, 2017 at 6:56 PM, Dominique Devienne wrote: > On Fri, Feb 10, 2017 at 6:21 PM, Jens Alfke wrote: > >> > On Feb 10, 2017, at 5:59 AM, Dominique Devienne >> wrote: >> > >> > 2) ask DRH to consider enhancing SQLite's

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
On Fri, Feb 10, 2017 at 6:53 PM, Stephen Chrzanowski wrote: > Bringing in "Other Database Engines do it!" discussion [...] > When did I do that? > Any element that is to be portrayed to the users screen should be handled > by whatever UI engine is displaying the

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
On Fri, Feb 10, 2017 at 6:21 PM, Jens Alfke wrote: > > On Feb 10, 2017, at 5:59 AM, Dominique Devienne > wrote: > > > > 2) ask DRH to consider enhancing SQLite's built-in printf() to support > it out-of-the-box. > > I disagree; this is feature bloat. >

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Stephen Chrzanowski
Bad design begins where you start throwing formatting functions in a SQL call that could be used as a calculated value. You request information for text, numbers, or blobs of binary data. Nothing more, nothing less, because it is assumed that you're going to do something productive with the

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread John McKown
On Fri, Feb 10, 2017 at 11:21 AM, Jens Alfke wrote: > > > On Feb 10, 2017, at 5:59 AM, Dominique Devienne > wrote: > > > > 2) ask DRH to consider enhancing SQLite's built-in printf() to support it > > out-of-the-box. > > I disagree; this is feature

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Jens Alfke
> On Feb 10, 2017, at 5:59 AM, Dominique Devienne wrote: > > 2) ask DRH to consider enhancing SQLite's built-in printf() to support it > out-of-the-box. I disagree; this is feature bloat. SQLite is an embedded database, and the host app can do whatever it wants with the

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
On Fri, Feb 10, 2017 at 4:44 PM, Hick Gunter 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. > >

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Hick Gunter
lite-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 M

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
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

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Arjen Markus
> -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

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Simon Slavin
On 10 Feb 2017, at 1:25pm, Arjen Markus 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

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Arjen Markus
> -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On > Behalf > Of Simon Slavin > > Just to add to what Clemens wrote, you would at least need ways of doing > comma- > separation for thousands, dot-separation for thousands, and

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Simon Slavin
On 10 Feb 2017, at 10:26am, Clemens Ladisch wrote: >> Couldn't SQLite's built-in printf gain a thousand-separator formatting >> argument, which doesn't need to be locale aware > > Thousand separators _are_ locale specific. Just to add to what Clemens wrote, you would at

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
On Fri, Feb 10, 2017 at 11:26 AM, Clemens Ladisch wrote: > Dominique Devienne wrote: > > But there's got to be a better way, no? > > A database stores data. Formatting the data for the user is not the > job of the database but of the actual application. Honestly Clemens?

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Clemens Ladisch
Dominique Devienne wrote: > But there's got to be a better way, no? A database stores data. Formatting the data for the user is not the job of the database but of the actual application. > Couldn't SQLite's built-in printf gain a thousand-separator formatting > argument, which doesn't need to

[sqlite] thousand separator for printing large numbers

2017-02-10 Thread Dominique Devienne
There's http://sqlite.1065341.n5.nabble.com/printf-with-thousands-separator-td85022.html And my feeble attempt below. But there's got to be a better way, no? What would be the shortest and/or most efficient way to do this in SQL? Couldn't SQLite's built-in printf gain a thousand-separator