engine/sqlite/src/btree.h
author Sebastian Brannstrom <sebastianb@symbian.org>
Sat, 16 Oct 2010 15:36:19 +0100
branch3rded
changeset 275 e2c3225833c3
parent 2 29cda98b007e
permissions -rw-r--r--
Fix for bug 2818
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
** 2001 September 15
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
** The author disclaims copyright to this source code.  In place of
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
** a legal notice, here is a blessing:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
**    May you do good and not evil.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
**    May you find forgiveness for yourself and forgive others.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
**    May you share freely, never taking more than you give.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
*************************************************************************
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
** This header file defines the interface that the sqlite B-Tree file
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
** subsystem.  See comments in the source code for a detailed description
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
** of what each interface routine does.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
** @(#) $Id: btree.h 1282 2008-11-13 09:31:33Z LarsPson $
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
#ifndef _BTREE_H_
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#define _BTREE_H_
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
/* TODO: This definition is just included so other modules compile. It
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
** needs to be revisited.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#define SQLITE_N_BTREE_META 10
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#ifndef SQLITE_DEFAULT_AUTOVACUUM
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
  #define SQLITE_DEFAULT_AUTOVACUUM 0
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
#define BTREE_AUTOVACUUM_NONE 0        /* Do not do auto-vacuum */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
#define BTREE_AUTOVACUUM_FULL 1        /* Do full auto-vacuum */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
#define BTREE_AUTOVACUUM_INCR 2        /* Incremental vacuum */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
** Forward declarations of structure
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
typedef struct Btree Btree;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
typedef struct BtCursor BtCursor;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
typedef struct BtShared BtShared;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
typedef struct BtreeMutexArray BtreeMutexArray;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
** This structure records all of the Btrees that need to hold
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
** a mutex before we enter sqlite3VdbeExec().  The Btrees are
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
** are placed in aBtree[] in order of aBtree[]->pBt.  That way,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
** we can always lock and unlock them all quickly.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
struct BtreeMutexArray {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
  int nMutex;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
  Btree *aBtree[SQLITE_MAX_ATTACHED+1];
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
};
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
int sqlite3BtreeOpen(
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
  const char *zFilename,   /* Name of database file to open */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
  sqlite3 *db,             /* Associated database connection */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
  Btree **,                /* Return open Btree* here */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
  int flags,               /* Flags */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
  int vfsFlags             /* Flags passed through to VFS open */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
** following values.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
**
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
** NOTE:  These values must match the corresponding PAGER_ values in
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
** pager.h.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
#define BTREE_OMIT_JOURNAL  1  /* Do not use journal.  No argument */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
#define BTREE_NO_READLOCK   2  /* Omit readlocks on readonly files */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
#define BTREE_MEMORY        4  /* In-memory DB.  No argument */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
#define BTREE_READONLY      8  /* Open the database in read-only mode */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
#define BTREE_READWRITE    16  /* Open for both reading and writing */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
#define BTREE_CREATE       32  /* Create the database if it does not exist */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
/* Additional values for the 4th argument of sqlite3BtreeOpen that
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
** are not associated with PAGER_ values.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
#define BTREE_PRIVATE      64  /* Never share with other connections */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
int sqlite3BtreeClose(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
int sqlite3BtreeSetCacheSize(Btree*,int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
int sqlite3BtreeSetSafetyLevel(Btree*,int,int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
int sqlite3BtreeSyncDisabled(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
int sqlite3BtreeSetPageSize(Btree*,int,int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
int sqlite3BtreeGetPageSize(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
int sqlite3BtreeMaxPageCount(Btree*,int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
int sqlite3BtreeGetReserve(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
int sqlite3BtreeSetAutoVacuum(Btree *, int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
int sqlite3BtreeGetAutoVacuum(Btree *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
int sqlite3BtreeBeginTrans(Btree*,int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
int sqlite3BtreeCommitPhaseTwo(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
int sqlite3BtreeCommit(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
int sqlite3BtreeRollback(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
int sqlite3BtreeBeginStmt(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
int sqlite3BtreeCommitStmt(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
int sqlite3BtreeRollbackStmt(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
int sqlite3BtreeCreateTable(Btree*, int*, int flags);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
int sqlite3BtreeIsInTrans(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
int sqlite3BtreeIsInStmt(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
int sqlite3BtreeIsInReadTrans(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
int sqlite3BtreeSchemaLocked(Btree *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
int sqlite3BtreeLockTable(Btree *, int, u8);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
const char *sqlite3BtreeGetFilename(Btree *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
const char *sqlite3BtreeGetDirname(Btree *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
const char *sqlite3BtreeGetJournalname(Btree *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
int sqlite3BtreeCopyFile(Btree *, Btree *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
int sqlite3BtreeIncrVacuum(Btree *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
** of the following flags:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
#define BTREE_INTKEY     1    /* Table has only 64-bit signed integer keys */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
#define BTREE_ZERODATA   2    /* Table has keys only - no data */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
#define BTREE_LEAFDATA   4    /* Data stored in leaves only.  Implies INTKEY */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
int sqlite3BtreeDropTable(Btree*, int, int*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
int sqlite3BtreeClearTable(Btree*, int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
int sqlite3BtreeGetMeta(Btree*, int idx, u32 *pValue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
void sqlite3BtreeTripAllCursors(Btree*, int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
int sqlite3BtreeCursor(
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
  Btree*,                              /* BTree containing table to open */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
  int iTable,                          /* Index of root page */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
  int wrFlag,                          /* 1 for writing.  0 for read-only */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
  int(*)(void*,int,const void*,int,const void*),  /* Key comparison function */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
  void*,                               /* First argument to compare function */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
  BtCursor **ppCursor                  /* Returned cursor */
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
int sqlite3BtreeCloseCursor(BtCursor*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
int sqlite3BtreeMoveto(BtCursor*,const void *pKey,i64 nKey,int bias,int *pRes);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
int sqlite3BtreeDelete(BtCursor*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
                                  const void *pData, int nData,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
                                  int nZero, int bias);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
int sqlite3BtreeFirst(BtCursor*, int *pRes);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
int sqlite3BtreeLast(BtCursor*, int *pRes);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
int sqlite3BtreeNext(BtCursor*, int *pRes);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
int sqlite3BtreeEof(BtCursor*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
int sqlite3BtreeFlags(BtCursor*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
int sqlite3BtreePrevious(BtCursor*, int *pRes);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
sqlite3 *sqlite3BtreeCursorDb(const BtCursor*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
struct Pager *sqlite3BtreePager(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
void sqlite3BtreeCacheOverflow(BtCursor *);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
#ifdef SQLITE_TEST
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
void sqlite3BtreeCursorList(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
int sqlite3BtreePageDump(Btree*, int, int recursive);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
** If we are not using shared cache, then there is no need to
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
** use mutexes to access the BtShared structures.  So make the
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
** Enter and Leave procedures no-ops.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
  void sqlite3BtreeEnter(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
  void sqlite3BtreeLeave(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
  int sqlite3BtreeHoldsMutex(Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
  void sqlite3BtreeEnterCursor(BtCursor*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
  void sqlite3BtreeLeaveCursor(BtCursor*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
  void sqlite3BtreeEnterAll(sqlite3*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
  void sqlite3BtreeLeaveAll(sqlite3*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
  int sqlite3BtreeHoldsAllMutexes(sqlite3*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
  void sqlite3BtreeMutexArrayEnter(BtreeMutexArray*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
  void sqlite3BtreeMutexArrayLeave(BtreeMutexArray*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
  void sqlite3BtreeMutexArrayInsert(BtreeMutexArray*, Btree*);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
#else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
# define sqlite3BtreeEnter(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
# define sqlite3BtreeLeave(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
# define sqlite3BtreeHoldsMutex(X) 1
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
# define sqlite3BtreeEnterCursor(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
# define sqlite3BtreeLeaveCursor(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
# define sqlite3BtreeEnterAll(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
# define sqlite3BtreeLeaveAll(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
# define sqlite3BtreeHoldsAllMutexes(X) 1
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
# define sqlite3BtreeMutexArrayEnter(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
# define sqlite3BtreeMutexArrayLeave(X)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
# define sqlite3BtreeMutexArrayInsert(X,Y)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
#endif
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
#endif /* _BTREE_H_ */