extensions/sqlite/sqlite-source/btree.h
changeset 1203 633c25ce6405
child 1645 27307df4d711
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/extensions/sqlite/sqlite-source/btree.h	Sun Jul 29 01:15:31 2007 +0000
     1.3 @@ -0,0 +1,149 @@
     1.4 +/*
     1.5 +** 2001 September 15
     1.6 +**
     1.7 +** The author disclaims copyright to this source code.  In place of
     1.8 +** a legal notice, here is a blessing:
     1.9 +**
    1.10 +**    May you do good and not evil.
    1.11 +**    May you find forgiveness for yourself and forgive others.
    1.12 +**    May you share freely, never taking more than you give.
    1.13 +**
    1.14 +*************************************************************************
    1.15 +** This header file defines the interface that the sqlite B-Tree file
    1.16 +** subsystem.  See comments in the source code for a detailed description
    1.17 +** of what each interface routine does.
    1.18 +**
    1.19 +** @(#) $Id$
    1.20 +*/
    1.21 +#ifndef _BTREE_H_
    1.22 +#define _BTREE_H_
    1.23 +
    1.24 +/* TODO: This definition is just included so other modules compile. It
    1.25 +** needs to be revisited.
    1.26 +*/
    1.27 +#define SQLITE_N_BTREE_META 10
    1.28 +
    1.29 +/*
    1.30 +** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
    1.31 +** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
    1.32 +*/
    1.33 +#ifndef SQLITE_DEFAULT_AUTOVACUUM
    1.34 +  #define SQLITE_DEFAULT_AUTOVACUUM 0
    1.35 +#endif
    1.36 +
    1.37 +#define BTREE_AUTOVACUUM_NONE 0        /* Do not do auto-vacuum */
    1.38 +#define BTREE_AUTOVACUUM_FULL 1        /* Do full auto-vacuum */
    1.39 +#define BTREE_AUTOVACUUM_INCR 2        /* Incremental vacuum */
    1.40 +
    1.41 +/*
    1.42 +** Forward declarations of structure
    1.43 +*/
    1.44 +typedef struct Btree Btree;
    1.45 +typedef struct BtCursor BtCursor;
    1.46 +typedef struct BtShared BtShared;
    1.47 +
    1.48 +
    1.49 +int sqlite3BtreeOpen(
    1.50 +  const char *zFilename,   /* Name of database file to open */
    1.51 +  sqlite3 *db,             /* Associated database connection */
    1.52 +  Btree **,                /* Return open Btree* here */
    1.53 +  int flags                /* Flags */
    1.54 +);
    1.55 +
    1.56 +/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the
    1.57 +** following values.
    1.58 +**
    1.59 +** NOTE:  These values must match the corresponding PAGER_ values in
    1.60 +** pager.h.
    1.61 +*/
    1.62 +#define BTREE_OMIT_JOURNAL  1  /* Do not use journal.  No argument */
    1.63 +#define BTREE_NO_READLOCK   2  /* Omit readlocks on readonly files */
    1.64 +#define BTREE_MEMORY        4  /* In-memory DB.  No argument */
    1.65 +
    1.66 +int sqlite3BtreeClose(Btree*);
    1.67 +int sqlite3BtreeSetBusyHandler(Btree*,BusyHandler*);
    1.68 +int sqlite3BtreeSetCacheSize(Btree*,int);
    1.69 +int sqlite3BtreeSetSafetyLevel(Btree*,int,int);
    1.70 +int sqlite3BtreeSyncDisabled(Btree*);
    1.71 +int sqlite3BtreeSetPageSize(Btree*,int,int);
    1.72 +int sqlite3BtreeGetPageSize(Btree*);
    1.73 +int sqlite3BtreeMaxPageCount(Btree*,int);
    1.74 +int sqlite3BtreeGetReserve(Btree*);
    1.75 +int sqlite3BtreeSetAutoVacuum(Btree *, int);
    1.76 +int sqlite3BtreeGetAutoVacuum(Btree *);
    1.77 +int sqlite3BtreeBeginTrans(Btree*,int);
    1.78 +int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
    1.79 +int sqlite3BtreeCommitPhaseTwo(Btree*);
    1.80 +int sqlite3BtreeCommit(Btree*);
    1.81 +int sqlite3BtreeRollback(Btree*);
    1.82 +int sqlite3BtreeBeginStmt(Btree*);
    1.83 +int sqlite3BtreeCommitStmt(Btree*);
    1.84 +int sqlite3BtreeRollbackStmt(Btree*);
    1.85 +int sqlite3BtreeCreateTable(Btree*, int*, int flags);
    1.86 +int sqlite3BtreeIsInTrans(Btree*);
    1.87 +int sqlite3BtreeIsInStmt(Btree*);
    1.88 +int sqlite3BtreeIsInReadTrans(Btree*);
    1.89 +void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
    1.90 +int sqlite3BtreeSchemaLocked(Btree *);
    1.91 +int sqlite3BtreeLockTable(Btree *, int, u8);
    1.92 +
    1.93 +const char *sqlite3BtreeGetFilename(Btree *);
    1.94 +const char *sqlite3BtreeGetDirname(Btree *);
    1.95 +const char *sqlite3BtreeGetJournalname(Btree *);
    1.96 +int sqlite3BtreeCopyFile(Btree *, Btree *);
    1.97 +
    1.98 +int sqlite3BtreeIncrVacuum(Btree *);
    1.99 +
   1.100 +/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR
   1.101 +** of the following flags:
   1.102 +*/
   1.103 +#define BTREE_INTKEY     1    /* Table has only 64-bit signed integer keys */
   1.104 +#define BTREE_ZERODATA   2    /* Table has keys only - no data */
   1.105 +#define BTREE_LEAFDATA   4    /* Data stored in leaves only.  Implies INTKEY */
   1.106 +
   1.107 +int sqlite3BtreeDropTable(Btree*, int, int*);
   1.108 +int sqlite3BtreeClearTable(Btree*, int);
   1.109 +int sqlite3BtreeGetMeta(Btree*, int idx, u32 *pValue);
   1.110 +int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
   1.111 +
   1.112 +int sqlite3BtreeCursor(
   1.113 +  Btree*,                              /* BTree containing table to open */
   1.114 +  int iTable,                          /* Index of root page */
   1.115 +  int wrFlag,                          /* 1 for writing.  0 for read-only */
   1.116 +  int(*)(void*,int,const void*,int,const void*),  /* Key comparison function */
   1.117 +  void*,                               /* First argument to compare function */
   1.118 +  BtCursor **ppCursor                  /* Returned cursor */
   1.119 +);
   1.120 +
   1.121 +int sqlite3BtreeCloseCursor(BtCursor*);
   1.122 +int sqlite3BtreeMoveto(BtCursor*,const void *pKey,i64 nKey,int bias,int *pRes);
   1.123 +int sqlite3BtreeDelete(BtCursor*);
   1.124 +int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,
   1.125 +                                  const void *pData, int nData,
   1.126 +                                  int nZero, int bias);
   1.127 +int sqlite3BtreeFirst(BtCursor*, int *pRes);
   1.128 +int sqlite3BtreeLast(BtCursor*, int *pRes);
   1.129 +int sqlite3BtreeNext(BtCursor*, int *pRes);
   1.130 +int sqlite3BtreeEof(BtCursor*);
   1.131 +int sqlite3BtreeFlags(BtCursor*);
   1.132 +int sqlite3BtreePrevious(BtCursor*, int *pRes);
   1.133 +int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
   1.134 +int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
   1.135 +const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
   1.136 +const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
   1.137 +int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
   1.138 +int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
   1.139 +
   1.140 +char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
   1.141 +struct Pager *sqlite3BtreePager(Btree*);
   1.142 +
   1.143 +int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
   1.144 +void sqlite3BtreeCacheOverflow(BtCursor *);
   1.145 +
   1.146 +#ifdef SQLITE_TEST
   1.147 +int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
   1.148 +void sqlite3BtreeCursorList(Btree*);
   1.149 +int sqlite3BtreePageDump(Btree*, int, int recursive);
   1.150 +#endif
   1.151 +
   1.152 +#endif /* _BTREE_H_ */