Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Preset the legacy_file_format pragma to the value of the primary database so that a VACUUM will not unknowingly alter the setting. Ticket #2804. (CVS 4574) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
f731fa6bb398d8af621af17dc0677dd0 |
User & Date: | drh 2007-11-28 13:43:17.000 |
Context
2007-11-28
| ||
13:55 | Clarify the conditions under which homegrown recursive mutexes work (they require a coherent cache) and only enable them if there is an explicit #define so as to avoid accidental use on platforms that do not meet the constraints. Ticket #2805. (CVS 4575) (check-in: 80299eebdd user: drh tags: trunk) | |
13:43 | Preset the legacy_file_format pragma to the value of the primary database so that a VACUUM will not unknowingly alter the setting. Ticket #2804. (CVS 4574) (check-in: f731fa6bb3 user: drh tags: trunk) | |
00:51 | Add an implementation of recursive mutexes for unix systems that lack pthreads recursive mutexes (ex: Solaris 2.6). Modern unix systems continue to use the recursive mutexes provided by pthreads. (CVS 4573) (check-in: f366a776c1 user: drh tags: trunk) | |
Changes
Changes to src/prepare.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the implementation of the sqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the implementation of the sqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. ** ** $Id: prepare.c,v 1.65 2007/11/28 13:43:17 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** Fill the InitData structure with an error message that indicates ** that the database is corrupt. |
︙ | ︙ | |||
284 285 286 287 288 289 290 291 292 293 294 295 296 297 | if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ sqlite3BtreeCloseCursor(curMain); sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0); sqlite3BtreeLeave(pDb->pBt); return SQLITE_ERROR; } /* Read the schema information out of the schema tables */ assert( db->init.busy ); if( rc==SQLITE_EMPTY ){ /* For an empty database, there is nothing to read */ rc = SQLITE_OK; | > > > > > > > > | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ sqlite3BtreeCloseCursor(curMain); sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0); sqlite3BtreeLeave(pDb->pBt); return SQLITE_ERROR; } /* Ticket #2804: When we open a database in the newer file format, ** clear the legacy_file_format pragma flag so that a VACUUM will ** not downgrade the database and thus invalidate any descending ** indices that the user might have created. */ if( iDb==0 && meta[1]>=4 ){ db->flags &= ~SQLITE_LegacyFileFmt; } /* Read the schema information out of the schema tables */ assert( db->init.busy ); if( rc==SQLITE_EMPTY ){ /* For an empty database, there is nothing to read */ rc = SQLITE_OK; |
︙ | ︙ |
Changes to test/alter2.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #************************************************************************* # This file implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # # $Id: alter2.test,v 1.12 2007/11/28 13:43:17 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # We have to have pragmas in order to do this test ifcapable {!pragma} return |
︙ | ︙ | |||
271 272 273 274 275 276 277 278 279 280 | # Check that executing VACUUM on a file with file-format version 2 # resets the file format to 1. # set default_file_format [expr $SQLITE_DEFAULT_FILE_FORMAT==4 ? 4 : 1] ifcapable vacuum { do_test alter2-5.1 { set_file_format 2 get_file_format } {2} do_test alter2-5.2 { | > | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | # Check that executing VACUUM on a file with file-format version 2 # resets the file format to 1. # set default_file_format [expr $SQLITE_DEFAULT_FILE_FORMAT==4 ? 4 : 1] ifcapable vacuum { do_test alter2-5.1 { set_file_format 2 execsql {SELECT 1 FROM sqlite_master LIMIT 1;} get_file_format } {2} do_test alter2-5.2 { execsql { VACUUM; } } {} do_test alter2-5.3 { get_file_format } $default_file_format } |
︙ | ︙ |
Changes to test/descidx1.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2005 December 21 # # 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. The # focus of this script is descending indices. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2005 December 21 # # 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. The # focus of this script is descending indices. # # $Id: descidx1.test,v 1.9 2007/11/28 13:43:17 drh Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl db eval {PRAGMA legacy_file_format=OFF} |
︙ | ︙ | |||
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | sqlite3 db test.db execsql {PRAGMA legacy_file_format=NO} execsql {PRAGMA legacy_file_format} } {0} do_test descidx1-6.5 { execsql { CREATE TABLE t1(a,b,c); } get_file_format } {4} ifcapable vacuum { # Verify that the file format is preserved across a vacuum. do_test descidx1-6.6 { execsql {VACUUM} get_file_format } {4} | > > > > > > > > > | > > > > | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | sqlite3 db test.db execsql {PRAGMA legacy_file_format=NO} execsql {PRAGMA legacy_file_format} } {0} do_test descidx1-6.5 { execsql { CREATE TABLE t1(a,b,c); CREATE INDEX i1 ON t1(a ASC, b DESC, c ASC); INSERT INTO t1 VALUES(1,2,3); INSERT INTO t1 VALUES(1,1,0); INSERT INTO t1 VALUES(1,2,1); INSERT INTO t1 VALUES(1,3,4); } get_file_format } {4} ifcapable vacuum { # Verify that the file format is preserved across a vacuum. do_test descidx1-6.6 { execsql {VACUUM} get_file_format } {4} do_test descidx1-6.7 { execsql { PRAGMA legacy_file_format=ON; VACUUM; } get_file_format } {4} } finish_test |