Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | If a hot-journal file is detected but the application does not have the required read/write permissions, return SQLITE_CANTOPEN. Prior to this change, SQLITE_BUSY was returned. Ticket #3457. (CVS 5849) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
dc5308c7629abe6a3bad21489c8e9708 |
User & Date: | danielk1977 2008-10-29 07:01:57.000 |
Context
2008-10-30
| ||
15:03 | Add the sqlite3_extended_errcode() interface. Change to return SQLITE_BUSY instead of SQLITE_ERROR when a COMMIT is attempted and one or more queries are still pending. (CVS 5850) (check-in: 4c6a90a166 user: drh tags: trunk) | |
2008-10-29
| ||
07:01 | If a hot-journal file is detected but the application does not have the required read/write permissions, return SQLITE_CANTOPEN. Prior to this change, SQLITE_BUSY was returned. Ticket #3457. (CVS 5849) (check-in: dc5308c762 user: danielk1977 tags: trunk) | |
2008-10-28
| ||
18:58 | Remove the vestigial mem4 and mem6 memory allocators. Add the SQLITE_ZERO_MALLOC compile-time option and the mem0.c module to handle memory allocation for that case. (CVS 5848) (check-in: 4651f590f0 user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** ** @(#) $Id: pager.c,v 1.500 2008/10/29 07:01:57 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" /* ** Macros for troubleshooting. Normally turned off */ |
︙ | ︙ | |||
2636 2637 2638 2639 2640 2641 2642 | if( rc==SQLITE_OK ){ if( res ){ int fout = 0; int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL; assert( !pPager->tempFile ); rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout); assert( rc!=SQLITE_OK || pPager->jfd->pMethods ); | | | < < < < < | 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 | if( rc==SQLITE_OK ){ if( res ){ int fout = 0; int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL; assert( !pPager->tempFile ); rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout); assert( rc!=SQLITE_OK || pPager->jfd->pMethods ); if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){ rc = SQLITE_CANTOPEN; sqlite3OsClose(pPager->jfd); } }else{ /* If the journal does not exist, that means some other process ** has already rolled it back */ rc = SQLITE_BUSY; } } } if( rc!=SQLITE_OK ){ goto failed; } pPager->journalOpen = 1; pPager->journalStarted = 0; pPager->journalOff = 0; pPager->setMaster = 0; pPager->journalHdr = 0; |
︙ | ︙ |
Added test/tkt3457.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | # 2008 October 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. # # $Id: tkt3457.test,v 1.1 2008/10/29 07:01:57 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {$tcl_platform(platform) != "unix"} { finish_test return } #----------------------------------------------------------------------- # To roll back a hot-journal file, the application needs read and write # permission on the journal file in question. The following tests test # the outcome of trying to rollback a hot-journal file when this is not # the case. # # tkt3457-1.2: Application has neither read, nor write permission on # the hot-journal file. Result: SQLITE_CANTOPEN. # # tkt3457-1.3: Application has write but not read permission on # the hot-journal file. Result: SQLITE_CANTOPEN. # # tkt3457-1.4: Application has read but not write permission on # the hot-journal file. Result: SQLITE_CANTOPEN. # # tkt3457-1.5: Application has read/write permission on the hot-journal # file. Result: SQLITE_OK. # do_test tkt3457-1.1 { execsql { CREATE TABLE t1(a, b, c); INSERT INTO t1 VALUES(1, 2, 3); BEGIN; INSERT INTO t1 VALUES(4, 5, 6); } file copy -force test.db bak.db file copy -force test.db-journal bak.db-journal execsql COMMIT } {} do_test tkt3457-1.2 { file copy -force bak.db-journal test.db-journal file attributes test.db-journal -permissions --------- catchsql { SELECT * FROM t1 } } {1 {unable to open database file}} do_test tkt3457-1.3 { file copy -force bak.db-journal test.db-journal file attributes test.db-journal -permissions -w--w--w- catchsql { SELECT * FROM t1 } } {1 {unable to open database file}} do_test tkt3457-1.4 { file copy -force bak.db-journal test.db-journal file attributes test.db-journal -permissions r--r--r-- catchsql { SELECT * FROM t1 } } {1 {unable to open database file}} do_test tkt3457-1.5 { file copy -force bak.db-journal test.db-journal file attributes test.db-journal -permissions rw-rw-rw- catchsql { SELECT * FROM t1 } } {0 {1 2 3 4 5 6}} finish_test |