It's this comment that makes me worry that xDisconnect can be called at other times than detach or close:

** When an in-memory Table object is deleted (for example when the
** schema is being reloaded for some reason), the VTable objects are not
** deleted and the sqlite3_vtab* handles are not xDisconnect()ed
** immediately. Instead, they are moved from the Table.pVTable list to
** another linked list headed by the sqlite3.pDisconnect member of the
** corresponding sqlite3 structure. They are then deleted/xDisconnected
** next time a statement is prepared using said sqlite3*. This is done
** to avoid deadlock issues involving multiple sqlite3.mutex mutexes.

I'm not sure exactly what this means, but it implies that xDisconnect can be called in the middle of a session.

Peter

On 1/2/2015 3:00 PM, Peter Aronson wrote:
If only the xDisconnect method is called on a virtual table create in the temp database 
at disconnect time, is that the only time xDisconnect will be called?  The documentation 
at sqlite.org doesn't seem to say.  Jay Krebich's Using SQLite says xDisconnect is 
"Called when a database containing a virtual table instance is detached or closed.  
Called once for each table instance."  But looking at the SQLite code and comments, 
I'm not sure this is true.  Is it?  If so, it would be easy enough when writing a Virtual 
Table Module to note that it is being created in the temp database, and do any required 
cleanup in xDisconnect instead of xDestroy for that instance.  But if xDisconnect can be 
called at other times, cleanup could be premature.

Best,

Peter


On Friday, January 2, 2015 12:56 AM, Dan Kennedy <danielk1...@gmail.com> wrote:

On 01/02/2015 01:58 PM, Hick Gunter wrote:
Temporary virtual tables sounds like an interesting concept. Does the 
xDestroy() function get called on such a beast (as opposed to xDisconnect() 
when the connection is closed)?
Just xDisconnect().

Dan.



   Should that function delete the backing store (even if a non-temporary 
virtual table is still connected)?

-----Ursprüngliche Nachricht-----
Von: Baruch Burstein [mailto:bmburst...@gmail.com]
Gesendet: Donnerstag, 01. Jänner 2015 08:38
An: General Discussion of SQLite Database
Betreff: [sqlite] Suggestion for syntax enhancement for virtual tables

For creating temporary virtual tables, currently you need to do:

CREATE VIRTUAL TABLE temp.t ...

Can this syntax be made to work too (similar to creating regular tables)?

CREATE VIRTUAL TEMP TABLE t ...
or
CREATE TEMP VIRTUAL TABLE t ...

--
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı 
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to