Re: [sqlite] BEFORE INSERT TRIGGER

2010-06-10 Thread Tareq Khan
2010 13:34 To: General Discussion of SQLite Database Subject: Re: [sqlite] BEFORE INSERT TRIGGER > Like I said, I don't see anything wrong with it, and in fact it works for me. I suspect the problem lies elsewhere, in a statement you didn't show. One that actually contains a double quote i

Re: [sqlite] BEFORE INSERT TRIGGER

2010-06-10 Thread Pavel Ivanov
> Like I said, I don't see anything wrong with it, and in fact it works for me. > I suspect the problem lies elsewhere, in a statement you didn't show. One > that actually contains a double quote in it, perhaps? In fact it's not double quote, it should be extra endline character I think.

Re: [sqlite] BEFORE INSERT TRIGGER

2010-06-10 Thread Igor Tandetnik
Tareq Khan wrote: > Thanks for the reply. Yes I am aware of that... I have just updated to the > latest version. However I would be grateful if someone could tell me what > was wrong with the trigger I was trying to create. Like I said, I don't see anything wrong with it,

Re: [sqlite] BEFORE INSERT TRIGGER

2010-06-10 Thread Tareq Khan
- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik Sent: 10 June 2010 13:13 To: sqlite-users@sqlite.org Subject: Re: [sqlite] BEFORE INSERT TRIGGER Tareq Khan <tk...@quantinity.com> wrote: > I have looked through the list with rega

Re: [sqlite] BEFORE INSERT TRIGGER

2010-06-10 Thread Igor Tandetnik
Tareq Khan wrote: > I have looked through the list with regards to my issue and there are > several entries that say that the following is correct for a BEFORE INSERT > trigger: > > > > CREATE TRIGGER AlbumSectionInsertTrigger > BEFORE INSERT > ON AlbumSection > FOR

[sqlite] BEFORE INSERT TRIGGER

2010-06-10 Thread Tareq Khan
Hi I have looked through the list with regards to my issue and there are several entries that say that the following is correct for a BEFORE INSERT trigger: CREATE TRIGGER AlbumSectionInsertTrigger BEFORE INSERT ON AlbumSection FOR EACH ROW BEGIN SELECT CASE WHEN

[sqlite] Question: Insert trigger to make an insert conditional

2005-10-14 Thread Jay Godse
Hi. I would like to put an insert trigger on a table A before the insert where the insert only happens if the values in the new row meet certain conditions. I can achieve the same result by having the trigger run after the insert on Table A and delete the newly inserted row if the row does not

Re: [sqlite] ON INSERT trigger

2004-10-12 Thread D. Richard Hipp
Alex wrote: Yes, what about firing the DELETE trigger? During REPLACE a row is deleted, isn't it? That's the way REPLACE works, yes. So one could reasonably argue for a DELETE trigger to fire on a REPLACE. -- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565

Re: [sqlite] ON INSERT trigger

2004-10-12 Thread Alex
> >I do not consider this a bug. INSERT OR REPLACE is not an UPDATE so > >an UPDATE trigger should not fire on an INSERT OR REPLACE. So don't > >be looking for me to change it anytime soon. > > > > I was thinking more along the lines of a DELETE. That would be an accurate > semantic, would it

Re: [sqlite] ON INSERT trigger

2004-10-12 Thread D. Richard Hipp
Christian Smith wrote: I was thinking more along the lines of a DELETE. That would be an accurate semantic, would it not? Yes. -- D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565

Re: [sqlite] ON INSERT trigger

2004-10-12 Thread Christian Smith
On Tue, 12 Oct 2004, D. Richard Hipp wrote: >Christian Smith wrote: >> >> If this issue is critical to your project, you should perhaps contract >> Richard to do the changes, as I can't give any guarantees on ever getting >> round to implementing this. I'm still in the code familiarisation phase.

Re: [sqlite] ON INSERT trigger

2004-10-12 Thread D. Richard Hipp
Christian Smith wrote: If this issue is critical to your project, you should perhaps contract Richard to do the changes, as I can't give any guarantees on ever getting round to implementing this. I'm still in the code familiarisation phase. I do not consider this a bug. INSERT OR REPLACE is not

Re: [sqlite] ON INSERT trigger

2004-10-12 Thread Christian Smith
On Tue, 12 Oct 2004, Alex wrote: >Hi > >> Existing ticket #368 may cover this behaviour. I guess Ron is the user who >> added the latest remark: >> http://www.sqlite.org/cvstrac/tktview?tn=368 >> >> If I have time at the weekend, I might have a bash at producing a patch >> that will implement

