Re: [sqlite] Trigger help needed

2011-06-01 Thread Jim Mellander
Thanks - and with a little reading of the manpages, understandable too Appreciate it. On Wed, Jun 1, 2011 at 2:34 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > On 6/1/2011 5:23 PM, Jim Mellander wrote: >> I appreciate the help - I'm new at using triggers.  What I want t

Re: [sqlite] Trigger help needed

2011-06-01 Thread Jim Mellander
in advance On Wed, Jun 1, 2011 at 1:22 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > On 6/1/2011 3:31 PM, Jim Mellander wrote: >> CREATE TABLE ip_timestamps (ip text unique, timestamp date); >> CREATE UNIQUE INDEX ip_index on ip_timestamps (ip ASC); >> CREATE TRI

[sqlite] Trigger help needed

2011-06-01 Thread Jim Mellander
Hopefully someone can help me with this I have a table with IP addresses and timestamps - I want to update the table when the new timestamp is later than the old one $ sqlite3 test.db SQLite version 3.7.4 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .schema

[sqlite] update a record just using a trigger

2010-10-01 Thread Jim Mellander
I appreciate the prompt response to my prior question about triggers, and have another one. I'm using a python program to query an SQLite database from realtime data (IDS data actually). Every time I get a hit in the database, I want to record in that record an updated hitcount, and the

Re: [sqlite] Trigger conditionally causing delete

2010-10-01 Thread Jim Mellander
WHERE key = OLD.key)' is fulfilled ? Once I grok SQL, I'm sure this will all seem like old hat, but I would appreciate any further clarifications. Thanks in advance. On Fri, Oct 1, 2010 at 3:30 PM, Jim Mellander <jmellan...@lbl.gov> wrote: > Thanks, this is great - I'll read up on e

Re: [sqlite] Trigger conditionally causing delete

2010-10-01 Thread Jim Mellander
Thanks, this is great - I'll read up on expression syntax and usage. On Fri, Oct 1, 2010 at 3:11 PM, Drake Wilson <dr...@begriffli.ch> wrote: > Quoth Jim Mellander <jmellan...@lbl.gov>, on 2010-10-01 14:38:03 -0700: >> Hi: >> >> I want to use to trigg

Re: [sqlite] Trigger conditionally causing delete

2010-10-01 Thread Jim Mellander
there, and attempt delete of the summary record with an AFTER trigger, which will not occur if the foreign key constraint is set correctly. Would this be an accurate understanding? On Fri, Oct 1, 2010 at 2:38 PM, Jim Mellander <jmellan...@lbl.gov> wrote: > Hi: > > I want to use to trig

[sqlite] Trigger conditionally causing delete

2010-10-01 Thread Jim Mellander
Hi: I want to use to trigger on deletion of a detail record to automatically delete a summary record, if not more detail records exist, something like: CREATE TRIGGER detail_delete AFTER DELETE ON detail BEGIN -- here I don't know syntax IF COUNT(detail records with key) = 0