The sqlite3 struct has a pVtabCtx pointer.  It seems to me that it
will be shared between multiple xCreate in action simultaniously and
in that case cause disaster.  This can happen even if there is no
thread concurrency going on using the same database connection.

My xCreate has to run some queries in order to build its declare
statement.  If a virtual table is queried inside xCreate causing a
another xCreate to be called, the following sqlite3_declare_vtab will
fail because pVtabCtx gets erased.

Is this a design flaw of sqlite or intentionally designed this way for
a good reason?

The only workaround that I can think of is to fork() in xCreate having
the child build the statement for the parent's sqlite3_declare_vtab(),
pass that to the waiting parent and exit.  But in my case the child
would also have to pass a lot of other variable length information
back to the parent, which will involve a lot of IPC mess to implement.

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

Reply via email to