From e321c29a7b1fd10013e64c8f2ff111de61f28f6f Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 12 Jan 2006 01:56:43 +0000 Subject: [PATCH] Add the legacy_file_format pragma. (CVS 2922) FossilOrigin-Name: b2dbd1a5b7f5a70049f25755f07b9c4c5116549b --- manifest | 18 +++++++++--------- manifest.uuid | 2 +- src/build.c | 7 +++++-- src/pragma.c | 3 ++- src/sqliteInt.h | 3 ++- test/descidx1.test | 23 ++++++++++++++++++++++- 6 files changed, 41 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index 554d36145e..fe75187d25 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Improve\sperformance\sby\sabout\s10%\sby\savoiding\sexcess\scalls\sto\sget\nthe\sthread-specific\sdata.\s(CVS\s2921) -D 2006-01-12T01:25:18 +C Add\sthe\slegacy_file_format\spragma.\s(CVS\s2922) +D 2006-01-12T01:56:44 F Makefile.in ab3ffd8d469cef4477257169b82810030a6bb967 F Makefile.linux-gcc aee18d8a05546dcf1888bd4547e442008a49a092 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -36,7 +36,7 @@ F src/attach.c d4b9d8bd71d72409720946355be41cafb6c09079 F src/auth.c cdec356a5cd8b217c346f816c5912221537fe87f F src/btree.c b407273cb22f39606acc27b8a4a74c6272c7a9d2 F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184 -F src/build.c 652a3932292c2b8d1900219f537f1b5e21490afa +F src/build.c a055974683ddc465bdc8669d43d6ab35d3dbb55f F src/callback.c ba3e6cc7a6beb562e7a66f92e26fabcb21aab1e2 F src/complete.c df1681cef40dec33a286006981845f87b194e7a4 F src/date.c a927bdbb51296ac398d2f667086a7072c099e5ab @@ -62,7 +62,7 @@ F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/pager.c a96b9c43664670576e41eac699277c7862d604d8 F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f F src/parse.y 83df51fea35f68f7e07384d75dce83d1ed30434c -F src/pragma.c d439d257c1bcacbc09d38820ac578749df900562 +F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3 F src/prepare.c 60c1f5e3d2901d651f8ca9f06e39e2ff3f335844 F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812 F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 @@ -70,7 +70,7 @@ F src/select.c 7b19d350cb2a18ae4a59d6b87049aa2ce9c671ae F src/server.c e425729aa7ff374637033a38ba9fd9938c432244 F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da F src/sqlite.h.in 4320cff369e37897d2839d526c2b8917a2756d60 -F src/sqliteInt.h 34e251f02155ba30f8c9872c23fcc5ce822a66f0 +F src/sqliteInt.h adb23b1130eccea72dcc1c617e7045a3e2c774b2 F src/table.c 486dcfce532685b53b5a2b5da8bba0ded6fb2316 F src/tclsqlite.c d650bea0248fc0a310ddc2cb94273a3a5021fddf F src/test1.c 30ed0d4d594db0bb2beb98be7024cde1fe686f14 @@ -149,7 +149,7 @@ F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb F test/delete.test 525a6953bc3978780cae35f3eaf1027cf4ce887d F test/delete2.test d20b08733243f1890079f3b48f2356fbb62212b2 F test/delete3.test 555e84a00a99230b7d049d477a324a631126a6ab -F test/descidx1.test 466a9b87f3a7682156916dcbd5b77be55fd39d75 +F test/descidx1.test 616076c4fd7efb0098a69a53f965af6e1eb4e7ca F test/descidx2.test f9f73c562932b81207faa525cd52acdfd2fc0482 F test/descidx3.test 56daed47e2eb91cef15a21a656691bb82a4699ba F test/diskfull.test d828d72adfc9e2d1a194d25996718c1989152cf9 @@ -340,7 +340,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P fb518b0ce4ddd4aaca5cccf61e651f173e735119 -R ce9b50ecb217fb792018eee2bef49d6e +P a8c74febec11eb689ca9f6b454f8c8bbadfc49d7 +R a006d7e482249415e32201526e886230 U drh -Z e741755610cebec2aa9bd0a607d8cdad +Z d18deac16feff4f4bab19d89c3286410 diff --git a/manifest.uuid b/manifest.uuid index 05f3a56948..c4eeaed0ab 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a8c74febec11eb689ca9f6b454f8c8bbadfc49d7 \ No newline at end of file +b2dbd1a5b7f5a70049f25755f07b9c4c5116549b \ No newline at end of file diff --git a/src/build.c b/src/build.c index ee39910182..1563e12560 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.377 2006/01/11 21:41:22 drh Exp $ +** $Id: build.c,v 1.378 2006/01/12 01:56:44 drh Exp $ */ #include "sqliteInt.h" #include @@ -833,6 +833,7 @@ void sqlite3StartTable( */ if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ int lbl; + int fileFormat; sqlite3BeginWriteOperation(pParse, 0, iDb); /* If the file format and encoding in the database have not been set, @@ -841,7 +842,9 @@ void sqlite3StartTable( sqlite3VdbeAddOp(v, OP_ReadCookie, iDb, 1); /* file_format */ lbl = sqlite3VdbeMakeLabel(v); sqlite3VdbeAddOp(v, OP_If, 0, lbl); - sqlite3VdbeAddOp(v, OP_Integer, SQLITE_DEFAULT_FILE_FORMAT, 0); + fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ? + 1 : SQLITE_DEFAULT_FILE_FORMAT; + sqlite3VdbeAddOp(v, OP_Integer, fileFormat, 0); sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 1); sqlite3VdbeAddOp(v, OP_Integer, ENC(db), 0); sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 4); diff --git a/src/pragma.c b/src/pragma.c index 54fb19f647..45318190ff 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.113 2006/01/11 14:09:32 danielk1977 Exp $ +** $Id: pragma.c,v 1.114 2006/01/12 01:56:44 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -151,6 +151,7 @@ static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){ { "short_column_names", SQLITE_ShortColNames }, { "count_changes", SQLITE_CountRows }, { "empty_result_callbacks", SQLITE_NullCallback }, + { "legacy_file_format", SQLITE_LegacyFileFmt }, #ifndef SQLITE_OMIT_CHECK { "ignore_check_constraints", SQLITE_IgnoreChecks }, #endif diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 5391790870..c06fa00c0b 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -11,7 +11,7 @@ ************************************************************************* ** Internal interface definitions for SQLite. ** -** @(#) $Id: sqliteInt.h,v 1.463 2006/01/12 01:25:18 drh Exp $ +** @(#) $Id: sqliteInt.h,v 1.464 2006/01/12 01:56:44 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ @@ -544,6 +544,7 @@ struct sqlite3 { ** accessing read-only databases */ #define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */ #define SQLITE_ReadUncommitted 0x00004000 /* For shared-cache mode */ +#define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */ /* ** Possible values for the sqlite.magic field. diff --git a/test/descidx1.test b/test/descidx1.test index 30188abf18..816e8e0c50 100644 --- a/test/descidx1.test +++ b/test/descidx1.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this script is descending indices. # -# $Id: descidx1.test,v 1.3 2005/12/29 19:23:07 drh Exp $ +# $Id: descidx1.test,v 1.4 2006/01/12 01:56:44 drh Exp $ # set testdir [file dirname $argv0] @@ -287,4 +287,25 @@ do_test descidx1-5.9 { } } {110 111 100 101 010 011 000 001 sort} +# Test the legacy_file_format pragma here because we have access to +# the get_file_format command. +# +do_test descidx1-6.1 { + db close + file delete -force test.db test.db-journal + sqlite3 db test.db + execsql {PRAGMA legacy_file_format} +} {0} +do_test descidx1-6.2 { + execsql {PRAGMA legacy_file_format=YES} + execsql {PRAGMA legacy_file_format} +} {1} +do_test descidx1-6.3 { + execsql { + CREATE TABLE t1(a,b,c); + } + get_file_format +} {1} + + finish_test -- 2.39.5