-C Update\ssome\sdocumentation\sfor\sversion\s3.1.\s(CVS\s2188)
-D 2005-01-10T06:39:57
+C Extra\stest\scases\sto\simprove\scoverage\sof\sbtree.c\s(CVS\s2189)
+D 2005-01-10T12:59:52
F Makefile.in ecf441ac5ca1ccfc8748a8a9537706e69893dfa4
F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457
F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
F src/attach.c e49d09dad9f5f9fb10b4b0c1be5a70ae4c45e689
F src/auth.c 3b81f2a42f48a62c2c9c9b0eda31a157c681edea
-F src/btree.c 5483bf070f1f9db540d526e70397f42c857c07e5
+F src/btree.c 241e27b4640519a45ab55d35ee3ae300a478eb23
F src/btree.h 861e40b759a195ba63819740e484390012cf81ab
F src/build.c af1296e8a21a406b4f4c4f1e1365e075071219f3
F src/cursor.c f883813759742068890b1f699335872bfa8fdf41
F src/tclsqlite.c 354d3e4525c7b29c8f50b1a0125d55c63c916fbc
F src/test1.c b7d94c54e58f95452387a5cabdf98b2be8059f29
F src/test2.c b11fa244fff02190707dd0879987c37c75e61fc8
-F src/test3.c 11082b094eb42b3f9a9d5f4e77b6d98aeb2f00b1
+F src/test3.c a72f20066cccd5a7b9f20b7b78fa9b05b47b3020
F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df
F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5
F src/tokenize.c 2ad3d1ae1a0a70746db0b31a0a74f58050a3c39a
F src/utf.c e45ce11be6922408cd381561721f6cca7d3b992a
F src/util.c 29f43c4a7b9ff29302f7899f793be6836b6cd7f9
F src/vacuum.c 1a9db113a027461daaf44724c71dd1ebbd064203
-F src/vdbe.c 789e3c986ff311ca371adaad24baa65e42e0b029
+F src/vdbe.c 53520958a7d63eaf138fa78f69efe225d502a9bf
F src/vdbe.h 067ca8d6750ba4f69a50284765e5883dee860181
F src/vdbeInt.h 0f74561e629af86172de7cdf0ecaea014c51696c
F src/vdbeapi.c 0cf3bdc1072616bedc8eec7fc22e3f5a169d33fd
F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747
F test/bind.test 3635ddfe0fb15ecfd158708feff6ef707e15c0a9
F test/blob.test fc41fe95bdc10da51f0dee73ce86e75ce1d6eb9d
-F test/btree.test 7ae2c9dde6c9fffd61b96efe28f9e28b396ddd78
+F test/btree.test ff754a2e68af75396fbbf8dfda009b4b93f086a6
F test/btree2.test aa4a6d05b1ea90b1acaf83ba89039dd302a88635
F test/btree4.test 3797b4305694c7af6828675b0f4b1424b8ca30e4
F test/btree5.test 8e5ff32c02e685d36516c6499add9375fe1377f2
F test/insert2.test 0bb50ff999e35a21549d8ee5dc44db8ac24d31a7
F test/interrupt.test 0aa230f8aedec0ad7caaf5edaced337e4cfb3820
F test/intpkey.test b57cf5236fde1bd8cbc1388fa0c91908f6fd9194
-F test/ioerr.test 90ccd62d50fbbaa990ccd544720a7b9dd10becd3
+F test/ioerr.test fd283e768301b26bc148012ea6ebea4c2295aa20
F test/join.test ea8c77b9fbc377fe553cdb5ce5f1bd72021dca5d
F test/join2.test c97e4c5aa65dea462145529e58212a709b4722b8
F test/join3.test 67dc0d7c8dab3fff25796d0f3c3fd9c999aeded3
F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618
F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0
F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746
-P 6c7bec1b3aee0287e30f43c1d6a7b67b1c47e774
-R 7068bc64df143e31a5d1b0a4a0ebbc69
+P 5b7a5a4d69be425163135698d889797d15f56492
+R 8f87d57733bba8a8bebba0892812901d
U danielk1977
-Z 5c1fa24d0389e66faa5fc6c7963ab21a
+Z 23146f967500dcd597b4ae335d7f01e0
-5b7a5a4d69be425163135698d889797d15f56492
\ No newline at end of file
+a461988661368bce799ef3d498a18e88559e14c7
\ No newline at end of file
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.228 2005/01/08 15:43:19 drh Exp $
+** $Id: btree.c,v 1.229 2005/01/10 12:59:52 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
}
+/*
+** Move the open database page pDbPage to location iFreePage in the
+** database. The pDbPage reference remains valid.
+*/
static int relocatePage(
- Btree *pBt,
- MemPage *pDbPage,
- u8 eType,
- Pgno iPtrPage,
- Pgno iFreePage
+ Btree *pBt, /* Btree */
+ MemPage *pDbPage, /* Open page to move */
+ u8 eType, /* Pointer map 'type' entry for pDbPage */
+ Pgno iPtrPage, /* Pointer map 'page-no' entry for pDbPage */
+ Pgno iFreePage /* The location to move pDbPage to */
){
MemPage *pPtrPage; /* The page that contains a pointer to pDbPage */
Pgno iDbPage = pDbPage->pgno;
int pc = get2byte(&data[cellStart+i*2]);
int size = cellSizePtr(pPage, &data[pc]);
int j;
- for(j=pc+size-1; j>=pc; j--) hit[j]++;
+ if( (pc+size-1)>=usableSize || pc<0 ){
+ checkAppendMsg(pCheck, 0,
+ "Corruption detected in cell %d on page %d",i,iPage,0);
+ }else{
+ for(j=pc+size-1; j>=pc; j--) hit[j]++;
+ }
}
for(cnt=0, i=get2byte(&data[hdr+1]); i>0 && i<usableSize && cnt<10000;
cnt++){
int size = get2byte(&data[i+2]);
int j;
- for(j=i+size-1; j>=i; j--) hit[j]++;
+ if( (i+size-1)>=usableSize || i<0 ){
+ checkAppendMsg(pCheck, 0,
+ "Corruption detected in cell %d on page %d",i,iPage,0);
+ }else{
+ for(j=i+size-1; j>=i; j--) hit[j]++;
+ }
i = get2byte(&data[i]);
}
for(i=cnt=0; i<usableSize; i++){
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test3.c,v 1.58 2005/01/08 12:42:39 danielk1977 Exp $
+** $Id: test3.c,v 1.59 2005/01/10 12:59:53 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
}
/*
-** Usage: btree_data ID
+** Usage: btree_data ID ?N?
**
** Return the data for the entry at which the cursor is pointing.
*/
u32 n;
char *zBuf;
- if( argc!=2 ){
+ if( argc!=2 && argc!=3 ){
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" ID\"", 0);
return TCL_ERROR;
}
pCur = sqlite3TextToPtr(argv[1]);
- sqlite3BtreeDataSize(pCur, &n);
+ if( argc==2 ){
+ sqlite3BtreeDataSize(pCur, &n);
+ }else{
+ n = atoi(argv[2]);
+ }
zBuf = malloc( n+1 );
rc = sqlite3BtreeData(pCur, 0, n, zBuf);
if( rc ){
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
-** $Id: vdbe.c,v 1.436 2005/01/07 01:56:17 danielk1977 Exp $
+** $Id: vdbe.c,v 1.437 2005/01/10 12:59:53 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
zData = &zRec[aOffset[p2]];
}else{
len = sqlite3VdbeSerialTypeLen(aType[p2]);
- sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, pC->keyAsData, &sMem);
+ rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, pC->keyAsData, &sMem);
+ if( rc!=SQLITE_OK ){
+ goto abort_due_to_error;
+ }
zData = sMem.z;
}
sqlite3VdbeSerialGet(zData, aType[p2], pTos);
# This file implements regression tests for SQLite library. The
# focus of this script is btree database backend
#
-# $Id: btree.test,v 1.33 2004/11/10 15:27:38 danielk1977 Exp $
+# $Id: btree.test,v 1.34 2005/01/10 12:59:53 danielk1977 Exp $
set testdir [file dirname $argv0]
} {0}
btree_pager_ref_dump $::b1
+# Miscellaneous tests.
+#
+# btree-16.1 - Check that a statement cannot be started if a transaction is not
+# active.
+do_test btree-16.1 {
+ catch {btree_begin_statement $::b1} msg
+ set msg
+} SQLITE_ERROR
+
+do_test btree-16.2 {
+ btree_begin_transaction $::b1
+ set ::c1 [btree_cursor $::b1 2 1]
+ btree_insert $::c1 1 helloworld
+ btree_close_cursor $::c1
+ btree_commit $::b1
+} {}
+do_test btree-16.3 {
+ set ::c1 [btree_cursor $::b1 2 1]
+ btree_first $::c1
+} 0
+do_test btree-16.4 {
+ catch {btree_data $::c1 [expr [btree_payload_size $::c1] + 10]} msg
+ set msg
+} SQLITE_ERROR
+
do_test btree-99.1 {
btree_close $::b1
} {}
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
-# $Id: ioerr.test,v 1.7 2005/01/08 02:35:44 danielk1977 Exp $
+# $Id: ioerr.test,v 1.8 2005/01/10 12:59:53 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+set ::AV [execsql {pragma auto_vacuum}]
+
set ::go 1
for {set n 1} {$go} {incr n} {
# file when the file on disk is only 1 page. The pager layer detects that
# this has happened and suppresses the error returned by the OS layer.
#
- ifcapable default_autovacuum {
+ if {$::AV} {
if {$n==8} continue
}
set ::go 1
for {set n 1} {$go} {incr n} {
+ if {$n==24} breakpoint
do_test ioerr-2.$n.1 {
set ::sqlite_io_error_pending 0
db close
INSERT INTO t1 SELECT a+32, b||'-'||rowid, c||'-'||rowid FROM t1;
INSERT INTO t1 SELECT a+64, b||'-'||rowid, c||'-'||rowid FROM t1;
INSERT INTO t1 SELECT a+128, b||'-'||rowid, c||'-'||rowid FROM t1;
+ INSERT INTO t1 VALUES(1, randstr(600,600), randstr(600,600));
CREATE TABLE t2 AS SELECT * FROM t1;
CREATE TABLE t3 AS SELECT * FROM t1;
COMMIT;