Hi, Dušan

On Thu, Jul 25, 2013 at 2:39 PM, Dušan Paulovič <paulo...@gisoft.cz> wrote:

> Hello, is there a way to somehow set a connection life-time object?
> ...
>
>
> It would be fine to have something like:
> int sqlite3_set_lifetime_object(
>   sqlite3 *db,              /*db connection*/
>   const char *zObjectName,  /*utf8 name of object*/
>   void *pObject,            /*if NULL, object is removed*/
>   void(*xDestroy)(void*)    /*destructor*/
> );
>
> void * sqlite3_get_lifetime_object(
>   sqlite3 *db,              /*db connection*/
>   const char *zObjectName   /*utf8 name of object*/
> );
>



How about temporary memory table just for the task of storing your objects.

You initialization code for particular connection
  Attach ':memory:' as MyObjectStorage
  Create table MyObjectStorage.[objects] (Name Text, Ptr Text)

Your code for inserting an object
  Insert into MyObjectStorage.[objects] (Name, Ptr) VALUES ('obj1',
'0x12345678')

This code will query the pointer
  select Ptr from MyObjectStorage.[objects] where Name='obj1'

The only convention rule here will be the name of the attached db so no
other databases (or instances of the same storage) should use this name.

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

Reply via email to