Re: [sqlite] load extension -- unload hook?

2009-09-02 Thread sub sk79
Sure! Here are the results: Good: The 'destructor' function attribute works just as advertised. I have included below the modified half.so example code from sqlite website with the 'constructor' and 'destructor' functions (for linux using gcc). Bad: The '.q' command on

Re: [sqlite] load extension -- unload hook?

2009-09-01 Thread Kees Nuyt
On Mon, 31 Aug 2009 19:48:48 -0400, sub sk79 subs...@gmail.com wrote: Here is the new info I got from your replies: 1. sqlite_load_extension is per-db-connection - Oddly I did not see any explicit reference to this in either of the two places I looked for it: i)

Re: [sqlite] load extension -- unload hook?

2009-09-01 Thread Jean-Christophe Deschamps
Hi, ´¯¯¯ 2. Following up on windows dllmain info - which was very useful in itself - but since we use both windows and linux, I checked the equivalent for linux as well and yes, luckily, gcc allows you to define a 'function attribute' called 'constructor' and 'destructor' which can be used to

Re: [sqlite] load extension -- unload hook?

2009-08-31 Thread Jean-Christophe Deschamps
At 18:25 30/08/2009, you wrote: ´¯¯¯ When we load an extension it invokes sqlite3_extension_init(). Lets say, in addition to creating functions, the loaded extension library also does some internal data structure allocations, initializations etc here. Now, when the database is closed the

Re: [sqlite] load extension -- unload hook?

2009-08-31 Thread sub sk79
Firstly thanks to both of you for useful replies. Here is the new info I got from your replies: 1. sqlite_load_extension is per-db-connection - Oddly I did not see any explicit reference to this in either of the two places I looked for it: i)

[sqlite] load extension -- unload hook?

2009-08-30 Thread sub sk79
Hi, When we load an extension it invokes sqlite3_extension_init(). Lets say, in addition to creating functions, the loaded extension library also does some internal data structure allocations, initializations etc here. Now, when the database is closed the loaded extension needs to do cleanup.

Re: [sqlite] load extension -- unload hook?

2009-08-30 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 sub sk79 wrote: 1. Is it possible to register a callback which is invoked on database close? There is a hacky way of finding out when a particular db is closed. Register a collation with an unused name (eg _AX1) and provide an xDestroy callback.