Re: [sqlite] how to check whether the database file opend or closed?

2008-08-22 Thread Mihai Limbasan

kriscbe wrote:

thanks for eplay mihai

i am asking is there any function to check the database is opened or not
opened? in a single thread?

thanks 
kris
  

No, there is no such function because
- you already know whether it's opened or not because you must store 
the database connection handle obtained from the sqlite3_open* family of 
functions - for example, initialize that variable to NULL before opening 
the connection and after closing it, so your question becomes a simple 
check against NULL on that variable
- it makes no sense to have such a function - the database connection 
handle "belongs" to your application, not to the SQLite engine (that's 
why you have to pass the handle as the first parameter to almost every 
SQLite function)


If you're asking whether there is a function to check whether the *file* 
which hosts the database structure and data is open or not, that depends 
on the operating system you are using, and the answer should be 
available in the operating system API documentation.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to check whether the database file opend or closed?

2008-08-22 Thread kriscbe

thanks for eplay mihai

i am asking is there any function to check the database is opened or not
opened? in a single thread?

thanks 
kris

Mihai Limbasan wrote:
> 
> kriscbe wrote:
>> hi all,
>>
>> once the database file is opened   is some other function how to check
>> the
>> db file is opened or not opened?
>>
>> is there any function like "isopen()" in sqlite???
>>
>> thanks
>> kris
>>
>>   
> No, there is no such function, it's the application's responsibility to 
> track the database connections it has opened.
> I'm reproducing below part of a mail message sent to the list yesterday 
> which might clarify the situation:
> 
>  > Doug Porter wrote:
>  > > Is there a way to get a list of connections that are opened on a
>  > > particular SQLite database file?
>  > >
>  > > Our software uses SQLite to save our data and we want to warn a user
>  > > who opens a file that is already opened by another user. I tried a
>  > > homebrewed approach (keep a table of open connections manually), but
>  > > ran into a couple places where that won't work.
>  > >
>  > > Any help would be greatly appreciated!
>  > >
>  > > doug
> 
> Mihai Limbasan wrote:
>  > The database connection object is handled by the SQLite database 
> engine and stored in memory allocated by the database engine.
>  > SQLite does not use a client-server architecture but is completely 
> contained in a library that you link with your application, thus 
> SQLite's functions run within your application process and the database 
> connection objects exist on a per-process basis.
>  > Your question seems to suggest that your users might run multiple 
> instances of your application, potentially on separate machines. If that 
> holds true, there is no way to get a list of connections from SQLite 
> since those connection objects belong to separate processes potentially 
> on separate machines. You will have to use an IPC mechanism of your 
> choice to handle communication between instances of your app.
> 
> Hope this helps.
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-check-whether-the-database-file-opend-or-closed--tp19101495p19103046.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] how to check whether the database file opend or closed?

2008-08-22 Thread Mihai Limbasan

kriscbe wrote:

hi all,

once the database file is opened   is some other function how to check the
db file is opened or not opened?

is there any function like "isopen()" in sqlite???

thanks
kris

  
No, there is no such function, it's the application's responsibility to 
track the database connections it has opened.
I'm reproducing below part of a mail message sent to the list yesterday 
which might clarify the situation:


> Doug Porter wrote:
> > Is there a way to get a list of connections that are opened on a
> > particular SQLite database file?
> >
> > Our software uses SQLite to save our data and we want to warn a user
> > who opens a file that is already opened by another user. I tried a
> > homebrewed approach (keep a table of open connections manually), but
> > ran into a couple places where that won't work.
> >
> > Any help would be greatly appreciated!
> >
> > doug

Mihai Limbasan wrote:
> The database connection object is handled by the SQLite database 
engine and stored in memory allocated by the database engine.
> SQLite does not use a client-server architecture but is completely 
contained in a library that you link with your application, thus 
SQLite's functions run within your application process and the database 
connection objects exist on a per-process basis.
> Your question seems to suggest that your users might run multiple 
instances of your application, potentially on separate machines. If that 
holds true, there is no way to get a list of connections from SQLite 
since those connection objects belong to separate processes potentially 
on separate machines. You will have to use an IPC mechanism of your 
choice to handle communication between instances of your app.


Hope this helps.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] how to check whether the database file opend or closed?

2008-08-21 Thread kriscbe

hi all,

once the database file is opened   is some other function how to check the
db file is opened or not opened?

is there any function like "isopen()" in sqlite???

thanks
kris

-- 
View this message in context: 
http://www.nabble.com/how-to-check-whether-the-database-file-opend-or-closed--tp19101495p19101495.html
Sent from the SQLite mailing list archive at Nabble.com.

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