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.
20 ** The default size of a database page.
22 #ifndef SQLITE_DEFAULT_PAGE_SIZE
23 # define SQLITE_DEFAULT_PAGE_SIZE 1024
26 /* Maximum page size. The upper bound on this value is 32768. This a limit
27 ** imposed by necessity of storing the value in a 2-byte unsigned integer
28 ** and the fact that the page size must be a power of 2.
30 ** This value is used to initialize certain arrays on the stack at
31 ** various places in the code. On embedded machines where stack space
32 ** is limited and the flexibility of having large pages is not needed,
33 ** it makes good sense to reduce the maximum page size to something more
34 ** reasonable, like 1024.
36 #ifndef SQLITE_MAX_PAGE_SIZE
37 # define SQLITE_MAX_PAGE_SIZE 8192
41 ** Maximum number of pages in one database.
43 #define SQLITE_MAX_PAGE 1073741823
46 ** The type used to represent a page number. The first page in a file
47 ** is called page 1. 0 is used to represent "not a page".
49 typedef unsigned int Pgno
;
52 ** Each open file is managed by a separate instance of the "Pager" structure.
54 typedef struct Pager Pager
;
57 ** Allowed values for the flags parameter to sqlite3pager_open().
59 ** NOTE: This values must match the corresponding BTREE_ values in btree.h.
61 #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
62 #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
66 ** See source code comments for a detailed description of the following
69 int sqlite3pager_open(Pager
**ppPager
, const char *zFilename
,
70 int nExtra
, int flags
);
71 void sqlite3pager_set_busyhandler(Pager
*, BusyHandler
*pBusyHandler
);
72 void sqlite3pager_set_destructor(Pager
*, void(*)(void*,int));
73 void sqlite3pager_set_reiniter(Pager
*, void(*)(void*,int));
74 int sqlite3pager_set_pagesize(Pager
*, int);
75 void sqlite3pager_read_fileheader(Pager
*, int, unsigned char*);
76 void sqlite3pager_set_cachesize(Pager
*, int);
77 int sqlite3pager_close(Pager
*pPager
);
78 int sqlite3pager_get(Pager
*pPager
, Pgno pgno
, void **ppPage
);
79 void *sqlite3pager_lookup(Pager
*pPager
, Pgno pgno
);
80 int sqlite3pager_ref(void*);
81 int sqlite3pager_unref(void*);
82 Pgno
sqlite3pager_pagenumber(void*);
83 int sqlite3pager_write(void*);
84 int sqlite3pager_iswriteable(void*);
85 int sqlite3pager_overwrite(Pager
*pPager
, Pgno pgno
, void*);
86 int sqlite3pager_pagecount(Pager
*);
87 int sqlite3pager_truncate(Pager
*,Pgno
);
88 int sqlite3pager_begin(void*, int exFlag
);
89 int sqlite3pager_commit(Pager
*);
90 int sqlite3pager_sync(Pager
*,const char *zMaster
, Pgno
);
91 int sqlite3pager_rollback(Pager
*);
92 int sqlite3pager_isreadonly(Pager
*);
93 int sqlite3pager_stmt_begin(Pager
*);
94 int sqlite3pager_stmt_commit(Pager
*);
95 int sqlite3pager_stmt_rollback(Pager
*);
96 void sqlite3pager_dont_rollback(void*);
97 void sqlite3pager_dont_write(Pager
*, Pgno
);
98 int *sqlite3pager_stats(Pager
*);
99 void sqlite3pager_set_safety_level(Pager
*,int);
100 const char *sqlite3pager_filename(Pager
*);
101 const char *sqlite3pager_dirname(Pager
*);
102 const char *sqlite3pager_journalname(Pager
*);
103 int sqlite3pager_rename(Pager
*, const char *zNewName
);
104 void sqlite3pager_set_codec(Pager
*,void(*)(void*,void*,Pgno
,int),void*);
105 int sqlite3pager_movepage(Pager
*,void*,Pgno
);
106 int sqlite3pager_reset(Pager
*);
108 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
109 int sqlite3pager_lockstate(Pager
*);
113 void sqlite3pager_refdump(Pager
*);
114 int pager3_refinfo_enable
;