Update contrib.
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give.
11 *************************************************************************
12 ** This header file defines the interface that the sqlite page cache
13 ** subsystem. The page cache subsystem reads and writes a file a page
14 ** at a time and provides a journal for rollback.
16 ** @(#) $Id: pager.h,v 1.77 2008/07/16 18:17:56 danielk1977 Exp $
23 ** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
24 ** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
26 #ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
27 #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1
31 ** The type used to represent a page number. The first page in a file
32 ** is called page 1. 0 is used to represent "not a page".
37 ** Each open file is managed by a separate instance of the "Pager" structure.
39 typedef struct Pager Pager;
42 ** Handle type for pages.
44 typedef struct PgHdr DbPage;
47 ** Allowed values for the flags parameter to sqlite3PagerOpen().
49 ** NOTE: This values must match the corresponding BTREE_ values in btree.h.
51 #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
52 #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
55 ** Valid values for the second argument to sqlite3PagerLockingMode().
57 #define PAGER_LOCKINGMODE_QUERY -1
58 #define PAGER_LOCKINGMODE_NORMAL 0
59 #define PAGER_LOCKINGMODE_EXCLUSIVE 1
62 ** Valid values for the second argument to sqlite3PagerJournalMode().
64 #define PAGER_JOURNALMODE_QUERY -1
65 #define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */
66 #define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */
67 #define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */
70 ** See source code comments for a detailed description of the following
73 int sqlite3PagerOpen(sqlite3_vfs *, Pager **ppPager, const char*, int,int,int);
74 void sqlite3PagerSetBusyhandler(Pager*, BusyHandler *pBusyHandler);
75 void sqlite3PagerSetDestructor(Pager*, void(*)(DbPage*,int));
76 void sqlite3PagerSetReiniter(Pager*, void(*)(DbPage*,int));
77 int sqlite3PagerSetPagesize(Pager*, u16*);
78 int sqlite3PagerMaxPageCount(Pager*, int);
79 int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
80 void sqlite3PagerSetCachesize(Pager*, int);
81 int sqlite3PagerClose(Pager *pPager);
82 int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
83 #define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0)
84 DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
85 int sqlite3PagerRef(DbPage*);
86 int sqlite3PagerUnref(DbPage*);
87 int sqlite3PagerWrite(DbPage*);
88 int sqlite3PagerPagecount(Pager*, int*);
89 int sqlite3PagerTruncate(Pager*,Pgno);
90 int sqlite3PagerBegin(DbPage*, int exFlag);
91 int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, Pgno, int);
92 int sqlite3PagerCommitPhaseTwo(Pager*);
93 int sqlite3PagerRollback(Pager*);
94 int sqlite3PagerIsreadonly(Pager*);
95 int sqlite3PagerStmtBegin(Pager*);
96 int sqlite3PagerStmtCommit(Pager*);
97 int sqlite3PagerStmtRollback(Pager*);
98 void sqlite3PagerDontRollback(DbPage*);
99 void sqlite3PagerDontWrite(DbPage*);
100 int sqlite3PagerRefcount(Pager*);
101 void sqlite3PagerSetSafetyLevel(Pager*,int,int);
102 const char *sqlite3PagerFilename(Pager*);
103 const sqlite3_vfs *sqlite3PagerVfs(Pager*);
104 sqlite3_file *sqlite3PagerFile(Pager*);
105 const char *sqlite3PagerDirname(Pager*);
106 const char *sqlite3PagerJournalname(Pager*);
107 int sqlite3PagerNosync(Pager*);
108 int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
109 void *sqlite3PagerGetData(DbPage *);
110 void *sqlite3PagerGetExtra(DbPage *);
111 int sqlite3PagerLockingMode(Pager *, int);
112 int sqlite3PagerJournalMode(Pager *, int);
113 i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
114 void *sqlite3PagerTempSpace(Pager*);
115 int sqlite3PagerSync(Pager *pPager);
117 #if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) && !defined(SQLITE_OMIT_DISKIO)
118 int sqlite3PagerReleaseMemory(int);
121 #ifdef SQLITE_HAS_CODEC
122 void sqlite3PagerSetCodec(Pager*,void*(*)(void*,void*,Pgno,int),void*);
125 #if !defined(NDEBUG) || defined(SQLITE_TEST)
126 Pgno sqlite3PagerPagenumber(DbPage*);
127 int sqlite3PagerIswriteable(DbPage*);
131 int *sqlite3PagerStats(Pager*);
132 void sqlite3PagerRefdump(Pager*);
133 int sqlite3PagerIsMemdb(Pager*);
137 void disable_simulated_io_errors(void);
138 void enable_simulated_io_errors(void);
140 # define disable_simulated_io_errors()
141 # define enable_simulated_io_errors()
144 #endif /* _PAGER_H_ */