/ Check-in [9c6b4758]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make the pager accessible from the btree structure always, not just during debugging. (CVS 1219)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9c6b4758a4b13a91f71be17751a76c0c14b4d4c3
User & Date: drh 2004-02-10 02:57:59
Context
2004-02-10
13:19
Fix for ticket #603. (CVS 1220) check-in: d0624d25 user: drh tags: trunk
02:57
Make the pager accessible from the btree structure always, not just during debugging. (CVS 1219) check-in: 9c6b4758 user: drh tags: trunk
02:27
Move the file-format-2 to file-format-3 conversion into sqliteInit(). (CVS 1218) check-in: dcbe2800 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
....
3551
3552
3553
3554
3555
3556
3557

3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
** 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.
**
*************************************************************************
** $Id: btree.c,v 1.99 2004/02/10 01:54:28 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
  }
  aResult[5] = cnt;
  aResult[7] = SWAB32(pBt, pPage->u.hdr.rightChild);
  return SQLITE_OK;
}
#endif

#ifdef SQLITE_TEST
/*
** Return the pager associated with a BTree.  This routine is used for
** testing and debugging only.
*/
static Pager *fileBtreePager(Btree *pBt){
  return pBt->pPager;
}
#endif

/*
** This structure is passed around through all the sanity checking routines
** in order to keep track of some global state information.
*/
typedef struct IntegrityCk IntegrityCk;
struct IntegrityCk {
................................................................................
    fileBtreeClearTable,
    fileBtreeCursor,
    fileBtreeGetMeta,
    fileBtreeUpdateMeta,
    fileBtreeIntegrityCheck,
    fileBtreeGetFilename,
    fileBtreeCopyFile,

#ifdef SQLITE_TEST
    fileBtreePageDump,
    fileBtreePager
#endif
};
static BtCursorOps sqliteBtreeCursorOps = {
    fileBtreeMoveto,
    fileBtreeDelete,
    fileBtreeInsert,
    fileBtreeFirst,







|







 







<







<







 







>


<







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
3135
3136
3137
3138
3139
3140
3141

3142
3143
3144
3145
3146
3147
3148

3149
3150
3151
3152
3153
3154
3155
....
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558

3559
3560
3561
3562
3563
3564
3565
** 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.
**
*************************************************************************
** $Id: btree.c,v 1.100 2004/02/10 02:57:59 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
................................................................................
  }
  aResult[5] = cnt;
  aResult[7] = SWAB32(pBt, pPage->u.hdr.rightChild);
  return SQLITE_OK;
}
#endif


/*
** Return the pager associated with a BTree.  This routine is used for
** testing and debugging only.
*/
static Pager *fileBtreePager(Btree *pBt){
  return pBt->pPager;
}


/*
** This structure is passed around through all the sanity checking routines
** in order to keep track of some global state information.
*/
typedef struct IntegrityCk IntegrityCk;
struct IntegrityCk {
................................................................................
    fileBtreeClearTable,
    fileBtreeCursor,
    fileBtreeGetMeta,
    fileBtreeUpdateMeta,
    fileBtreeIntegrityCheck,
    fileBtreeGetFilename,
    fileBtreeCopyFile,
    fileBtreePager,
#ifdef SQLITE_TEST
    fileBtreePageDump,

#endif
};
static BtCursorOps sqliteBtreeCursorOps = {
    fileBtreeMoveto,
    fileBtreeDelete,
    fileBtreeInsert,
    fileBtreeFirst,

Changes to src/btree.h.

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
53
54
55
56
57
58
59

60
61
62
63
64
65
66
67
68
69
...
138
139
140
141
142
143
144

145
146
147
148
149
150
151
152
153
154
155
156
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem.  See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.35 2003/06/01 01:10:33 drh Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_

/*
** Forward declarations of structure
*/
................................................................................
    int (*ClearTable)(Btree*, int);
    int (*Cursor)(Btree*, int iTable, int wrFlag, BtCursor **ppCur);
    int (*GetMeta)(Btree*, int*);
    int (*UpdateMeta)(Btree*, int*);
    char *(*IntegrityCheck)(Btree*, int*, int);
    const char *(*GetFilename)(Btree*);
    int (*Copyfile)(Btree*,Btree*);

#ifdef SQLITE_TEST
    int (*PageDump)(Btree*, int, int);
    struct Pager *(*Pager)(Btree*);
#endif
};

