Re: [sqlite] Using CTE with date comparison

2018-08-05 Thread Csányi Pál
2018-08-05 0:18 GMT+02:00 Keith Medcalf : > > WITH RECURSIVE > dates(dateD) AS (VALUES(:StartDate) > UNION ALL > SELECT date(dateD, '+1 year') > FROM dates >WHERE date(dateD, '+1 year') <= :EndDate > ) > SELECT

Re: [sqlite] "Cheating" at making common tables

2018-08-05 Thread Stephen Chrzanowski
Simon; Interesting approach that I'd forgotten about. The tables aren't "variable". This is a "beginning of the project, one-time execution" thing I was hoping to get at database initialization. Meaning, 0-byte SQLite file size kind of initialization, with not a single line of application code

Re: [sqlite] Using CTE with date comparison

2018-08-05 Thread Keith Medcalf
:StartDate and :EndDate are NAMED PARAMETERS for when your application executes the statement (that is, they are substituted with the values you want for the StartDate and EndDate respectively. I take it you want to compute YEARS MONTHS and DAYS between two dates: WITH RECURSIVE dates

Re: [sqlite] Using CTE with date comparison

2018-08-05 Thread pali
On Sun, Aug 05, 2018 at 05:25:02AM -0600, Keith Medcalf wrote: > > :StartDate and :EndDate are NAMED PARAMETERS for when your application > executes the statement (that is, they are substituted with the values you > want for the StartDate and EndDate respectively. I understand now. Thank you!

Re: [sqlite] [EXTERNAL] Common index for multiple databases

2018-08-05 Thread Jim Callahan
Back off from the index semantics for a second. If Gunter Hick has captured at the application level of what you are trying to do (remote databases), I think the name of the concept we are looking for is: "Eventual Consistency". https://en.wikipedia.org/wiki/Eventual_consistency SQL databases

Re: [sqlite] Using CTE with date comparison

2018-08-05 Thread Keith Medcalf
>Some where in the WITH clause above I want to put '+1 day' in the >command out there. That is because the query does not count the StartDate but does count the EndDate, so if your EndDate is the next day from the StartDate you get 1 day, not two. You need to move the fencepost

[sqlite] shell edit() trips on Windows newline kink

2018-08-05 Thread Larry Brasfield
I was experimenting today with a v3.25.0 variant and encountered this bug, on my Windows 10 system, when I used the SQLite CLI shell's edit() function. Because I had put a newline in the text with the invoked editor, and it was written and read back as a text file, the following code got unhappy:

Re: [sqlite] [EXTERNAL] Save text file content in db: lines or whole file?

2018-08-05 Thread Hick Gunter
Please try to avoid using keywords as names, especially if they conflict with the intended datatype. "text blob not null" creates a field of name "text" whose content is a blob and yet you intend to store text data (with embedded newlines) in it. If you store the lines separately, you can

[sqlite] Default Values Pragma bug

2018-08-05 Thread R Smith
This is a small niggle, perhaps not worthy of the term "bug". The Default values when specified in a CREATE TABLE statement will include C-style commented text in the output of the pragma table_info() (or its t.v.f. derivative) while the actual default value handling will parse it out.