Dear Tom,

There is a pragma that allows you retrieving the structure of a table :
PRAGMA table_info(table_name);

From the result of the command, you can programmatically create your
triggers.

Regards,

Brice

2017-07-15 21:11 GMT+02:00 Thomas Flemming <t...@qvgps.com>:

> Hi Sqlite-users,
>
> I'm busy doing a undo-redo with triggers as described here:
> https://sqlite.org/undoredo.html
>
> and wondering, if there is a function to build the string for the
> insert-command automatically with all fields from that table.
>
> In the sample its only 3 fields, but in real life, this is much more so
> this could safe a lot of typing.
>
> CREATE TEMP TRIGGER ex1_dt BEFORE DELETE ON ex1 BEGIN
>   INSERT INTO undolog VALUES(NULL,'INSERT INTO ex1(rowid,a,b,c)
>     VALUES('||old.rowid||','||quote(old.a)||','||quote(old.b)||
>            ','||quote(old.c)||')');
>
> Thanks,
> Tom
>
>
>
> --
> /****************************************
> **   Flemming Software Development CC
> **   Thomas Flemming
> **   PO Box 81244
> **   Windhoek, Namibia
> **   http://www.quovadis-gps.com
> **   mail  t...@qvgps.com
> **   +264 (0)81 3329923
> **   +49 (0)6182 8492599
> ***************************************/
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to