> On 23 Dec 2014, at 3:26pm, Tony Papadimitriou <to...@acm.org> wrote: > > CREATE PROC sample AS ( > SELECT table1.* FROM table1,...,tableN > WHERE ... possibly complicated join ... > AND last_name like :1 > ORDER BY :2; > ); > > @sample 'Smith%',tax_id > > would become: > > SELECT table1.* FROM table1,...,tableN > WHERE ... possibly complicated join ... > AND last_name like 'Smith%' > ORDER BY last_name,tax_id; > > (If you don't like CREATE PROC, make it CREATE SCRIPT or something else, > although I think PROC is good enough as it allows for possible future > expansion with more capabilities -- wish lists for 2016 and beyond.)
Instead of creating a new structure, have procedures stored in a table and use an EXECUTE command with the same syntax as a SELECT to execute them: EXECUTE command FROM script1 ORDER BY rowid; or EXECUTE command FROM scripttable WHERE script='monthlymaintenance' ORDER BY rowid; That was you can have your own code create and maintain scripts inside a database. The rules would require the entire script to be retrieved before the first line of the script is run to avoid problems with scripts which modify themselves. Not sure how parameters should be handled. The other way would, as someone else commented, be to incorporate stored Lua procedures. Lua would be an excellent language to use for this. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users