Vritual Tables Performing SQL Queries
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 might be close, but I can't really tell.
See (https://github.com/0x09/sqlite-statement-vtab/blob/master/statement_vtab.c) from [this post](https://github.com/0x09/sqlite-statement-vtab/blob/master/statement_vtab.c)
Another classic one would be a Pivot VTab, like this one