> 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