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

[sqlite] file descriptor leak

2017-02-11 Thread alexc
Hi, In file shell.c static char *readFile(const char *zName, int *pnByte){ FILE *in = fopen(zName, "rb”); // == allocate fd in long nIn; size_t nRead; char *pBuf; if( in==0 ) return 0; fseek(in, 0, SEEK_END); nIn = ftell(in); rewind(in); pBuf = sqlite3_malloc64( nIn+1 ); // == try to allocate

[sqlite] Bug: CREATE TABLE AS with GROUP BY preserves backticks in generated column name

2017-02-11 Thread Alek Storm
> CREATE TABLE t1 (col1 INT); > CREATE TABLE t2 AS SELECT `col1` FROM t1 GROUP BY col1; > .schema t2 CREATE TABLE t2("`col1`" INT); I expected: CREATE TABLE t2(col1 INT); Note the following generate the schema I expect: # With backticks, without GROUP BY: > CREATE TABLE t2 AS SELECT `col1` FROM

[sqlite] SQLITE_ENABLE_UPDATE_DELETE_LIMIT - my "final" patch

2017-02-11 Thread Ziemowit Laski
Hello again, So after discussions with Jan and further contemplation, I concluded that the only way to get a hold on the '#line ... ' issues in the generated parse.c is to write a dedicated tool to do it. The patch herein contains such a tool, named 'lineclean'. The tool detects sequences of

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] Index list

2017-02-11 Thread Dominique Devienne
On Sat, Feb 11, 2017 at 3:54 PM Simon Slavin wrote: > On 11 Feb 2017, at 2:50pm, Rob van der sloot > wrote: > > I want to use the index of a specific column of a table as a pulldown > list > > But I can't find any syntax how to select or view an

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread jose isaias cabrera
DD, just adding a comma separator for long integers (numbers), as you are suggesting, would be a bad idea> The next thing would be a set of questions to Dr. Hipp: "why just comma separator for large numbers? Why doesn't SQLite support the full feature of locale and formatting depending on

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] Index list

2017-02-11 Thread Niall O'Reilly
On 11 Feb 2017, at 14:50, Rob van der sloot wrote: > I want to use the index of a specific column of a table as a pulldown list > in my application. Wouldn't SELECT DISTINCT column FROM table; give you the same effect? I expect the query planner would use the table or not according to

Re: [sqlite] Index list

2017-02-11 Thread Simon Slavin
On 11 Feb 2017, at 2:50pm, Rob van der sloot wrote: > I want to use the index of a specific column of a table as a pulldown list > in my application. > But I can't find any syntax how to select or view an index. Sorry. There is no way to find the contents of an

[sqlite] Index list

2017-02-11 Thread Rob van der sloot
I want to use the index of a specific column of a table as a pulldown list in my application. But I can't find any syntax how to select or view an index. Thanks Rob van der Sloot -- This email and any attachments to it may be confidential and are intended solely for the use of the individual

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