-C Fix\sfor\sbug\s#94:\sBe\ssure\sto\sjournal\spages\sthat\sare\sadded\sto\sthe\sfreelist\sthen\nremoved\sfrom\sthe\sfreelist\sand\sreused\sduring\sthe\ssame\stransaction.\s(CVS\s660)
-D 2002-07-06T16:28:48
+C Prepare\sfor\sthe\s2.5.5\srelease.\s(CVS\s661)
+D 2002-07-06T16:32:15
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
-F VERSION 234ab45c950d48430049273c90ebfd05b6db152f
+F VERSION 913f3b0d995e090a9f126ca63215e49ef22904e5
F aclocal.m4 11faa843caa38fd451bc6aeb43e248d1723a269d
F config.guess f38b1e93d1e0fa6f5a6913e9e7b12774b9232588
F config.sub f14b07d544ca26b5d698259045136b783e18fc7f
F spec.template 238f7db425a78dc1bb7682e56e3834c7270a3f5e
F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
-F src/btree.c 6aaa67d7eab70c2531dc13e5d9eb87e626c0b4d7
+F src/btree.c f722f9ff5cca79cc765d06116a60a106a0ddfdf1
F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
F src/build.c ea4a3bc15d6338294e68100f642edf48e4082403
F src/delete.c 215492ffcea4262a993e55f3c4a67dc9fea4da9c
F src/sqlite.h.in 75c5bbb066d0faf34424b7d1babf8b44d5b31af2
F src/sqliteInt.h 6a36f4fc32cbbf3e6bf15516137b113b3dc973aa
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
-F src/tclsqlite.c e932591c0bb522b0a35ea7dc861c623ccb2e3aa8
+F src/tclsqlite.c 84bb86f3aa7640231e30356b11c2218a4e1c42f9
F src/test1.c a2f2b6b1df07d4e8b380323896c3ed34442cea91
F src/test2.c 669cc22781c6461a273416ec1a7414d25c081730
-F src/test3.c 72ac6a9017a70e542954907a1dfd87ab6f7824e3
+F src/test3.c c0adb37b0370958df273d36051546b4c843a5bc6
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
F src/tokenize.c b5500e193a82b5b9888fbf947efd90d3b4858178
F src/trigger.c d88ab4d68d68955c217b38fb6717e090fbbf54a4
F test/vacuum.test 059871b312eb910bbe49dafde1d01490cc2c6bbe
F test/view.test 28700c1f9a10121242eaad77622f603cf59a548b
F test/where.test 1f87bec674bf85d74ac1cc5b2cd3d89be1e87b1d
+F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/lemon.c 459cb2bb3738a1ad5cb0ad8b805587a88a885d95
F tool/lempar.c 73a991cc3017fb34804250fa901488b5147b3717
F tool/memleak.awk 296dfbce7a9ca499b95ce04e30334e64a50052e0
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
F tool/renumberOps.awk 6d067177ad5f8d711b79577b462da9b3634bd0a9
F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816
+F tool/showdb.c 3559eac5a3b46e9b558d50856946b25e77633236
+F tool/showjournal.c 9a37d7b05de0591e3102aaf774d01fbc0d053a8b
F tool/speedtest.tcl 06c76698485ccf597b9e7dbb1ac70706eb873355
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F www/arch.fig d5f9752a4dbf242e9cfffffd3f5762b6c63b3bcf
F www/arch.png 82ef36db1143828a7abc88b1e308a5f55d4336f4
F www/arch.tcl 72a0c80e9054cc7025a50928d28d9c75c02c2b8b
F www/c_interface.tcl 58cf4d128dcae08d91d0011c6d4d11de323f470f
-F www/changes.tcl 84effe7d89ffb8dbf442fef3cf43c9f7d48e320f
+F www/changes.tcl 8b15a85a0a338234ddff5804ecad636521efcab5
F www/conflict.tcl 81dd21f9a679e60aae049e9dd8ab53d59570cda2
F www/crosscompile.tcl 3622ebbe518927a3854a12de51344673eb2dd060
F www/download.tcl 29aa6679ca29621d10613f60ebbbda18f4b91c49
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P b4737a16c997a6c139d616211fb6bc4b0fae181c
-R 253a44e4b92ce398170a14aa4989c608
+P db178646a01483d59e6f9af302e9bbe394956d93
+R 5a2631b9a3e9098f0e7b3bbcc4662784
U drh
-Z 4750e3634de2bc1c9f7bbad93ace444e
+Z 268d6f4e13adc3f94b7109b04eabbe9e
-db178646a01483d59e6f9af302e9bbe394956d93
\ No newline at end of file
+00f83c2576f4a9689720d344788f66219c1f6827
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.63 2002/06/21 13:09:17 drh Exp $
+** $Id: btree.c,v 1.64 2002/07/06 16:32:15 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
*/
static int checkRef(IntegrityCk *pCheck, int iPage, char *zContext){
if( iPage==0 ) return 1;
- if( iPage>pCheck->nPage ){
+ if( iPage>pCheck->nPage || iPage<0 ){
char zBuf[100];
sprintf(zBuf, "invalid page number %d", iPage);
checkAppendMsg(pCheck, zContext, zBuf);
sCheck.pBt = pBt;
sCheck.pPager = pBt->pPager;
sCheck.nPage = sqlitepager_pagecount(sCheck.pPager);
+ if( sCheck.nPage==0 ){
+ unlockBtreeIfUnused(pBt);
+ return 0;
+ }
sCheck.anRef = sqliteMalloc( (sCheck.nPage+1)*sizeof(sCheck.anRef[0]) );
sCheck.anRef[1] = 1;
for(i=2; i<=sCheck.nPage; i++){ sCheck.anRef[i] = 0; }
*************************************************************************
** A TCL Interface to SQLite
**
-** $Id: tclsqlite.c,v 1.34 2002/06/26 20:06:06 drh Exp $
+** $Id: tclsqlite.c,v 1.35 2002/07/06 16:32:15 drh Exp $
*/
#ifndef NO_TCL /* Omit this whole file if TCL is unavailable */
static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
SqliteDb *pDb = (SqliteDb*)cd;
int choice;
- static char *DB_strs[] = {
+ static const char *DB_strs[] = {
"busy", "changes", "close",
"complete", "eval", "last_insert_rowid",
"open_aux_file", "timeout", 0
TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT | TCL_APPEND_VALUE);
}
if( Tcl_EvalFile(interp, argv[1])!=TCL_OK ){
- char *zInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
+ const char *zInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
if( zInfo==0 ) zInfo = interp->result;
fprintf(stderr,"%s: %s\n", *argv, zInfo);
return 1;
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test3.c,v 1.15 2002/06/26 20:06:06 drh Exp $
+** $Id: test3.c,v 1.16 2002/07/06 16:32:15 drh Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
" FILENAME\"", 0);
return TCL_ERROR;
}
- rc = sqliteBtreeOpen(argv[1], 0666, 10, &pBt);
+ rc = sqliteBtreeOpen(argv[1], 0666, 1000, &pBt);
if( rc!=SQLITE_OK ){
Tcl_AppendResult(interp, errorName(rc), 0);
return TCL_ERROR;
){
BtCursor *pCur;
int rc;
+ int res = 0;
+ char zBuf[100];
if( argc!=2 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
return TCL_ERROR;
}
if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR;
- rc = sqliteBtreeNext(pCur, 0);
+ rc = sqliteBtreeNext(pCur, &res);
if( rc ){
Tcl_AppendResult(interp, errorName(rc), 0);
return TCL_ERROR;
}
+ sprintf(zBuf,"%d",res);
+ Tcl_AppendResult(interp, zBuf, 0);
+ return SQLITE_OK;
+}
+
+/*
+** Usage: btree_first ID
+**
+** Move the cursor to the first entry in the table.
+*/
+static int btree_first(
+ void *NotUsed,
+ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
+ int argc, /* Number of arguments */
+ char **argv /* Text of each argument */
+){
+ BtCursor *pCur;
+ int rc;
+ int res = 0;
+ char zBuf[100];
+
+ if( argc!=2 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " ID\"", 0);
+ return TCL_ERROR;
+ }
+ if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR;
+ rc = sqliteBtreeFirst(pCur, &res);
+ if( rc ){
+ Tcl_AppendResult(interp, errorName(rc), 0);
+ return TCL_ERROR;
+ }
+ sprintf(zBuf,"%d",res);
+ Tcl_AppendResult(interp, zBuf, 0);
return SQLITE_OK;
}
return SQLITE_OK;
}
+/*
+** Usage: btree_payload_size ID
+**
+** Return the number of bytes of payload
+*/
+static int btree_payload_size(
+ void *NotUsed,
+ Tcl_Interp *interp, /* The TCL interpreter that invoked this command */
+ int argc, /* Number of arguments */
+ char **argv /* Text of each argument */
+){
+ BtCursor *pCur;
+ int n1, n2;
+ char zBuf[50];
+
+ if( argc!=2 ){
+ Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
+ " ID\"", 0);
+ return TCL_ERROR;
+ }
+ if( Tcl_GetInt(interp, argv[1], (int*)&pCur) ) return TCL_ERROR;
+ sqliteBtreeKeySize(pCur, &n1);
+ sqliteBtreeDataSize(pCur, &n2);
+ sprintf(zBuf, "%d", n1+n2);
+ Tcl_AppendResult(interp, zBuf, 0);
+ free(zBuf);
+ return SQLITE_OK;
+}
+
/*
** Usage: btree_cursor_dump ID
**
Tcl_CreateCommand(interp, "btree_next", btree_next, 0, 0);
Tcl_CreateCommand(interp, "btree_key", btree_key, 0, 0);
Tcl_CreateCommand(interp, "btree_data", btree_data, 0, 0);
+ Tcl_CreateCommand(interp, "btree_payload_size", btree_payload_size, 0, 0);
+ Tcl_CreateCommand(interp, "btree_first", btree_first, 0, 0);
Tcl_CreateCommand(interp, "btree_cursor_dump", btree_cursor_dump, 0, 0);
Tcl_CreateCommand(interp, "btree_integrity_check", btree_integrity_check,0,0);
Tcl_LinkVar(interp, "pager_refinfo_enable", (char*)&pager_refinfo_enable,
--- /dev/null
+/*
+** A utility for printing the differences between two SQLite database files.
+*/
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+
+#define PAGESIZE 1024
+static int db1 = -1;
+static int db2 = -1;
+
+int main(int argc, char **argv){
+ int iPg;
+ unsigned char a1[PAGESIZE], a2[PAGESIZE];
+ if( argc!=3 ){
+ fprintf(stderr,"Usage: %s FILENAME FILENAME\n", argv[0]);
+ exit(1);
+ }
+ db1 = open(argv[1], O_RDONLY);
+ if( db1<0 ){
+ fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]);
+ exit(1);
+ }
+ db2 = open(argv[2], O_RDONLY);
+ if( db2<0 ){
+ fprintf(stderr,"%s: can't open %s\n", argv[0], argv[2]);
+ exit(1);
+ }
+ iPg = 1;
+ while( read(db1, a1, PAGESIZE)==PAGESIZE && read(db2,a2,PAGESIZE)==PAGESIZE ){
+ if( memcmp(a1,a2,PAGESIZE) ){
+ printf("Page %d\n", iPg);
+ }
+ iPg++;
+ }
+ printf("%d pages checked\n", iPg-1);
+ close(db1);
+ close(db2);
+}
--- /dev/null
+/*
+** A utility for printing all or part of an SQLite database file.
+*/
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+
+static int pagesize = 1024;
+static int db = -1;
+static int mxPage = 0;
+
+static void out_of_memory(void){
+ fprintf(stderr,"Out of memory...\n");
+ exit(1);
+}
+
+static print_page(int iPg){
+ unsigned char *aData;
+ int i, j;
+ aData = malloc(pagesize);
+ if( aData==0 ) out_of_memory();
+ lseek(db, (iPg-1)*pagesize, SEEK_SET);
+ read(db, aData, pagesize);
+ fprintf(stdout, "Page %d:\n", iPg);
+ for(i=0; i<pagesize; i += 16){
+ fprintf(stdout, " %03x: ",i);
+ for(j=0; j<16; j++){
+ fprintf(stdout,"%02x ", aData[i+j]);
+ }
+ for(j=0; j<16; j++){
+ fprintf(stdout,"%c", isprint(aData[i+j]) ? aData[i+j] : '.');
+ }
+ fprintf(stdout,"\n");
+ }
+ free(aData);
+}
+
+int main(int argc, char **argv){
+ struct stat sbuf;
+ if( argc<2 ){
+ fprintf(stderr,"Usage: %s FILENAME ?PAGE? ...\n", argv[0]);
+ exit(1);
+ }
+ db = open(argv[1], O_RDONLY);
+ if( db<0 ){
+ fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]);
+ exit(1);
+ }
+ fstat(db, &sbuf);
+ mxPage = sbuf.st_size/pagesize + 1;
+ if( argc==2 ){
+ int i;
+ for(i=1; i<=mxPage; i++) print_page(i);
+ }else{
+ int i;
+ for(i=2; i<argc; i++){
+ int iStart, iEnd;
+ char *zLeft;
+ iStart = strtol(argv[i], &zLeft, 0);
+ if( zLeft && strcmp(zLeft,"..end")==0 ){
+ iEnd = mxPage;
+ }else if( zLeft && zLeft[0]=='.' && zLeft[1]=='.' ){
+ iEnd = strtol(&zLeft[2], 0, 0);
+ }else{
+ iEnd = iStart;
+ }
+ if( iStart<1 || iEnd<iStart || iEnd>mxPage ){
+ fprintf(stderr,
+ "Page argument should be LOWER?..UPPER?. Range 1 to %d\n",
+ mxPage);
+ exit(1);
+ }
+ while( iStart<=iEnd ){
+ print_page(iStart);
+ iStart++;
+ }
+ }
+ }
+ close(db);
+}
--- /dev/null
+/*
+** A utility for printing an SQLite database journal.
+*/
+#include <stdio.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdlib.h>
+
+
+static int pagesize = 1024;
+static int db = -1;
+static int mxPage = 0;
+
+static void out_of_memory(void){
+ fprintf(stderr,"Out of memory...\n");
+ exit(1);
+}
+
+static print_page(int iPg){
+ unsigned char *aData;
+ int i, j;
+ aData = malloc(pagesize);
+ if( aData==0 ) out_of_memory();
+ read(db, aData, pagesize);
+ fprintf(stdout, "Page %d:\n", iPg);
+ for(i=0; i<pagesize; i += 16){
+ fprintf(stdout, " %03x: ",i);
+ for(j=0; j<16; j++){
+ fprintf(stdout,"%02x ", aData[i+j]);
+ }
+ for(j=0; j<16; j++){
+ fprintf(stdout,"%c", isprint(aData[i+j]) ? aData[i+j] : '.');
+ }
+ fprintf(stdout,"\n");
+ }
+ free(aData);
+}
+
+int main(int argc, char **argv){
+ struct stat sbuf;
+ unsigned int u;
+ int rc;
+ char zBuf[100];
+ if( argc!=2 ){
+ fprintf(stderr,"Usage: %s FILENAME\n", argv[0]);
+ exit(1);
+ }
+ db = open(argv[1], O_RDONLY);
+ if( db<0 ){
+ fprintf(stderr,"%s: can't open %s\n", argv[0], argv[1]);
+ exit(1);
+ }
+ read(db, zBuf, 8);
+ read(db, &u, sizeof(u));
+ printf("Database Size: %u\n", u);
+ while( read(db, &u, sizeof(u))==sizeof(u) ){
+ print_page(u);
+ }
+ close(db);
+}
puts "<DD><P><UL>$desc</UL></P></DD>"
}
+chng {2002 Jly 6 (2.5.5)} {
+<li>Fix a bug which could cause database corruption during a rollback.
+ This bugs was introduced in version 2.4.0 by the freelist
+ optimization of checking [410].</li>
+<li>Fix a bug in aggregate functions for VIEWs.</li>
+<li>Other minor changes and enhancements.</li>
+}
+
chng {2002 Jly 1 (2.5.4)} {
<li>Make the "AS" keyword optional again.</li>
<li>The datatype of columns now appear in the 4th argument to the