From: królewna on
W dniu 18.03.2010 15:49, DreiJane pisze:

> Principally sqlite connections (sqlite3 objects in the C-API) can be
> used over multiple threads - and connections to :memory: make no
> difference. There are additional parameters to open() giving fine-
> tuned control. And apsw is promising a true reflection of sqlite's C-
> API.

It's my fault not saying what am I using to connect to sqlite db. It's
sqlite3 module. So there is no open() function etc. As for now I'm not
interested in rewriting my program to use apsw so is there any possible
way of working this out with sqlite3?

--
best regards
princess

From: królewna on
W dniu 18.03.2010 23:06, Aahz pisze:
>
> You probably need to serialize access to the database through one thread.

sqlite3 objects are not pickable so it's not proper way.

--
best regards
princess

From: królewna on
W dniu 19.03.2010 08:20, Expo pisze:
>
> You can put the SQLite database into a Singleton class and use a
> semaphore to serialize the access to methods which writes to the
> database.

I've tried this out but doesnt work. Still gives an error like:

ProgrammingError: SQLite objects created in a thread can only be used in
that same thread.The object was created in thread id -1216280896 and
this is thread id -1217107088

--
best regards
princess

From: Tim Golden on
On 19/03/2010 10:56, kr�lewna wrote:
> W dniu 18.03.2010 23:06, Aahz pisze:
>>
>> You probably need to serialize access to the database through one thread.
>
> sqlite3 objects are not pickable so it's not proper way.

Is it possible you've misunderstood the meaning of the word "serialize"
here? What's being suggested isn't serialising (ie marshalling, pickling)
the data; rather, serialising the *access*, ie pushing all db requests into
a queue which is read by one thread which manages the only db connection.

TJG
From: królewna on
W dniu 19.03.2010 12:10, Tim Golden pisze:
> Is it possible you've misunderstood the meaning of the word "serialize"
> here?
It's not possible, it just happened :)

> What's being suggested isn't serialising (ie marshalling, pickling)
> the data; rather, serialising the *access*, ie pushing all db requests into
> a queue which is read by one thread which manages the only db connection.

That would make structure of program much more complicated. I would have
to create queue for putting there queries and some other extra
variables/structure to receive output from db and some more for
controlling the execution flow of awaiting threads.
--
best regards
princess