Thank you. Dont worry readers.... Im not trying anything "007" Rather, I have variety of separate utilities that insert/update/ delete records across several database and hoped to use triggers to log changes to a single place.
By embeding the attach statement as part of the trigger (i.e becomes part of the database specification) so as each utility/program does not remember to attach the log database before it starts updating data i.e the trigger commands are fully self contained.... less likely to cause issues if it is executed and the log database has not already been attached (i.e the updating program 'forgot'. thanks for the help btw! On Mar 15, 2010, at 10:04 AM, Pavel Ivanov wrote: >> How can I embed the 'attach" command within the trigger statement so >> that the log database is attached if it is not already available? > > AFAIK, this is impossible. > > But why do you need that? If you write your own application you can > always attach this database at the beginning. But if you want to spy > after some third-party application I believe SQLite is not suitable > for this kind of tasks... > > > Pavel > > On Sun, Mar 14, 2010 at 10:50 PM, andy <andrew.g.b...@gmail.com> > wrote: >> Hello >> I am hoping someone can help with the following problem. >> >> - I want to create a log of all changes to tables in a database. >> - I would like to keep the log table in a separate database to the >> main data files >> - I plan to use triggers to capture changes and insert them into the >> log table. >> >> Question: >> How can I embed the 'attach" command within the trigger statement so >> that the log database is attached if it is not already available? >> >> i.e something like >> >> create trigger insert_data after insert on data >> begin >> if database logdb does not exist >> attach logdb.db as logdb; >> >> insert into logdb.log values(.....) >> end; >> >> >> I am also a little concerned about performance so I am not sure if >> testing for the presence of the database for every change will add to >> much overhead. Thoughts? >> Thanks >> >> _______________________________________________ >> sqlite-users mailing list >> sqlite-users@sqlite.org >> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >> > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users