I would like to use SQLite to do something a little crazy: basically, on insert / update to a table, I would like a trigger to effectively, insert or update a virtual table, and create some sort of large artifact. Like, a PDF report, send off an email, etc., using the contents of the record post insert / update. I can't, for the life of me, figure out how you would use any amount of SQL from within a virtual table function. It doesn't look like you get a `sqlite3` context to query over willy-nilly, and I can't quite find any examples of virtual table functions that demonstrate reading / writing to existing tables.
I'm hoping this is actually quite a trivial thing, and I just can't seem to find it in the docs somewhere. It kind of looks like [this](https://fossil-scm.org/home/file/src/foci.c) might be close, but I can't really tell.