On 26 June 2012 14:55, Simon Slavin <[email protected]> wrote:

>
> On 26 Jun 2012, at 1:33pm, Vivien Malerba <[email protected]> wrote:
>
> > 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.
>
> Could you poll 'PRAGMA schema_version' ?
>
> <http://www.sqlite.org/pragma.html#pragma_schema_version>
>
> It changes when something creates or drops a table or index.  Of course,
> it won't tell you the actual CREATE command.  For that you could look at
> the table called "sqlite_master".
>

I need a notification _before_ the command is executed, so this won't do.


>
> > 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.
>
> I think this will be your problem.  Even if you could set up notifications
> for changes, trying to convert what they did to what you want to do instead
> looks complicated.


Still, it seems it's the easiest way to go (as a matter of fact this is
already partially done for the soft I work on which is Libgda).

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

Reply via email to