From a3b2ff5182214226acbced1b52ca35d9d08fb464 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 16 Sep 2011 20:16:36 +0000 Subject: [PATCH 1/8] Silence harmless compiler warning about redefinition of the _CRT_SECURE_NO_WARNINGS macro by shell.c. FossilOrigin-Name: 690220717f3d92d4fb7bd72226fc8d5f38f5fbcf --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 5c4f08aa37..9ec01e70a4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sunreachable\sbranches\sfrom\sthe\sprevious\schange.\s\sAdd\sadditional\ntest\scases. -D 2011-09-16T19:04:03.371 +C Silence\sharmless\scompiler\swarning\sabout\sredefinition\sof\sthe\s_CRT_SECURE_NO_WARNINGS\smacro\sby\sshell.c. +D 2011-09-16T20:16:36.109 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -180,7 +180,7 @@ F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50 F src/resolve.c 36368f44569208fa074e61f4dd0b6c4fb60ca2b4 F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 F src/select.c d9b7d20b0365f80761846f00ef3638d4b33eeaf2 -F src/shell.c bbe7818ff5bc8614105ceb81ad67b8bdc0b671dd +F src/shell.c 13fe2aeddc3cc90d6a273831d1f63736d1596f81 F src/sqlite.h.in 0a6c9c23337fd1352c5c75a613ff9533aa7d91cb F src/sqlite3ext.h 1a1a4f784aa9c3b00edd287940197de52487cd93 F src/sqliteInt.h feb4f2b212fe36bbd951e44d2490c6aacf02f689 @@ -962,7 +962,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 0156f10e23daca0e2504cd293a67ed0233d254d0 -R 6ac04cf9823838428848cb3eecc8467b -U drh -Z fc85b6ee205b1fa04072a560842933fc +P cf51ef8ab8a610ddf64f66970dd689fe1df405b8 +R 82ae90fbdac03554dc4ad676e24ddb3c +U mistachkin +Z 2ae026d8ea384ca85214e134ca7c45bb diff --git a/manifest.uuid b/manifest.uuid index b05ad8b2ae..a0307659f7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cf51ef8ab8a610ddf64f66970dd689fe1df405b8 \ No newline at end of file +690220717f3d92d4fb7bd72226fc8d5f38f5fbcf \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 05272b2dfa..9759e93b00 100644 --- a/src/shell.c +++ b/src/shell.c @@ -12,7 +12,7 @@ ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. */ -#if defined(_WIN32) || defined(WIN32) +#if (defined(_WIN32) || defined(WIN32)) && !defined(_CRT_SECURE_NO_WARNINGS) /* This needs to come before any includes for MSVC compiler */ #define _CRT_SECURE_NO_WARNINGS #endif From c377f3106b13af0c76be570998ea66b96eb3f313 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 16 Sep 2011 20:43:44 +0000 Subject: [PATCH 2/8] Fix #if's in winSync to avoid compiler warnings about unused local variables. Also, update version numbers in the MSVC makefile. FossilOrigin-Name: 2e66e41457422449ac5918b16be443e737dfb149 --- Makefile.msc | 4 ++-- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 14 ++++++++++++-- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Makefile.msc b/Makefile.msc index a6c5d5a75b..01f490b42b 100644 --- a/Makefile.msc +++ b/Makefile.msc @@ -31,8 +31,8 @@ DEBUG = 0 # Version numbers and release number for the SQLite being compiled. # VERSION = 3.7 -VERSION_NUMBER = 3007007 -RELEASE = 3.7.7 +VERSION_NUMBER = 3007008 +RELEASE = 3.7.8 # C Compiler and options for use in building executables that # will run on the platform that is doing the build. diff --git a/manifest b/manifest index 9ec01e70a4..f21b283051 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Silence\sharmless\scompiler\swarning\sabout\sredefinition\sof\sthe\s_CRT_SECURE_NO_WARNINGS\smacro\sby\sshell.c. -D 2011-09-16T20:16:36.109 +C Fix\s#if's\sin\swinSync\sto\savoid\scompiler\swarnings\sabout\sunused\slocal\svariables.\s\sAlso,\supdate\sversion\snumbers\sin\sthe\sMSVC\smakefile. +D 2011-09-16T20:43:44.526 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 -F Makefile.msc 25da409ce0c7799e57f48a729a8e153b23027adc +F Makefile.msc b5e917439d5ed42364173d1648aae1d418e323ea F Makefile.vxworks 1deb39c8bb047296c30161ffa10c1b5423e632f9 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 F VERSION f724de7326e87b7f3b0a55f16ef4b4d993680d54 @@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c 10e0c4dcdbec8d4189890fdf3e71b32efae194e3 -F src/os_win.c 33b7b7b48939af5cef2305f5ded19d45c025e2c7 +F src/os_win.c 0fc0f46c94b0385a940b0ee32992a833019a5985 F src/pager.c 5545863e4e246e1744cfb6993821c6e4b63ffb64 F src/pager.h 6bea8d1949db33768de1c5b4133b267b40845f8b F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -962,7 +962,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P cf51ef8ab8a610ddf64f66970dd689fe1df405b8 -R 82ae90fbdac03554dc4ad676e24ddb3c +P 690220717f3d92d4fb7bd72226fc8d5f38f5fbcf +R 8db2e7132a1227a7b1d23ed92e216603 U mistachkin -Z 2ae026d8ea384ca85214e134ca7c45bb +Z 593341d840a3a381b39866ac10a16fed diff --git a/manifest.uuid b/manifest.uuid index a0307659f7..b54465fd4d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -690220717f3d92d4fb7bd72226fc8d5f38f5fbcf \ No newline at end of file +2e66e41457422449ac5918b16be443e737dfb149 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index c16198bd5d..33ca96c92c 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -1245,9 +1245,19 @@ int sqlite3_fullsync_count = 0; ** Make sure all writes to a particular file are committed to disk. */ static int winSync(sqlite3_file *id, int flags){ -#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || defined(SQLITE_DEBUG) - winFile *pFile = (winFile*)id; +#ifndef SQLITE_NO_SYNC + /* + ** Used only when SQLITE_NO_SYNC is not defined. + */ BOOL rc; +#endif +#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || \ + (defined(SQLITE_TEST) && defined(SQLITE_DEBUG)) + /* + ** Used when SQLITE_NO_SYNC is not defined and by the assert() and/or + ** OSTRACE() macros. + */ + winFile *pFile = (winFile*)id; #else UNUSED_PARAMETER(id); #endif From dfd2d9f6c90791914743c6e102980df6dd13845a Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 16 Sep 2011 22:10:57 +0000 Subject: [PATCH 3/8] Fix a problem with SQLITE_OMIT_TRACE that was introduced by the recent OP_Once change. FossilOrigin-Name: 96be3f7b59b3ed4703b907e29db629df34b2b56f --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/expr.c | 12 +++++------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/manifest b/manifest index f21b283051..06663a9554 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\s#if's\sin\swinSync\sto\savoid\scompiler\swarnings\sabout\sunused\slocal\svariables.\s\sAlso,\supdate\sversion\snumbers\sin\sthe\sMSVC\smakefile. -D 2011-09-16T20:43:44.526 +C Fix\sa\sproblem\swith\sSQLITE_OMIT_TRACE\sthat\swas\sintroduced\sby\sthe\srecent\nOP_Once\schange. +D 2011-09-16T22:10:57.198 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -133,7 +133,7 @@ F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac F src/ctime.c e3132ec65240b2e2f3d50831021eac387f27584d F src/date.c a3c6842bad7ae632281811de112a8ba63ff08ab3 F src/delete.c ff68e5ef23aee08c0ff528f699a19397ed8bbed8 -F src/expr.c fd54c517869919c9b0b11dcadd43c66540ffa682 +F src/expr.c f4dcaeb8252c4b16fcdc245660f70ed366bc6cdd F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 9f00ea98f6b360d477b5a78b5b59a1fbde82431c F src/func.c 59bb046d7e3df1ab512ac339ccb0a6f996a17cb7 @@ -962,7 +962,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 690220717f3d92d4fb7bd72226fc8d5f38f5fbcf -R 8db2e7132a1227a7b1d23ed92e216603 -U mistachkin -Z 593341d840a3a381b39866ac10a16fed +P 2e66e41457422449ac5918b16be443e737dfb149 +R fc961be987415e6cdb50c0924196d190 +U drh +Z a161e546ae0e6f16b9b8fc71b39898c3 diff --git a/manifest.uuid b/manifest.uuid index b54465fd4d..b33cedd522 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2e66e41457422449ac5918b16be443e737dfb149 \ No newline at end of file +96be3f7b59b3ed4703b907e29db629df34b2b56f \ No newline at end of file diff --git a/src/expr.c b/src/expr.c index 6fd08b27f1..d024528d7c 100644 --- a/src/expr.c +++ b/src/expr.c @@ -1574,11 +1574,10 @@ int sqlite3CodeSubselect( int rMayHaveNull, /* Register that records whether NULLs exist in RHS */ int isRowid /* If true, LHS of IN operator is a rowid */ ){ - int testAddr = 0; /* One-time test address */ + int testAddr = -1; /* One-time test address */ int rReg = 0; /* Register storing resulting */ Vdbe *v = sqlite3GetVdbe(pParse); if( NEVER(v==0) ) return 0; - assert( sqlite3VdbeCurrentAddr(v)>0 ); sqlite3ExprCachePush(pParse); /* This code must be run in its entirety every time it is encountered @@ -1594,13 +1593,12 @@ int sqlite3CodeSubselect( if( !ExprHasAnyProperty(pExpr, EP_VarSelect) && !pParse->pTriggerTab ){ int mem = ++pParse->nMem; testAddr = sqlite3VdbeAddOp1(v, OP_Once, mem); - assert( testAddr>0 || pParse->db->mallocFailed ); } #ifndef SQLITE_OMIT_EXPLAIN if( pParse->explain==2 ){ char *zMsg = sqlite3MPrintf( - pParse->db, "EXECUTE %s%s SUBQUERY %d", testAddr?"":"CORRELATED ", + pParse->db, "EXECUTE %s%s SUBQUERY %d", testAddr>=0?"":"CORRELATED ", pExpr->op==TK_IN?"LIST":"SCALAR", pParse->iNextSelectId ); sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC); @@ -1692,9 +1690,9 @@ int sqlite3CodeSubselect( ** this code only executes once. Because for a non-constant ** expression we need to rerun this code each time. */ - if( testAddr && !sqlite3ExprIsConstant(pE2) ){ + if( testAddr>=0 && !sqlite3ExprIsConstant(pE2) ){ sqlite3VdbeChangeToNoop(v, testAddr); - testAddr = 0; + testAddr = -1; } /* Evaluate the expression and insert it into the temp table */ @@ -1763,7 +1761,7 @@ int sqlite3CodeSubselect( } } - if( testAddr ){ + if( testAddr>=0 ){ sqlite3VdbeJumpHere(v, testAddr); } sqlite3ExprCachePop(pParse, 1); From f1c40f4fd4e2069bd4ca63cdb1f072dae6b1a438 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Sat, 17 Sep 2011 15:34:50 +0000 Subject: [PATCH 4/8] Make sure the file structure is zeroed prior to calling the VFS to open a file. FossilOrigin-Name: 29c4d0dd43d41650e54824afd70dd40f1b91cc86 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 06663a9554..a4dc13a816 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sSQLITE_OMIT_TRACE\sthat\swas\sintroduced\sby\sthe\srecent\nOP_Once\schange. -D 2011-09-16T22:10:57.198 +C Make\ssure\sthe\sfile\sstructure\sis\szeroed\sprior\sto\scalling\sthe\sVFS\sto\sopen\sa\sfile. +D 2011-09-17T15:34:50.929 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -161,7 +161,7 @@ F src/mutex_os2.c 882d735098c07c8c6a5472b8dd66e19675fe117f F src/mutex_unix.c b4f4e923bb8de93ec3f251fadb50855f23df9579 F src/mutex_w32.c 5e54f3ba275bcb5d00248b8c23107df2e2f73e33 F src/notify.c 976dd0f6171d4588e89e874fcc765e92914b6d30 -F src/os.c fcc717427a80b2ed225373f07b642dc1aad7490b +F src/os.c 3b3f69c34be7f998f5ea6bd46a2fe8a2b7fa8f70 F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 @@ -962,7 +962,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 2e66e41457422449ac5918b16be443e737dfb149 -R fc961be987415e6cdb50c0924196d190 -U drh -Z a161e546ae0e6f16b9b8fc71b39898c3 +P 96be3f7b59b3ed4703b907e29db629df34b2b56f +R 77ce1bce7b62d392fc7c2060d8f391e0 +U mistachkin +Z b6b2d3e2f1bcf3c98cc7b58c3993322a diff --git a/manifest.uuid b/manifest.uuid index b33cedd522..427a563b6b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -96be3f7b59b3ed4703b907e29db629df34b2b56f \ No newline at end of file +29c4d0dd43d41650e54824afd70dd40f1b91cc86 \ No newline at end of file diff --git a/src/os.c b/src/os.c index 41ec69ce45..9ca72fa31f 100644 --- a/src/os.c +++ b/src/os.c @@ -208,7 +208,7 @@ int sqlite3OsOpenMalloc( ){ int rc = SQLITE_NOMEM; sqlite3_file *pFile; - pFile = (sqlite3_file *)sqlite3Malloc(pVfs->szOsFile); + pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile); if( pFile ){ rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags); if( rc!=SQLITE_OK ){ From 168f9f5aa3df20453a0239d971ebb99f6bb5da59 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 17 Sep 2011 17:29:20 +0000 Subject: [PATCH 5/8] Add a new script to build an amalgamation that omits FTS3/4 and RTREE. FossilOrigin-Name: b31a7d7db9040d8eedaf1ecd89ea0033f579d0f1 --- manifest | 13 +- manifest.uuid | 2 +- tool/mksqlite3c-noext.tcl | 308 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 316 insertions(+), 7 deletions(-) create mode 100644 tool/mksqlite3c-noext.tcl diff --git a/manifest b/manifest index a4dc13a816..0e87842350 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\ssure\sthe\sfile\sstructure\sis\szeroed\sprior\sto\scalling\sthe\sVFS\sto\sopen\sa\sfile. -D 2011-09-17T15:34:50.929 +C Add\sa\snew\sscript\sto\sbuild\san\samalgamation\sthat\somits\sFTS3/4\sand\sRTREE. +D 2011-09-17T17:29:20.058 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -933,6 +933,7 @@ F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/mkkeywordhash.c d2e6b4a5965e23afb80fbe74bb54648cd371f309 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 +F tool/mksqlite3c-noext.tcl 105023aa86f696a74b1d6a4929d1e1c3baf9471c F tool/mksqlite3c.tcl 9fbac513cd9d5ac95ad55630f49bb16c5347ab75 F tool/mksqlite3h.tcl 78013ad79a5e492e5f764f3c7a8ef834255061f8 F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87 @@ -962,7 +963,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 96be3f7b59b3ed4703b907e29db629df34b2b56f -R 77ce1bce7b62d392fc7c2060d8f391e0 -U mistachkin -Z b6b2d3e2f1bcf3c98cc7b58c3993322a +P 29c4d0dd43d41650e54824afd70dd40f1b91cc86 +R e9f251e9ab673855366d66b9e88d41ff +U drh +Z 203ac8ce95ad01a7dde042f0d58501cc diff --git a/manifest.uuid b/manifest.uuid index 427a563b6b..4995d7a8b0 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -29c4d0dd43d41650e54824afd70dd40f1b91cc86 \ No newline at end of file +b31a7d7db9040d8eedaf1ecd89ea0033f579d0f1 \ No newline at end of file diff --git a/tool/mksqlite3c-noext.tcl b/tool/mksqlite3c-noext.tcl new file mode 100644 index 0000000000..6ad30237c6 --- /dev/null +++ b/tool/mksqlite3c-noext.tcl @@ -0,0 +1,308 @@ +#!/usr/bin/tclsh +# +# To build a single huge source file holding all of SQLite (or at +# least the core components - the test harness, shell, and TCL +# interface are omitted.) first do +# +# make target_source +# +# The make target above moves all of the source code files into +# a subdirectory named "tsrc". (This script expects to find the files +# there and will not work if they are not found.) There are a few +# generated C code files that are also added to the tsrc directory. +# For example, the "parse.c" and "parse.h" files to implement the +# the parser are derived from "parse.y" using lemon. And the +# "keywordhash.h" files is generated by a program named "mkkeywordhash". +# +# After the "tsrc" directory has been created and populated, run +# this script: +# +# tclsh mksqlite3c.tcl +# +# The amalgamated SQLite code will be written into sqlite3.c +# + +# Begin by reading the "sqlite3.h" header file. Extract the version number +# from in this file. The versioon number is needed to generate the header +# comment of the amalgamation. +# +if {[lsearch $argv --nostatic]>=0} { + set addstatic 0 +} else { + set addstatic 1 +} +if {[lsearch $argv --linemacros]>=0} { + set linemacros 1 +} else { + set linemacros 0 +} +set in [open tsrc/sqlite3.h] +set cnt 0 +set VERSION ????? +while {![eof $in]} { + set line [gets $in] + if {$line=="" && [eof $in]} break + incr cnt + regexp {#define\s+SQLITE_VERSION\s+"(.*)"} $line all VERSION +} +close $in + +# Open the output file and write a header comment at the beginning +# of the file. +# +set out [open sqlite3.c w] +# Force the output to use unix line endings, even on Windows. +fconfigure $out -translation lf +set today [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S UTC" -gmt 1] +puts $out [subst \ +{/****************************************************************************** +** This file is an amalgamation of many separate C source files from SQLite +** version $VERSION. By combining all the individual C code files into this +** single large file, the entire code can be compiled as a single translation +** unit. This allows many compilers to do optimizations that would not be +** possible if the files were compiled separately. Performance improvements +** of 5% or more are commonly seen when SQLite is compiled as a single +** translation unit. +** +** This file is all you need to compile SQLite. To use SQLite in other +** programs, you need this file and the "sqlite3.h" header file that defines +** the programming interface to the SQLite library. (If you do not have +** the "sqlite3.h" header file at hand, you will find a copy embedded within +** the text of this file. Search for "Begin file sqlite3.h" to find the start +** of the embedded sqlite3.h header file.) Additional code files may be needed +** if you want a wrapper to interface SQLite with your choice of programming +** language. The code for the "sqlite3" command-line shell is also in a +** separate file. This file contains only code for the core SQLite library. +*/ +#define SQLITE_CORE 1 +#define SQLITE_AMALGAMATION 1}] +if {$addstatic} { + puts $out \ +{#ifndef SQLITE_PRIVATE +# define SQLITE_PRIVATE static +#endif +#ifndef SQLITE_API +# define SQLITE_API +#endif} +} + +# These are the header files used by SQLite. The first time any of these +# files are seen in a #include statement in the C code, include the complete +# text of the file in-line. The file only needs to be included once. +# +foreach hdr { + btree.h + btreeInt.h + hash.h + hwtime.h + keywordhash.h + mutex.h + opcodes.h + os_common.h + os.h + os_os2.h + pager.h + parse.h + pcache.h + sqlite3ext.h + sqlite3.h + sqliteicu.h + sqliteInt.h + sqliteLimit.h + vdbe.h + vdbeInt.h + wal.h +} { + set available_hdr($hdr) 1 +} +set available_hdr(sqliteInt.h) 0 + +# 78 stars used for comment formatting. +set s78 \ +{*****************************************************************************} + +# Insert a comment into the code +# +proc section_comment {text} { + global out s78 + set n [string length $text] + set nstar [expr {60 - $n}] + set stars [string range $s78 0 $nstar] + puts $out "/************** $text $stars/" +} + +# Read the source file named $filename and write it into the +# sqlite3.c output file. If any #include statements are seen, +# process them approprately. +# +proc copy_file {filename} { + global seen_hdr available_hdr out addstatic linemacros + set ln 0 + set tail [file tail $filename] + section_comment "Begin file $tail" + if {$linemacros} {puts $out "#line 1 \"$filename\""} + set in [open $filename r] + set varpattern {^[a-zA-Z][a-zA-Z_0-9 *]+(sqlite3[_a-zA-Z0-9]+)(\[|;| =)} + set declpattern {[a-zA-Z][a-zA-Z_0-9 ]+ \**(sqlite3[_a-zA-Z0-9]+)\(} + if {[file extension $filename]==".h"} { + set declpattern " *$declpattern" + } + set declpattern ^$declpattern + while {![eof $in]} { + set line [gets $in] + incr ln + if {[regexp {^\s*#\s*include\s+["<]([^">]+)[">]} $line all hdr]} { + if {[info exists available_hdr($hdr)]} { + if {$available_hdr($hdr)} { + if {$hdr!="os_common.h" && $hdr!="hwtime.h"} { + set available_hdr($hdr) 0 + } + section_comment "Include $hdr in the middle of $tail" + copy_file tsrc/$hdr + section_comment "Continuing where we left off in $tail" + if {$linemacros} {puts $out "#line [expr {$ln+1}] \"$filename\""} + } + } elseif {![info exists seen_hdr($hdr)]} { + set seen_hdr($hdr) 1 + puts $out $line + } else { + puts $out "/* $line */" + } + } elseif {[regexp {^#ifdef __cplusplus} $line]} { + puts $out "#if 0" + } elseif {!$linemacros && [regexp {^#line} $line]} { + # Skip #line directives. + } elseif {$addstatic && ![regexp {^(static|typedef)} $line]} { + regsub {^SQLITE_API } $line {} line + if {[regexp $declpattern $line all funcname]} { + # Add the SQLITE_PRIVATE or SQLITE_API keyword before functions. + # so that linkage can be modified at compile-time. + if {[regexp {^sqlite3_} $funcname]} { + puts $out "SQLITE_API $line" + } else { + puts $out "SQLITE_PRIVATE $line" + } + } elseif {[regexp $varpattern $line all varname]} { + # Add the SQLITE_PRIVATE before variable declarations or + # definitions for internal use + if {![regexp {^sqlite3_} $varname]} { + regsub {^extern } $line {} line + puts $out "SQLITE_PRIVATE $line" + } else { + if {[regexp {const char sqlite3_version\[\];} $line]} { + set line {const char sqlite3_version[] = SQLITE_VERSION;} + } + regsub {^SQLITE_EXTERN } $line {} line + puts $out "SQLITE_API $line" + } + } elseif {[regexp {^(SQLITE_EXTERN )?void \(\*sqlite3IoTrace\)} $line]} { + regsub {^SQLITE_EXTERN } $line {} line + puts $out "SQLITE_PRIVATE $line" + } elseif {[regexp {^void \(\*sqlite3Os} $line]} { + puts $out "SQLITE_PRIVATE $line" + } else { + puts $out $line + } + } else { + puts $out $line + } + } + close $in + section_comment "End of $tail" +} + + +# Process the source files. Process files containing commonly +# used subroutines first in order to help the compiler find +# inlining opportunities. +# +foreach file { + sqliteInt.h + + global.c + ctime.c + status.c + date.c + os.c + + fault.c + mem0.c + mem1.c + mem2.c + mem3.c + mem5.c + mutex.c + mutex_noop.c + mutex_os2.c + mutex_unix.c + mutex_w32.c + malloc.c + printf.c + random.c + utf.c + util.c + hash.c + opcodes.c + + os_os2.c + os_unix.c + os_win.c + + bitvec.c + pcache.c + pcache1.c + rowset.c + pager.c + wal.c + + btmutex.c + btree.c + backup.c + + vdbemem.c + vdbeaux.c + vdbeapi.c + vdbetrace.c + vdbe.c + vdbeblob.c + vdbesort.c + journal.c + memjournal.c + + walker.c + resolve.c + expr.c + alter.c + analyze.c + attach.c + auth.c + build.c + callback.c + delete.c + func.c + fkey.c + insert.c + legacy.c + loadext.c + pragma.c + prepare.c + select.c + table.c + trigger.c + update.c + vacuum.c + vtab.c + where.c + + parse.c + + tokenize.c + complete.c + + main.c + notify.c +} { + copy_file tsrc/$file +} + +close $out From 73ac46da31d1579105686096251de75b87dc69df Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 19 Sep 2011 11:57:34 +0000 Subject: [PATCH 6/8] Remove a stray merge-sort related change from pager.c and pager.h. FossilOrigin-Name: 69823ed163049d6fa1e24a9810c3c99f2a8fdd46 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- src/pager.c | 2 -- src/pager.h | 1 - 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 0e87842350..d87393cb83 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\snew\sscript\sto\sbuild\san\samalgamation\sthat\somits\sFTS3/4\sand\sRTREE. -D 2011-09-17T17:29:20.058 +C Remove\sa\sstray\smerge-sort\srelated\schange\sfrom\spager.c\sand\spager.h. +D 2011-09-19T11:57:34.680 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -167,8 +167,8 @@ F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c 10e0c4dcdbec8d4189890fdf3e71b32efae194e3 F src/os_win.c 0fc0f46c94b0385a940b0ee32992a833019a5985 -F src/pager.c 5545863e4e246e1744cfb6993821c6e4b63ffb64 -F src/pager.h 6bea8d1949db33768de1c5b4133b267b40845f8b +F src/pager.c 15d10371e2d560b68870a9ccec022ad8f01e70a2 +F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 F src/pcache.c 49e718c095810c6b3334e3a6d89970aceaddefce F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050 @@ -963,7 +963,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 29c4d0dd43d41650e54824afd70dd40f1b91cc86 -R e9f251e9ab673855366d66b9e88d41ff -U drh -Z 203ac8ce95ad01a7dde042f0d58501cc +P b31a7d7db9040d8eedaf1ecd89ea0033f579d0f1 +R 1c8ffe1a542693449ee741dcf7775b98 +U dan +Z f53b7375cccfa7037a6a242074ab7937 diff --git a/manifest.uuid b/manifest.uuid index 4995d7a8b0..6dbf91cefe 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b31a7d7db9040d8eedaf1ecd89ea0033f579d0f1 \ No newline at end of file +69823ed163049d6fa1e24a9810c3c99f2a8fdd46 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index f40d2af74b..f8d3ba9989 100644 --- a/src/pager.c +++ b/src/pager.c @@ -620,7 +620,6 @@ struct Pager { u8 tempFile; /* zFilename is a temporary file */ u8 readOnly; /* True for a read-only database */ u8 memDb; /* True to inhibit all file I/O */ - u8 hasSeenStress; /* pagerStress() called one or more times */ /************************************************************************** ** The following block contains those class members that change during @@ -4175,7 +4174,6 @@ static int pagerStress(void *p, PgHdr *pPg){ ** be called in the error state. Nevertheless, we include a NEVER() ** test for the error state as a safeguard against future changes. */ - pPager->hasSeenStress = 1; if( NEVER(pPager->errCode) ) return SQLITE_OK; if( pPager->doNotSpill ) return SQLITE_OK; if( pPager->doNotSyncSpill && (pPg->flags & PGHDR_NEED_SYNC)!=0 ){ diff --git a/src/pager.h b/src/pager.h index 2a02eff75c..eab7ddaf80 100644 --- a/src/pager.h +++ b/src/pager.h @@ -60,7 +60,6 @@ typedef struct PgHdr DbPage; #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */ #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */ #define PAGER_MEMORY 0x0004 /* In-memory database */ -#define PAGER_SORTER 0x0020 /* Accumulator in external merge sort */ /* ** Valid values for the second argument to sqlite3PagerLockingMode(). From 432e0bc6dc62950c3880d0c0de9e504d16b82b14 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Sep 2011 13:01:53 +0000 Subject: [PATCH 7/8] Increase the default lookaside cache line size from 100 to 128 bytes. FossilOrigin-Name: db019465036171fcad31181bec7d6ac185f50430 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/global.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index d87393cb83..069a3f04d3 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sa\sstray\smerge-sort\srelated\schange\sfrom\spager.c\sand\spager.h. -D 2011-09-19T11:57:34.680 +C Increase\sthe\sdefault\slookaside\scache\sline\ssize\sfrom\s100\sto\s128\sbytes. +D 2011-09-19T13:01:53.066 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -137,7 +137,7 @@ F src/expr.c f4dcaeb8252c4b16fcdc245660f70ed366bc6cdd F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 9f00ea98f6b360d477b5a78b5b59a1fbde82431c F src/func.c 59bb046d7e3df1ab512ac339ccb0a6f996a17cb7 -F src/global.c c70a46f28680f8d7c097dbc0430ccf3b932e90b0 +F src/global.c e230227de13601714b29f9363028514aada5ae2f F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 @@ -963,7 +963,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P b31a7d7db9040d8eedaf1ecd89ea0033f579d0f1 -R 1c8ffe1a542693449ee741dcf7775b98 -U dan -Z f53b7375cccfa7037a6a242074ab7937 +P 69823ed163049d6fa1e24a9810c3c99f2a8fdd46 +R 0a2782a80f1b08369498ecce1d7a7aa8 +U drh +Z 32bc5c0badd95a130ff9fd9bc53942e8 diff --git a/manifest.uuid b/manifest.uuid index 6dbf91cefe..ca54dc64e1 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -69823ed163049d6fa1e24a9810c3c99f2a8fdd46 \ No newline at end of file +db019465036171fcad31181bec7d6ac185f50430 \ No newline at end of file diff --git a/src/global.c b/src/global.c index 69daa5e9f8..1e691c4494 100644 --- a/src/global.c +++ b/src/global.c @@ -143,7 +143,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = { SQLITE_THREADSAFE==1, /* bFullMutex */ SQLITE_USE_URI, /* bOpenUri */ 0x7ffffffe, /* mxStrlen */ - 100, /* szLookaside */ + 128, /* szLookaside */ 500, /* nLookaside */ {0,0,0,0,0,0,0,0}, /* m */ {0,0,0,0,0,0,0,0,0}, /* mutex */ From 1335f8c21facdba9fc61231281b207c5e75d6255 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 19 Sep 2011 14:49:19 +0000 Subject: [PATCH 8/8] Version 3.7.8 release candidate FossilOrigin-Name: 3e0da808d2f5b4d12046e05980ca04578f581177 --- manifest | 8 ++++---- manifest.uuid | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifest b/manifest index 069a3f04d3..4fa7069d09 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Increase\sthe\sdefault\slookaside\scache\sline\ssize\sfrom\s100\sto\s128\sbytes. -D 2011-09-19T13:01:53.066 +C Version\s3.7.8\srelease\scandidate +D 2011-09-19T14:49:19.255 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d314143fa6be24828021d3f583ad37d9afdce505 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -963,7 +963,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2 -P 69823ed163049d6fa1e24a9810c3c99f2a8fdd46 +P db019465036171fcad31181bec7d6ac185f50430 R 0a2782a80f1b08369498ecce1d7a7aa8 U drh -Z 32bc5c0badd95a130ff9fd9bc53942e8 +Z 5f8dabab2a44903caad40fc4aceed901 diff --git a/manifest.uuid b/manifest.uuid index ca54dc64e1..6cc03efd83 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -db019465036171fcad31181bec7d6ac185f50430 \ No newline at end of file +3e0da808d2f5b4d12046e05980ca04578f581177 \ No newline at end of file