IIRC it is NOT safe to call sqlite3_prepare() or sqlite3_step() withtin the authorizer callback, so schema changes are out of the question, as you would have to prepare/step a "CREATE VIRTUAL TABLE" statement for on-the-fly virtual table creation.
"The authorizer callback must not do anything that will modify the database connection that invoked the authorizer callback. Note that sqlite3_prepare_v2() and sqlite3_step() both modify their database connections for the meaning of "modify" in this paragraph." -----Ursprüngliche Nachricht----- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Dominique Devienne Gesendet: Montag, 19. März 2018 10:45 An: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Betreff: [EXTERNAL] Re: [sqlite] Lazy virtual table creation On Sat, Mar 17, 2018 at 11:42 PM, Marco Bambini <ma...@sqlabs.net> wrote: > with a bit of work you can use the authorize api in order to know when > an access to a non existing table is performed. > https://sqlite.org/c3ref/set_authorizer.html Interesting work-around, if that works. I.e. whether name resolution to table/column happens before or after the authorizer is called. But it brings up the more general question of knowing which APIs are safe to call inside other APIs, notably when doing schema changes for example. In this case for example, we'd typically be inside a prepare statement, and is it OK to change the schema, potentially affecting that very statement we are currently parsing/resolving/compiling? I.e. API re-entrance but outside the context of multi-threading I guess. --DD _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___________________________________________ Gunter Hick | Software Engineer | Scientific Games International GmbH | Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 1 80100 - 0 May be privileged. May be confidential. Please delete if not the addressee. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users