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

2018-08-26 Thread Keith Medcalf
o:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Clemens Ladisch >Sent: Sunday, 26 August, 2018 06:56 >To: sqlite-users@mailinglists.sqlite.org >Subject: Re: [sqlite] Why trigger (UPDATE) does not work? > >Csányi Pál wrote: >> CREATE TRIGGER YearsRemainingMonthsDays AFTER

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

[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