"Lothar Behrens"
<[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> I have s question about avoiding locked database errors by closing a
> connection in these circumstances.

Opening a connection doesn't acquire any locks, and closing doesn't 
release any. Starting and finishing transactions is what acquires and 
releases locks. Your problem must lie elsewhere.

> Is it possible, that there are some open connections around, opened
> with
>
>   char* databaseNameBuffer = "mydb";
>   int nReturn = sqlite3_open(databaseNameBuffer, &m_pDatabase1);
>   nReturn = sqlite3_open(databaseNameBuffer, &m_pDatabase2);
>
> Doing some reading on m_pDatabase1
> Doing some changing on m_pDatabase2

How exactly are you doing this "reading and changing"? Do you reset or 
finalize all statement handles you've prepared? Do you commit or roll 
back all transactions you've started?

> to change other data while m_pDatabase2 has locked the database

I don't see how you are going to "change other data" while the database 
is locked. The point of locking the database is precisely so that you 
_can't_ change it on another connection.

> Or will m_pDatabase2 be invalid after  m_pDatabase1 has been closed ?

Definitely not.

> I have trouble with closing the database and still locking problems.
> How could I see, if I have such dangling open
> database handle m_pDatabase2 ?

You are barking up the wrong tree. Watch for unfinalized statement 
handles instead.

Igor Tandetnik 



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

Reply via email to