/*
** An instance of this structure defines all of the methods that can
** be executed against a cursor.
*/
................................................................................
#define sqliteBtreeCloseCursor(pCur)      (btCOps(pCur)->CloseCursor(pCur))
#define sqliteBtreeGetMeta(pBt, aMeta)    (btOps(pBt)->GetMeta(pBt, aMeta))
#define sqliteBtreeUpdateMeta(pBt, aMeta) (btOps(pBt)->UpdateMeta(pBt, aMeta))
#define sqliteBtreeIntegrityCheck(pBt, aRoot, nRoot)\
                (btOps(pBt)->IntegrityCheck(pBt, aRoot, nRoot))
#define sqliteBtreeGetFilename(pBt)       (btOps(pBt)->GetFilename(pBt))
#define sqliteBtreeCopyFile(pBt1, pBt2)   (btOps(pBt1)->Copyfile(pBt1, pBt2))


#ifdef SQLITE_TEST
#define sqliteBtreePageDump(pBt, pgno, recursive)\
                (btOps(pBt)->PageDump(pBt, pgno, recursive))
#define sqliteBtreeCursorDump(pCur, aResult)\
                (btCOps(pCur)->CursorDump(pCur, aResult))
#define sqliteBtreePager(pBt)             (btOps(pBt)->Pager(pBt))
int btree_native_byte_order;
#endif /* SQLITE_TEST */


#endif /* _BTREE_H_ */







|







 







>


<







 







>






<





9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
53
54
55
56
57
58
59
60
61
62

63
64
65
66
67
68
69
...
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152
153
154
155
156
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem.  See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.36 2004/02/10 02:57:59 drh Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_

/*
** Forward declarations of structure
*/
................................................................................
    int (*ClearTable)(Btree*, int);
    int (*Cursor)(Btree*, int iTable, int wrFlag, BtCursor **ppCur);
    int (*GetMeta)(Btree*, int*);
    int (*UpdateMeta)(Btree*, int*);
    char *(*IntegrityCheck)(Btree*, int*, int);
    const char *(*GetFilename)(Btree*);
    int (*Copyfile)(Btree*,Btree*);
    struct Pager *(*Pager)(Btree*);
#ifdef SQLITE_TEST
    int (*PageDump)(Btree*, int, int);

#endif
};

/*
** An instance of this structure defines all of the methods that can
** be executed against a cursor.
*/
................................................................................
#define sqliteBtreeCloseCursor(pCur)      (btCOps(pCur)->CloseCursor(pCur))
#define sqliteBtreeGetMeta(pBt, aMeta)    (btOps(pBt)->GetMeta(pBt, aMeta))
#define sqliteBtreeUpdateMeta(pBt, aMeta) (btOps(pBt)->UpdateMeta(pBt, aMeta))
#define sqliteBtreeIntegrityCheck(pBt, aRoot, nRoot)\
                (btOps(pBt)->IntegrityCheck(pBt, aRoot, nRoot))
#define sqliteBtreeGetFilename(pBt)       (btOps(pBt)->GetFilename(pBt))
#define sqliteBtreeCopyFile(pBt1, pBt2)   (btOps(pBt1)->Copyfile(pBt1, pBt2))
#define sqliteBtreePager(pBt)             (btOps(pBt)->Pager(pBt))

#ifdef SQLITE_TEST
#define sqliteBtreePageDump(pBt, pgno, recursive)\
                (btOps(pBt)->PageDump(pBt, pgno, recursive))
#define sqliteBtreeCursorDump(pCur, aResult)\
                (btCOps(pCur)->CursorDump(pCur, aResult))

int btree_native_byte_order;
#endif /* SQLITE_TEST */


#endif /* _BTREE_H_ */

Changes to src/btree_rb.c.

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
1417
1418
1419
1420
1421
1422
1423

1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
....
1459
1460
1461
1462
1463
1464
1465
1466

1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
** 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.
**
*************************************************************************
** $Id: btree_rb.c,v 1.20 2004/01/12 00:38:18 drh Exp $
**
** This file implements an in-core database using Red-Black balanced
** binary trees.
** 
** It was contributed to SQLite by anonymous on 2003-Feb-04 23:24:49 UTC.
*/
#include "btree.h"
................................................................................
}

static int memRbtreeCursorDump(RbtCursor* pCur, int* aRes)
{
  assert(!"Cannot call sqliteRbtreeCursorDump");
  return SQLITE_OK;
}


static struct Pager *memRbtreePager(Rbtree* tree)
{
  assert(!"Cannot call sqliteRbtreePager");
  return SQLITE_OK;
}
#endif

/*
** Return the full pathname of the underlying database file.
*/
static const char *memRbtreeGetFilename(Rbtree *pBt){
  return 0;  /* A NULL return indicates there is no underlying file */
}
................................................................................
    (int(*)(Btree*,int)) memRbtreeClearTable,
    (int(*)(Btree*,int,int,BtCursor**)) memRbtreeCursor,
    (int(*)(Btree*,int*)) memRbtreeGetMeta,
    (int(*)(Btree*,int*)) memRbtreeUpdateMeta,
    (char*(*)(Btree*,int*,int)) memRbtreeIntegrityCheck,
    (const char*(*)(Btree*)) memRbtreeGetFilename,
    (int(*)(Btree*,Btree*)) memRbtreeCopyFile,


