Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 12:45 PM, Richard Hipp wrote: > > > PRAGMA name.journal_mode=MODE; -- set the mode of database "name" to MODE. > PRAGMA name.journal_mode; -- report the mode of database "name". > PRAGMA journal_mode; -- an alias for "PRAGMA main.journal_mode" > PRAGMA

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 12:23 PM, Jay A. Kreibich wrote: > > First Proposed Change: > > > > (1) and (2) are the same. > > > > (3) PRAGMA journal_mode=MODE; -- set the mode to MODE for all attached > > databases. Databases created by subsequent ATTACH use MODE. Existing > >

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 08:06:23PM +0400, Alexey Pechnikov scratched on the wall: > 2010/7/8 Jay A. Kreibich > > > > It's not helpful for backward compability. How about version downgrade of > > > the Android or some other mobile OS and as result impossibility to open > > > any

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 08:23:55AM -0400, Richard Hipp scratched on the wall: > On Thu, Jul 8, 2010 at 7:10 AM, Richard Hipp wrote: > > > Though, I will admit, this is confusing, and I was thinking last night > > about ways we could possibly change it > > Current behavior:

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
2010/7/8 Jay A. Kreibich > > It's not helpful for backward compability. How about version downgrade of > > the Android or some other mobile OS and as result impossibility to open > any > > SQLite database?.. > > That's not backwards compatibility (newer versions working with

Re: [sqlite] WAL questions

2010-07-08 Thread Jay A. Kreibich
On Thu, Jul 08, 2010 at 06:50:52PM +0400, Alexey Pechnikov scratched on the wall: > 2010/7/8 Richard Hipp > > > In the current implementation, if you call "PRAGMA wal_checkpoint" just > > prior to closing the database, the WAL file will be deleted automatically. > > But it

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 10:50 AM, Alexey Pechnikov wrote: > 2010/7/8 Richard Hipp > > > In the current implementation, if you call "PRAGMA wal_checkpoint" just > > prior to closing the database, the WAL file will be deleted > automatically. > > But it

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
2010/7/8 Richard Hipp > In the current implementation, if you call "PRAGMA wal_checkpoint" just > prior to closing the database, the WAL file will be deleted automatically. > But it keeps the database in WAL mode, so the WAL is recreated the next > time > you open and write to

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 10:15 AM, Alexey Pechnikov wrote: > > > > Remove the WAL mode from "PRAGMA journal_mode". The journal_mode pragma > > only specifies the various rollback journal modes. Enable the WAL using > a > > separate pragma such as "PRAGMA wal=ON; PRAGMA

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
> > Remove the WAL mode from "PRAGMA journal_mode". The journal_mode pragma > only specifies the various rollback journal modes. Enable the WAL using a > separate pragma such as "PRAGMA wal=ON; PRAGMA wal=OFF;" > It's more clean I think. With wal=on and journal_mode=delete SQLite may delete

Re: [sqlite] WAL questions

2010-07-08 Thread Max Vlasov
Second Proposed Change: > > Remove the WAL mode from "PRAGMA journal_mode". The journal_mode pragma > only specifies the various rollback journal modes. Enable the WAL using a > separate pragma such as "PRAGMA wal=ON; PRAGMA wal=OFF;" > > Thoughts? Comments? Other suggestions? > > Maybe it's

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 7:10 AM, Richard Hipp wrote: > Though, I will admit, this is confusing, and I was thinking last night > about ways we could possibly change it > Current behavior: (1) PRAGMA name.journal_mode=MODE; -- set the mode to MODE for database "name". (2)

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 7:51 AM, Max Vlasov wrote: > So all his current code base works once it started using this version of > sqlite, but consequently small (or maybe large part) of his bases becomes > WAL-enabled (number 2 in the file format). The latter may appear

Re: [sqlite] WAL questions

2010-07-08 Thread Max Vlasov
> You want "PRAGMA main.journal_mode" > > A "PRAGMA journal_mode;" (without the "main.") shows you the default > journal > mode used by newly created databases, which is always "DELETE" unless you > have changed it with a prior "PRAGMA journal_mode=MODE" command. > > Though, I will admit, this is

Re: [sqlite] WAL questions

2010-07-08 Thread Richard Hipp
On Thu, Jul 8, 2010 at 12:45 AM, Max Vlasov wrote: > Alexey, > > I read this sentence, but it didn't help. > So I suppose there's a bug in PRAGMA journal_mode logic > Steps to reproduce. > > 1. Create an empty base with some table. > Look at the 18,19 offsets, they both =

Re: [sqlite] WAL questions

2010-07-08 Thread Alexey Pechnikov
I see this too: $ sqlite3 grow.db 'pragma journal_mode' delete $ hexdump -s 17 -n 2 grow.db | head -n1 011 0200 $ sqlite3 grow.db 'pragma journal_mode=delete' delete $ hexdump -s 17 -n 2 grow.db | head -n1 011 0100 -- Best regards, Alexey Pechnikov. http://pechnikov.tel/

Re: [sqlite] WAL questions

2010-07-07 Thread Max Vlasov
Alexey, I read this sentence, but it didn't help. So I suppose there's a bug in PRAGMA journal_mode logic Steps to reproduce. 1. Create an empty base with some table. Look at the 18,19 offsets, they both = 1, it's ok, the base is compatible with full range of sqlite3 versions. 2. Do PRAGMA

Re: [sqlite] WAL questions

2010-07-07 Thread Alexey Pechnikov
See http://sqlite.org/draft/wal.html : "An SQLite database _connection_ defaults to journal_mode=DELETE. To convert to WAL mode, use the following pragma: PRAGMA journal_mode=WAL;" -- Best regards, Alexey Pechnikov. http://pechnikov.tel/