Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Keith Medcalf
Well, the documentation *says* that a with clause cannot be used in a trigger, but that is incorrect, at least for the current tip of trunk ... because the following script works ... ---//--- snip ---//--- pragma recursive_triggers = 1; create table if not exists services ( id

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread R Smith
On 2018/08/26 8:44 PM, Csányi Pál wrote: On Sun, Aug 26, 2018 at 07:17:00PM +0200, R Smith wrote: You have misunderstand the purpose of the MyLengthOfService table. The MyLengthOfService table contains WorkPlaces not for many persons, but for one person only. So my goal is to get summed years,

Re: [sqlite] Time Precision

2018-08-26 Thread dmp
Keith Medcalf wrote: > Are you running Windows or Unix? I am sending this to you as I was just looking > into this again and although SQLite maintains time internally with a millisecond > precision, the API used on Windows to read the time is limited by the Clock > Resolution (usually about 16.5

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Csányi Pál
On Sun, Aug 26, 2018 at 07:17:00PM +0200, R Smith wrote: > On 2018/08/26 2:16 PM, Csányi Pál wrote: > > > >>> When the trigger is fired, those numbers are not updated in the > >>> corresponding fields of the corresponding table. > >>> To be more precise, the AllYearsMonthsDays trigger does not

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Simon Slavin
On 26 Aug 2018, at 6:17pm, R Smith wrote: > Ok, enough about what is wrong with it. Here's how it can be fixed: And there you have it, ladies and gentlemen. Around two thousand bucks of consultancy for free. The difference between copy-and-paste and actually understanding the products in

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread R Smith
On 2018/08/26 2:16 PM, Csányi Pál wrote: When the trigger is fired, those numbers are not updated in the corresponding fields of the corresponding table. To be more precise, the AllYearsMonthsDays trigger does not work. The YearsRemainingMonthsDays trigger works. What am I missing here? --

Re: [sqlite] Unsigned

2018-08-26 Thread R Smith
On 2018/08/26 4:47 PM, Thomas Kurz wrote: But, as noted, you could just store those as blobs, bigendian if you want sorting, and indexing will work just fine. No other conversion needed. Yes, I can store *anything* as blobs. When arguing like this, we wouldn't need strings, dates, floats or

Re: [sqlite] Unsigned

2018-08-26 Thread Thomas Kurz
> But, as noted, you could just store those as blobs, bigendian if you want > sorting, and indexing will work just fine. No other conversion needed. Yes, I can store *anything* as blobs. When arguing like this, we wouldn't need strings, dates, floats or any other type neither.

Re: [sqlite] Unsigned

2018-08-26 Thread Wout Mertens
On Sun, Aug 26, 2018, 2:21 AM D Burgess wrote: > 2. Mixed 64/32 bit system that has integers that use the full 64 bits. > Numbers are sourced by realtime hardware. > Absence of 64 bit unsigned means addition of few functions to handle > inserts and display representation(s), numbers stored as

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Jean-Luc Hainaut
Please check the syntax of the case-end function. As you have written them, they just return boolean values. J-L Hainaut On 26/08/2018 14:16, Csányi Pál wrote: On Sun, Aug 26, 2018 at 07:45:33AM -0400, Brian Curley wrote: You don't list your trigger definition if there's anything that

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Clemens Ladisch
Csányi Pál wrote: > CREATE TRIGGER YearsRemainingMonthsDays AFTER UPDATE OF EndDate ON > MyLengthOfService BEGIN UPDATE MyLengthOfService SET Years = ( with ... says: | The WITH clause cannot be used within a CREATE TRIGGER. Regards, Clemens

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Csányi Pál
On Sun, Aug 26, 2018 at 07:45:33AM -0400, Brian Curley wrote: > You don't list your trigger definition if there's anything that might need > troubleshooting, but I will say that I've recently stopped using > SQLiteStudio for its somewhat erratic behavior. I attached to my previous mail the whole

Re: [sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Brian Curley
You don't list your trigger definition if there's anything that might need troubleshooting, but I will say that I've recently stopped using SQLiteStudio for its somewhat erratic behavior. While it's got a great regex implementation (which doesn't port to running in pure CLI-based scripts) and a

Re: [sqlite] Time Precision

2018-08-26 Thread Keith Medcalf
Are you running Windows or Unix? I am sending this to you as I was just looking into this again and although SQLite maintains time internally with a millisecond precision, the API used on Windows to read the time is limited by the Clock Resolution (usually about 16.5 ms). If you are using

[sqlite] Why trigger (UPDATE) does not work?

2018-08-26 Thread Csányi Pál
Hi, I have a small database with schema attached in this mail. I have two triggers to update fields after an update occures. When I run the SQL code in sqlite3 CLI, or in SqliteStudio's SQL Editor, it output is that I expect. It gives the numbers of months and days so far: SELECT