#ifdef SQLITE_TEST
    (int(*)(Btree*,int,int)) memRbtreePageDump,
    (struct Pager*(*)(Btree*)) memRbtreePager
#endif
};

static BtCursorOps sqliteRbtreeCursorOps = {
    (int(*)(BtCursor*,const void*,int,int*)) memRbtreeMoveto,
    (int(*)(BtCursor*)) memRbtreeDelete,
    (int(*)(BtCursor*,const void*,int,const void*,int)) memRbtreeInsert,







|







 







>






<







 







<
>


<







5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
....
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430

1431
1432
1433
1434
1435
1436
1437
....
1459
1460
1461
1462
1463
1464
1465

1466
1467
1468

1469
1470
1471
1472
1473
1474
1475
** 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.
**
*************************************************************************
** $Id: btree_rb.c,v 1.21 2004/02/10 02:57:59 drh Exp $
**
** This file implements an in-core database using Red-Black balanced
** binary trees.
** 
** It was contributed to SQLite by anonymous on 2003-Feb-04 23:24:49 UTC.
*/
#include "btree.h"
................................................................................
}

static int memRbtreeCursorDump(RbtCursor* pCur, int* aRes)
{
  assert(!"Cannot call sqliteRbtreeCursorDump");
  return SQLITE_OK;
}
#endif

static struct Pager *memRbtreePager(Rbtree* tree)
{
  assert(!"Cannot call sqliteRbtreePager");
  return SQLITE_OK;
}


/*
** Return the full pathname of the underlying database file.
*/
static const char *memRbtreeGetFilename(Rbtree *pBt){
  return 0;  /* A NULL return indicates there is no underlying file */
}
................................................................................
    (int(*)(Btree*,int)) memRbtreeClearTable,
    (int(*)(Btree*,int,int,BtCursor**)) memRbtreeCursor,
    (int(*)(Btree*,int*)) memRbtreeGetMeta,
    (int(*)(Btree*,int*)) memRbtreeUpdateMeta,
    (char*(*)(Btree*,int*,int)) memRbtreeIntegrityCheck,
    (const char*(*)(Btree*)) memRbtreeGetFilename,
    (int(*)(Btree*,Btree*)) memRbtreeCopyFile,

    (struct Pager*(*)(Btree*)) memRbtreePager,
#ifdef SQLITE_TEST
    (int(*)(Btree*,int,int)) memRbtreePageDump,

#endif
};

static BtCursorOps sqliteRbtreeCursorOps = {
    (int(*)(BtCursor*,const void*,int,int*)) memRbtreeMoveto,
    (int(*)(BtCursor*)) memRbtreeDelete,
    (int(*)(BtCursor*,const void*,int,const void*,int)) memRbtreeInsert,

Changes to src/shell.c.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1166
1167
1168
1169
1170
1171
1172



1173
1174
1175
1176
1177
1178
1179
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.84 2004/02/01 01:22:51 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
*/
static const char zOptions[] = 
  "   -init filename       read/process named file\n"
  "   -echo                print commands before execution\n"
  "   -[no]header          turn headers on or off\n"
  "   -column              set output mode to 'column'\n"
  "   -html                set output mode to HTML\n"



  "   -line                set output mode to 'line'\n"
  "   -list                set output mode to 'list'\n"
  "   -separator 'x'       set output field separator (|)\n"
  "   -nullvalue 'text'    set text string for NULL values\n"
  "   -version             show SQLite version\n"
  "   -help                show this text, also show dot-commands\n"
;







|







 







>
>
>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
....
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.85 2004/02/10 02:57:59 drh Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "sqlite.h"
#include <ctype.h>

................................................................................
*/
static const char zOptions[] = 
  "   -init filename       read/process named file\n"
  "   -echo                print commands before execution\n"
  "   -[no]header          turn headers on or off\n"
  "   -column              set output mode to 'column'\n"
  "   -html                set output mode to HTML\n"
#ifdef SQLITE_HAS_CRYPTO
  "   -key KEY             encryption key\n"
#endif                 
  "   -line                set output mode to 'line'\n"
  "   -list                set output mode to 'list'\n"
  "   -separator 'x'       set output field separator (|)\n"
  "   -nullvalue 'text'    set text string for NULL values\n"
  "   -version             show SQLite version\n"
  "   -help                show this text, also show dot-commands\n"
;