If you have sqlite3.c in your project you can just add your own hook.


Take a look at  sqlite3TwoPartName if you want to see if before it's created.



Or look at sqlite3StartTable (end of the function) if you want to know after 
it's created.



That will catch a VIEW creation too.





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
From: [email protected] [[email protected]] on 
behalf of Vivien Malerba [[email protected]]
Sent: Tuesday, June 26, 2012 7:33 AM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Detecting when a table is created

On 26 June 2012 14:21, Igor Tandetnik <[email protected]> wrote:

> Vivien Malerba <[email protected]> wrote:
> > Is there any possibility to be notified when a table is created (when a
> > "CREATE TABLE XXX" is executed)?
>
> How is it executed? Isn't it your program that executes the statement? How
> come you don't know when that happens?
>

The code is some SQL entered by the user, I have no control over it. There
is effectively the possibility to parse the SQL entered, detect the CREATE
table statement and act accordingly, but I would like to see if SQLite has
some kind of builtin feature I could use first.

Also, for example if the user executes a query as "CREATE TABLE xxx AS
SELECT ..." then it's much more difficult to know how to define the XXX
table as I would have to parse the SELECT query part as well. It's doable
of course but can become a bit complicated.

Regards,

Vivien
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to