Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Throw an error on an attempt to open a database where the page size is larger than SQLITE_MAX_PAGE_SIZE. Ticket #2628. (CVS 4411) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4881f7cb37e35dcf5da358464ac858a5 |
User & Date: | drh 2007-09-06 23:39:37.000 |
Context
2007-09-07
| ||
01:12 | Modify the CLI so that it will ignore whitespace at the end of lines. Ticket #2631 (CVS 4412) (check-in: f780a17f4b user: drh tags: trunk) | |
2007-09-06
| ||
23:39 | Throw an error on an attempt to open a database where the page size is larger than SQLITE_MAX_PAGE_SIZE. Ticket #2628. (CVS 4411) (check-in: 4881f7cb37 user: drh tags: trunk) | |
23:28 | Base the name of the statement journal on the original database filename. Remember the statement journal name for the lifetime of the Pager so that the name pointer passed to xOpen persists as long as the file exists. (CVS 4410) (check-in: 44d8d1e92d user: drh tags: trunk) | |
Changes
Changes to src/btree.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** 2004 April 6 ** ** 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. ** ************************************************************************* | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** 2004 April 6 ** ** 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. ** ************************************************************************* ** $Id: btree.c,v 1.424 2007/09/06 23:39:37 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ #include "btreeInt.h" |
︙ | ︙ | |||
1643 1644 1645 1646 1647 1648 1649 | if( page1[18]>1 ){ pBt->readOnly = 1; } if( page1[19]>1 ){ goto page1_init_failed; } pageSize = get2byte(&page1[16]); | | > > | 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 | if( page1[18]>1 ){ pBt->readOnly = 1; } if( page1[19]>1 ){ goto page1_init_failed; } pageSize = get2byte(&page1[16]); if( ((pageSize-1)&pageSize)!=0 || pageSize<512 || (SQLITE_MAX_PAGE_SIZE<32768 && pageSize>SQLITE_MAX_PAGE_SIZE) ){ goto page1_init_failed; } assert( (pageSize & 7)==0 ); pBt->pageSize = pageSize; pBt->usableSize = pageSize - page1[20]; if( pBt->usableSize<500 ){ goto page1_init_failed; |
︙ | ︙ |
Changes to test/sqllimits1.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # May you share freely, never taking more than you give. # #*********************************************************************** # # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # # $Id: sqllimits1.test,v 1.18 2007/09/06 23:39:37 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Test organization: # # sqllimits-1.*: SQLITE_MAX_LENGTH |
︙ | ︙ | |||
499 500 501 502 503 504 505 506 507 508 509 510 511 512 | execsql "pragma page_size" } $::SQLITE_MAX_PAGE_SIZE do_test sqllimits-1.10.5 { set max $::SQLITE_MAX_PAGE_SIZE execsql "pragma page_size = [expr {$max - 5}]" execsql "pragma page_size" } $::SQLITE_MAX_PAGE_SIZE #-------------------------------------------------------------------- # Test cases sqllimits-11.* verify that the # SQLITE_MAX_LIKE_PATTERN_LENGTH limit is enforced. This limit only # applies to the built-in LIKE operator, supplying an external # implementation by overriding the like() scalar function bypasses # this limitation. | > > > > > > > > > > > > > > > > > > > > > > | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | execsql "pragma page_size" } $::SQLITE_MAX_PAGE_SIZE do_test sqllimits-1.10.5 { set max $::SQLITE_MAX_PAGE_SIZE execsql "pragma page_size = [expr {$max - 5}]" execsql "pragma page_size" } $::SQLITE_MAX_PAGE_SIZE # Opening a database where the page size is too large should generate # an error. # do_test sqllimits-1.10.5 { db close file delete -force test.db set ::SQLITE_MAX_PAGE_SIZE 32768 sqlite3 db test.db db eval {PRAGMA page_size=32768} db eval {CREATE TABLE t1(x);} db eval {PRAGMA page_size} } {32768} do_test sqllimits-1.10.6 { db close set ::SQLITE_MAX_PAGE_SIZE 8192 sqlite3 db test.db catchsql {SELECT name FROM sqlite_master} } {1 {file is encrypted or is not a database}} db close file delete -force test.db sqlite3 db test.db #-------------------------------------------------------------------- # Test cases sqllimits-11.* verify that the # SQLITE_MAX_LIKE_PATTERN_LENGTH limit is enforced. This limit only # applies to the built-in LIKE operator, supplying an external # implementation by overriding the like() scalar function bypasses # this limitation. |
︙ | ︙ |