Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-25 Thread Igor Tandetnik
Pavel Ivanov wrote: > Could you explain why this scenario doesn't cause infinite call cycle > of the trigger by itself? Is there some protection in SQLite which > breaks such cycles? SQLite doesn't support recursive triggers: a trigger cannot call itself, directly or indirectly. SQLite keeps

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread Dennis Cote
Oliver Peters wrote: > > I want the "normal" user only identify himself by putting his id into > the field identity and afterwards let the system decide in what field to > put his id (INSERT = creator, UPDATE = editor). Doing this for every > record I can show who created it and who was the last

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread João Eiras
On , Pavel Ivanov wrote: > Hi, Richard! > > Could you explain why this scenario doesn't cause infinite call cycle > of the trigger by itself? Is there some protection in SQLite which > breaks such cycles? > Many dbms forbid recursive trigger calls that modify a table that

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread Oliver Peters
Am Montag, den 22.06.2009, 17:39 -0600 schrieb Dennis Cote: > Oliver Peters wrote: > > sorry: my code wasn't completely what I wanted so here again: > > > > CREATE TRIGGER IF NOT EXISTS test > > BEFORE INSERT ON "a" > > BEGIN > > INSERT INTO

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread Dennis Cote
Oliver Peters wrote: > sorry: my code wasn't completely what I wanted so here again: > > CREATE TRIGGER IF NOT EXISTS test > BEFORE INSERT ON "a" > BEGIN > INSERT INTO a(code,name,creator) > VALUES(new."code",new."name",new."identity"); >

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread Pavel Ivanov
Hi, Richard! Could you explain why this scenario doesn't cause infinite call cycle of the trigger by itself? Is there some protection in SQLite which breaks such cycles? Pavel On Mon, Jun 22, 2009 at 4:10 PM, D. Richard Hipp wrote: > > On Jun 22, 2009, at 3:33 PM, Oliver Peters

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread D. Richard Hipp
On Jun 22, 2009, at 3:33 PM, Oliver Peters wrote: > Hello out there, > > > to my mind I get false entries in sqlite_sequence using this code: > > > CREATE TABLE IF NOT EXISTS a( > id INTEGER PRIMARY KEY AUTOINCREMENT, > code

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread Oliver Peters
[...] > > The ROWID is not generated until the INSERT statement actually runs. > Hence the BEFORE trigger does not have access to it and the BEFORE > trigger sees a NULL. Change the trigger to an AFTER trigger and it > will work. > [...] > > D. Richard Hipp > d...@hwaci.com Thanks for

Re: [sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread D. Richard Hipp
On Jun 22, 2009, at 3:33 PM, Oliver Peters wrote: > Hello out there, > > > to my mind I get false entries in sqlite_sequence using this code: > > > CREATE TABLE IF NOT EXISTS a( > id INTEGER PRIMARY KEY AUTOINCREMENT, > code

[sqlite] integer primary key autoincrement & sqlite_sequence

2009-06-22 Thread Oliver Peters
Hello out there, to my mind I get false entries in sqlite_sequence using this code: CREATE TABLE IF NOT EXISTS a( id INTEGER PRIMARY KEY AUTOINCREMENT, codeVARCHAR NOT NULL, name