Page 1 of 1

Poco::Data::Session

Posted: 19 Dec 2012, 05:16
by dr0zaxx
Hello,

Is calling the close() necessary after a Session?

Will there be multiple Session if i keep calling

Code: Select all

Poco::Data::Session session("SQLite", "sample.db");


over and over again or will it act as a singleton and only use the first Session that was created?

Thanks.

Re: Poco::Data::Session

Posted: 19 Dec 2012, 09:05
by alex
There will be multiple sessions to the same db. See SQlite::Connector

Re: Poco::Data::Session

Posted: 19 Dec 2012, 11:51
by dr0zaxx
@Alex

Thank you for your reply.

I am trying to utilize Poco::Data:SesssionPool

May I know if SQLite is supported?

Re: Poco::Data::Session

Posted: 19 Dec 2012, 15:31
by alex
dr0zaxx wrote:I am trying to utilize Poco::Data:SesssionPool

May I know if SQLite is supported?

Theoretically, yes. But SessionPool does not do any checking in regards to simultaneous DB access, so what will happen there depends on how you are accessing it. SQLite DB is a single file, thus different from a typical DBMS server handling simultaneous access from many sessions. You could devise your own locking scheme inside the DB to deal with that.

Re: Poco::Data::Session

Posted: 22 Dec 2012, 00:04
by alex
alex wrote:SQLite DB is a single file, thus different from a typical DBMS server handling simultaneous access from many sessions. You could devise your own locking scheme inside the DB to deal with that.

I have to correct this. I thought we were compiling SQLite by default in multi-threaded mode. It is actually compiled in serialized mode and it should be safe to access it from different threads. See Poco::Data::SQLite Makefile and SQLite And Multiple Threads document for details.