/ 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 Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree.c,v 1.99 2004/02/10 01:54:28 drh Exp $
           12  +** $Id: btree.c,v 1.100 2004/02/10 02:57:59 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** For a detailed discussion of BTrees, refer to
    16     16   **
    17     17   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    18     18   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    19     19   **     Publishing Company, Reading, Massachusetts.
................................................................................
  3135   3135     }
  3136   3136     aResult[5] = cnt;
  3137   3137     aResult[7] = SWAB32(pBt, pPage->u.hdr.rightChild);
  3138   3138     return SQLITE_OK;
  3139   3139   }
  3140   3140   #endif
  3141   3141   
  3142         -#ifdef SQLITE_TEST
  3143   3142   /*
  3144   3143   ** Return the pager associated with a BTree.  This routine is used for
  3145   3144   ** testing and debugging only.
  3146   3145   */
  3147   3146   static Pager *fileBtreePager(Btree *pBt){
  3148   3147     return pBt->pPager;
  3149   3148   }
  3150         -#endif
  3151   3149   
  3152   3150   /*
  3153   3151   ** This structure is passed around through all the sanity checking routines
  3154   3152   ** in order to keep track of some global state information.
  3155   3153   */
  3156   3154   typedef struct IntegrityCk IntegrityCk;
  3157   3155   struct IntegrityCk {
................................................................................
  3551   3549       fileBtreeClearTable,
  3552   3550       fileBtreeCursor,
  3553   3551       fileBtreeGetMeta,
  3554   3552       fileBtreeUpdateMeta,
  3555   3553       fileBtreeIntegrityCheck,
  3556   3554       fileBtreeGetFilename,
  3557   3555       fileBtreeCopyFile,
         3556  +    fileBtreePager,
  3558   3557   #ifdef SQLITE_TEST
  3559   3558       fileBtreePageDump,
  3560         -    fileBtreePager
  3561   3559   #endif
  3562   3560   };
  3563   3561   static BtCursorOps sqliteBtreeCursorOps = {
  3564   3562       fileBtreeMoveto,
  3565   3563       fileBtreeDelete,
  3566   3564       fileBtreeInsert,
  3567   3565       fileBtreeFirst,

Changes to src/btree.h.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This header file defines the interface that the sqlite B-Tree file
    13     13   ** subsystem.  See comments in the source code for a detailed description
    14     14   ** of what each interface routine does.
    15     15   **
    16         -** @(#) $Id: btree.h,v 1.35 2003/06/01 01:10:33 drh Exp $
           16  +** @(#) $Id: btree.h,v 1.36 2004/02/10 02:57:59 drh Exp $
    17     17   */
    18     18   #ifndef _BTREE_H_
    19     19   #define _BTREE_H_
    20     20   
    21     21   /*
    22     22   ** Forward declarations of structure
    23     23   */
................................................................................
    53     53       int (*ClearTable)(Btree*, int);
    54     54       int (*Cursor)(Btree*, int iTable, int wrFlag, BtCursor **ppCur);
    55     55       int (*GetMeta)(Btree*, int*);
    56     56       int (*UpdateMeta)(Btree*, int*);
    57     57       char *(*IntegrityCheck)(Btree*, int*, int);
    58     58       const char *(*GetFilename)(Btree*);
    59     59       int (*Copyfile)(Btree*,Btree*);
           60  +    struct Pager *(*Pager)(Btree*);
    60     61   #ifdef SQLITE_TEST
    61     62       int (*PageDump)(Btree*, int, int);
    62         -    struct Pager *(*Pager)(Btree*);
    63     63   #endif
    64     64   };
    65     65   
    66     66   /*
    67     67   ** An instance of this structure defines all of the methods that can
    68     68   ** be executed against a cursor.
    69     69   */
................................................................................
   138    138   #define sqliteBtreeCloseCursor(pCur)      (btCOps(pCur)->CloseCursor(pCur))
   139    139   #define sqliteBtreeGetMeta(pBt, aMeta)    (btOps(pBt)->GetMeta(pBt, aMeta))
   140    140   #define sqliteBtreeUpdateMeta(pBt, aMeta) (btOps(pBt)->UpdateMeta(pBt, aMeta))
   141    141   #define sqliteBtreeIntegrityCheck(pBt, aRoot, nRoot)\
   142    142                   (btOps(pBt)->IntegrityCheck(pBt, aRoot, nRoot))
   143    143   #define sqliteBtreeGetFilename(pBt)       (btOps(pBt)->GetFilename(pBt))
   144    144   #define sqliteBtreeCopyFile(pBt1, pBt2)   (btOps(pBt1)->Copyfile(pBt1, pBt2))
          145  +#define sqliteBtreePager(pBt)             (btOps(pBt)->Pager(pBt))
   145    146   
   146    147   #ifdef SQLITE_TEST
   147    148   #define sqliteBtreePageDump(pBt, pgno, recursive)\
   148    149                   (btOps(pBt)->PageDump(pBt, pgno, recursive))
   149    150   #define sqliteBtreeCursorDump(pCur, aResult)\
   150    151                   (btCOps(pCur)->CursorDump(pCur, aResult))
   151         -#define sqliteBtreePager(pBt)             (btOps(pBt)->Pager(pBt))
   152    152   int btree_native_byte_order;
   153    153   #endif /* SQLITE_TEST */
   154    154   
   155    155   
   156    156   #endif /* _BTREE_H_ */

Changes to src/btree_rb.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12         -** $Id: btree_rb.c,v 1.20 2004/01/12 00:38:18 drh Exp $
           12  +** $Id: btree_rb.c,v 1.21 2004/02/10 02:57:59 drh Exp $
    13     13   **
    14     14   ** This file implements an in-core database using Red-Black balanced
    15     15   ** binary trees.
    16     16   ** 
    17     17   ** It was contributed to SQLite by anonymous on 2003-Feb-04 23:24:49 UTC.
    18     18   */
    19     19   #include "btree.h"
................................................................................
  1417   1417   }
  1418   1418   
  1419   1419   static int memRbtreeCursorDump(RbtCursor* pCur, int* aRes)
  1420   1420   {
  1421   1421     assert(!"Cannot call sqliteRbtreeCursorDump");
  1422   1422     return SQLITE_OK;
  1423   1423   }
         1424  +#endif
  1424   1425   
  1425   1426   static struct Pager *memRbtreePager(Rbtree* tree)
  1426   1427   {
  1427   1428     assert(!"Cannot call sqliteRbtreePager");
  1428   1429     return SQLITE_OK;
  1429   1430   }
  1430         -#endif
  1431   1431   
  1432   1432   /*
  1433   1433   ** Return the full pathname of the underlying database file.
  1434   1434   */
  1435   1435   static const char *memRbtreeGetFilename(Rbtree *pBt){
  1436   1436     return 0;  /* A NULL return indicates there is no underlying file */
  1437   1437   }
................................................................................
  1459   1459       (int(*)(Btree*,int)) memRbtreeClearTable,
  1460   1460       (int(*)(Btree*,int,int,BtCursor**)) memRbtreeCursor,
  1461   1461       (int(*)(Btree*,int*)) memRbtreeGetMeta,
  1462   1462       (int(*)(Btree*,int*)) memRbtreeUpdateMeta,
  1463   1463       (char*(*)(Btree*,int*,int)) memRbtreeIntegrityCheck,
  1464   1464       (const char*(*)(Btree*)) memRbtreeGetFilename,
  1465   1465       (int(*)(Btree*,Btree*)) memRbtreeCopyFile,
  1466         -
         1466  +    (struct Pager*(*)(Btree*)) memRbtreePager,
  1467   1467   #ifdef SQLITE_TEST
  1468   1468       (int(*)(Btree*,int,int)) memRbtreePageDump,
  1469         -    (struct Pager*(*)(Btree*)) memRbtreePager
  1470   1469   #endif
  1471   1470   };
  1472   1471   
  1473   1472   static BtCursorOps sqliteRbtreeCursorOps = {
  1474   1473       (int(*)(BtCursor*,const void*,int,int*)) memRbtreeMoveto,
  1475   1474       (int(*)(BtCursor*)) memRbtreeDelete,
  1476   1475       (int(*)(BtCursor*,const void*,int,const void*,int)) memRbtreeInsert,

Changes to src/shell.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code to implement the "sqlite" command line
    13     13   ** utility for accessing SQLite databases.
    14     14   **
    15         -** $Id: shell.c,v 1.84 2004/02/01 01:22:51 drh Exp $
           15  +** $Id: shell.c,v 1.85 2004/02/10 02:57:59 drh Exp $
    16     16   */
    17     17   #include <stdlib.h>
    18     18   #include <string.h>
    19     19   #include <stdio.h>
    20     20   #include "sqlite.h"
    21     21   #include <ctype.h>
    22     22   
................................................................................
  1166   1166   */
  1167   1167   static const char zOptions[] = 
  1168   1168     "   -init filename       read/process named file\n"
  1169   1169     "   -echo                print commands before execution\n"
  1170   1170     "   -[no]header          turn headers on or off\n"
  1171   1171     "   -column              set output mode to 'column'\n"
  1172   1172     "   -html                set output mode to HTML\n"
         1173  +#ifdef SQLITE_HAS_CRYPTO
         1174  +  "   -key KEY             encryption key\n"
         1175  +#endif                 
  1173   1176     "   -line                set output mode to 'line'\n"
  1174   1177     "   -list                set output mode to 'list'\n"
  1175   1178     "   -separator 'x'       set output field separator (|)\n"
  1176   1179     "   -nullvalue 'text'    set text string for NULL values\n"
  1177   1180     "   -version             show SQLite version\n"
  1178   1181     "   -help                show this text, also show dot-commands\n"
  1179   1182   ;