Some additional information.

It appears that setting the journal_mode is not inherited by DBs that are 
attached after the PRAGMA journal_mode is executed.  So, I added one after the 
ATTACH.

It also appears that, as part of the PRAGMA journal_mode execution, the current 
journal file is deleted.  My SQL activity tends to be a lot of "open DB, do 
work, close DB".  That is, I don't open the database and leave it open.  When I 
run multiple transactions, the journal is not deleted between each one.  Am I 
right in assuming that upon opening a database (or the first real command 
thereafter), journals are deleted as a matter of course?

I also have no additional information as to why having PERSIST mode on prevents 
the database from being updated/correct.  I did check the sqlite3_close 
command, and I'm passing it the connection received from sqlite3_open.  It 
returns SQLITE_OK.

I'll check to see if something is being rolled back when that happens.

Marc

-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Monday, December 17, 2012 5:46 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] PERSIST Journal Mode


On 17 Dec 2012, at 8:35pm, "Marc L. Allen" <mlal...@outsitenetworks.com> wrote:

> Another item.. when having Journal Mode = PERSIST, DBA (in the example below) 
> was not being physically updated.  DBB was.

I can think of a reason you might not be able to see an update until you have 
executed _close().  So are you looking to see an update before or after your 
code has executed _close() ?  How are you looking for an update ?  The file's 
modification timestamp ?  Also, are you sure you are executing _close() with 
the right parameter, and can you check the result returned from _close() to 
make sure it returns SQLITE_OK ?

> Simply taking out the PRAGMA fixed things.  Any ideas where I should look?

Clip from your earlier post:

> open(DBA)
> PRAGMA journal_mode = PERSIST;
> ATTACH DBB
> SQL ...
> close()
> 
> If the DBA.journal file exists, it's deleted before the attach (though I 
> haven't identified exactly where.  I can if important.) During the close, the 
> DBA.mjxxxxx is deleted as is the DBB.journal file.
> The DBA.journal file is not deleted until the next time I open it.

One situation I think might cause this is if the database isn't closed 
properly.  When SQLite reopens the database it realises it is corrupt.  It 
restores the database to a usable condition, then (this is just a guess) it 
deletes the old journal so it can make a new uncorrupted one.

However, I can't answer your basic problem.  I see no reason why these things 
should change just because you're using PERSIST mode.  But there are people who 
understand SQLite internals better than I do.

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

Reply via email to