I'd suggest you to use any kind of memory structure (like deque or
whatever you prefer) for transferring data from one thread to another.
Besides anything else it will be faster than using SQLite for this
particular task.

As you have already understood there's no way you can make 2
connections to one in-memory database. Although you can use one
connection from both thread so that threads will naturally block each
other while they're doing their piece of job.


Pavel

On Tue, Mar 23, 2010 at 1:55 PM, Jakub Ladman <ladm...@volny.cz> wrote:
> Hello to all
>
> I am back here to mailing list after about two years and also back to
> programming with sqlite in general.
>
> I have new task and i do not know how to do it.
>
> I need an application consisting two threads.
> In one of them i need to store incomming "messages" (one message is 1 to 8
> bytes of data) to temporary table existing only in memory.
> It needs to be fast, storing hundreds of messages per second.
> There i have a trigger deleting old rows and creating some sort of circular
> buffer.
> In separate thread there should be done some selects (read only) on this table
> sorting the informations and storing them into separate table(s) located on
> disk (jffs2 filesystem).
>
> I do not know how to do two connections to memory stored table(fast, and not
> wasting the flash memory writes).
> The database opened as :memory: is separate for every thread, same as
> temporary table with pragma temp_store = MEMORY.
>
> Do you have any clue?
> Is it completely stupid way?
>
> Thank You
>
> Jakub Ladman
> _______________________________________________
> 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