I have a favourite general method to write a quine in any programming language. This involves a list of strings and a list of numeric indexes. The second list is used to subscript into the first list, and the found strings are then extracted.
This is possible in sqlite3, but comes out particularly ugly. The reasons for the ugliness is mostly that it's not easy to concatenate a list of strings. The group_concat function doesn't work, because you can't guarantee the order it concatenates the strings. Anyway, I show my solution in the bottom of this mail. Ambrus CREATE TABLE pt(p); INSERT INTO pt VALUES (''''),('),('),('CREATE TABLE pt(p); INSERT INTO pt VALUES ('),('); CREATE TABLE nt(n); INSERT INTO nt VALUES (3),(1),(1),(1),(1),(2),(1),(2),(1),(2),(1),(3),(1),(2), (1),(4),(1),(2),(1),(5),(1),(4),(1),(1),(5); CREATE TABLE rt(r); INSERT INTO rt VALUES ('),('); CREATE TABLE mt(m); CREATE TRIGGER mg AFTER INSERT ON mt BEGIN UPDATE rt SET r = r || new.m; END; INSERT INTO mt SELECT p FROM pt, nt WHERE pt.oid = n; SELECT r FROM rt;'); CREATE TABLE nt(n); INSERT INTO nt VALUES (3),(1),(1),(1),(1),(2),(1),(2),(1),(2),(1),(3),(1),(2), (1),(4),(1),(2),(1),(5),(1),(4),(1),(1),(5); CREATE TABLE rt(r); INSERT INTO rt VALUES (''); CREATE TABLE mt(m); CREATE TRIGGER mg AFTER INSERT ON mt BEGIN UPDATE rt SET r = r || new.m; END; INSERT INTO mt SELECT p FROM pt, nt WHERE pt.oid = n; SELECT r FROM rt; _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users