Re: [sqlite] ON INSERT trigger

2004-10-12 Thread Alex
Hi > Existing ticket #368 may cover this behaviour. I guess Ron is the user who > added the latest remark: > http://www.sqlite.org/cvstrac/tktview?tn=368 > > If I have time at the weekend, I might have a bash at producing a patch > that will implement what is required. No promises, mind. > > What

Re: [sqlite] ON INSERT trigger

2004-09-24 Thread Christian Smith
On Thu, 23 Sep 2004, Alex wrote: >> If I have time at the weekend, I might have a bash at producing a patch >> that will implement what is required. No promises, mind. >> >> What would be preferred? Convert the trigger to an update trigger, or fire >> a delete trigger followed by an insert

Re: [sqlite] ON INSERT trigger

2004-09-23 Thread Alex
> If I have time at the weekend, I might have a bash at producing a patch > that will implement what is required. No promises, mind. > > What would be preferred? Convert the trigger to an update trigger, or fire > a delete trigger followed by an insert trigger? > > I'd prefer the former (update)

Re: [sqlite] ON INSERT trigger

2004-09-22 Thread Christian Smith
On Tue, 21 Sep 2004, Alex wrote: >> But I think the gist of you email is that you'd prefer the "INSERT OR >> REPLACE" to be handled like an update. I can't see a reason why an OLD >> record could be created for replace inserts. The problem then becomes how >> do you know in the trigger whether

Re: [sqlite] ON INSERT trigger

2004-09-21 Thread Alex
> But I think the gist of you email is that you'd prefer the "INSERT OR > REPLACE" to be handled like an update. I can't see a reason why an OLD > record could be created for replace inserts. The problem then becomes how > do you know in the trigger whether OLD is valid? If the insert is a >

Re: [sqlite] ON INSERT trigger

2004-09-21 Thread Kurt Welgehausen
> CREATE TABLE table (ID text UNIQUE, Name text, Surname text, SecDbKey text) > INSERT INTO table VALUES ('001', 'John', 'Smith', 'A0B1C2D3') > INSERT OR REPLACE INTO table VALUES ('001', 'Jane', 'Parker', 'E4F51234') I'm not sure exactly what relationship you're trying to maintain between this

Re: [sqlite] ON INSERT trigger

2004-09-21 Thread Ron Aaron
On Tue, September 21, 2004 11:26, Christian Smith said: > On Tue, 21 Sep 2004, Alex wrote: > > In which case it might be better to convert the replace insert into an > update, and use the update trigger which is guaranteed to have valid OLD > and NEW. > > But that is not my decision to make.

Re: [sqlite] ON INSERT trigger

2004-09-21 Thread Christian Smith
On Tue, 21 Sep 2004, Alex wrote: >Hi, Christian > >Thanks for your response. The situation, however, is more complicated. >Please, consider an example in SQL: > >CREATE TABLE table (ID text UNIQUE, Name text, Surname text, SecDbKey text) > >INSERT INTO table VALUES ('001', 'John', 'Smith',

Re: [sqlite] ON INSERT trigger

2004-09-21 Thread Derrell . Lipman
"Alex" <[EMAIL PROTECTED]> writes: > CREATE TABLE table (ID text UNIQUE, Name text, Surname text, SecDbKey text) > > INSERT INTO table VALUES ('001', 'John', 'Smith', 'A0B1C2D3') > > INSERT OR REPLACE INTO table VALUES ('001', 'Jane', 'Parker', 'E4F51234') > > In the given example the "UNIQUE"

Re: [sqlite] ON INSERT trigger

2004-09-21 Thread Alex
Hi, Christian Thanks for your response. The situation, however, is more complicated. Please, consider an example in SQL: CREATE TABLE table (ID text UNIQUE, Name text, Surname text, SecDbKey text) INSERT INTO table VALUES ('001', 'John', 'Smith', 'A0B1C2D3') INSERT OR REPLACE INTO table VALUES

[sqlite] ON INSERT trigger

2004-09-19 Thread Alex
Hi, In my project I have two databases: primary which is an SQLite db, and secondary which is based on a different engine. A table in the primary db contains values which are keys for the secondary db. To maintain coherence of the two databases I use SQLite triggers. The DELETE and UPDATE