Hi,

i just wondered if there is an API to detect if a sqlite database file
is already opened by another process.

I can make the assumptions that:

1. WAL mode is in use
2. Linux and Windows only
3. No network filesystems
4. I only care if the access is done by another SQLite library,
   not simple open() calls.

I didn't see any explicit API to check for this, but assumed there might
be some way to find out via the .shm files?

Usecase is a server process that keeps an SQLite DB open while it is
running and a commandline tool that manipulates the same DB file for
maintenance tasks. The maintenance tool should not change the DB if the
server is running.

I could of course do explicit locking via other means to mediate access
(actually i do that now, but it is not really elegant), but if there is
an SQLite API way to do it, it would be nicer.

Any good hints?

Michael

-- 
Michael Schlenker
Senior Software Engineer

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Stra?e 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
E-Mail: michael.schlenker at contact-software.com
http://www.contact-software.com/

Registered office: Bremen, Germany
Managing directors: Karl Heinz Zachries, Ralf Holtgrefe
Court of register: Amtsgericht Bremen HRB 1321

-- 
Michael Schlenker
Senior Software Engineer

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Stra?e 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
E-Mail: michael.schlenker at contact-software.com
http://www.contact-software.com/

Registered office: Bremen, Germany
Managing directors: Karl Heinz Zachries, Ralf Holtgrefe
Court of register: Amtsgericht Bremen HRB 1321

Reply via email to