1434
|
1 /*
|
|
2 ** 2001 September 15
|
|
3 **
|
|
4 ** The author disclaims copyright to this source code. In place of
|
|
5 ** a legal notice, here is a blessing:
|
|
6 **
|
|
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.
|
|
10 **
|
|
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.
|
|
15 **
|
|
16 ** @(#) $Id: pager.h,v 1.50 2006/03/06 18:23:17 drh Exp $
|
|
17 */
|
|
18
|
|
19 #ifndef _PAGER_H_
|
|
20 #define _PAGER_H_
|
|
21
|
|
22 /*
|
|
23 ** The default size of a database page.
|
|
24 */
|
|
25 #ifndef SQLITE_DEFAULT_PAGE_SIZE
|
|
26 # define SQLITE_DEFAULT_PAGE_SIZE 1024
|
|
27 #endif
|
|
28
|
|
29 /* Maximum page size. The upper bound on this value is 32768. This a limit
|
|
30 ** imposed by necessity of storing the value in a 2-byte unsigned integer
|
|
31 ** and the fact that the page size must be a power of 2.
|
|
32 **
|
|
33 ** This value is used to initialize certain arrays on the stack at
|
|
34 ** various places in the code. On embedded machines where stack space
|
|
35 ** is limited and the flexibility of having large pages is not needed,
|
|
36 ** it makes good sense to reduce the maximum page size to something more
|
|
37 ** reasonable, like 1024.
|
|
38 */
|
|
39 #ifndef SQLITE_MAX_PAGE_SIZE
|
|
40 # define SQLITE_MAX_PAGE_SIZE 32768
|
|
41 #endif
|
|
42
|
|
43 /*
|
|
44 ** Maximum number of pages in one database.
|
|
45 */
|
|
46 #define SQLITE_MAX_PAGE 1073741823
|
|
47
|
|
48 /*
|
|
49 ** The type used to represent a page number. The first page in a file
|
|
50 ** is called page 1. 0 is used to represent "not a page".
|
|
51 */
|
|
52 typedef unsigned int Pgno;
|
|
53
|
|
54 /*
|
|
55 ** Each open file is managed by a separate instance of the "Pager" structure.
|
|
56 */
|
|
57 typedef struct Pager Pager;
|
|
58
|
|
59 /*
|
|
60 ** Allowed values for the flags parameter to sqlite3pager_open().
|
|
61 **
|
|
62 ** NOTE: This values must match the corresponding BTREE_ values in btree.h.
|
|
63 */
|
|
64 #define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
|
|
65 #define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
|
|
66
|
|
67
|
|
68 /*
|
|
69 ** See source code comments for a detailed description of the following
|
|
70 ** routines:
|
|
71 */
|
|
72 int sqlite3pager_open(Pager **ppPager, const char *zFilename,
|
|
73 int nExtra, int flags);
|
|
74 void sqlite3pager_set_busyhandler(Pager*, BusyHandler *pBusyHandler);
|
|
75 void sqlite3pager_set_destructor(Pager*, void(*)(void*,int));
|
|
76 void sqlite3pager_set_reiniter(Pager*, void(*)(void*,int));
|
|
77 int sqlite3pager_set_pagesize(Pager*, int);
|
|
78 void sqlite3pager_read_fileheader(Pager*, int, unsigned char*);
|
|
79 void sqlite3pager_set_cachesize(Pager*, int);
|
|
80 int sqlite3pager_close(Pager *pPager);
|
|
81 int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage);
|
|
82 void *sqlite3pager_lookup(Pager *pPager, Pgno pgno);
|
|
83 int sqlite3pager_ref(void*);
|
|
84 int sqlite3pager_unref(void*);
|
|
85 Pgno sqlite3pager_pagenumber(void*);
|
|
86 int sqlite3pager_write(void*);
|
|
87 int sqlite3pager_iswriteable(void*);
|
|
88 int sqlite3pager_overwrite(Pager *pPager, Pgno pgno, void*);
|
|
89 int sqlite3pager_pagecount(Pager*);
|
|
90 int sqlite3pager_truncate(Pager*,Pgno);
|
|
91 int sqlite3pager_begin(void*, int exFlag);
|
|
92 int sqlite3pager_commit(Pager*);
|
|
93 int sqlite3pager_sync(Pager*,const char *zMaster, Pgno);
|
|
94 int sqlite3pager_rollback(Pager*);
|
|
95 int sqlite3pager_isreadonly(Pager*);
|
|
96 int sqlite3pager_stmt_begin(Pager*);
|
|
97 int sqlite3pager_stmt_commit(Pager*);
|
|
98 int sqlite3pager_stmt_rollback(Pager*);
|
|
99 void sqlite3pager_dont_rollback(void*);
|
|
100 void sqlite3pager_dont_write(Pager*, Pgno);
|
|
101 int *sqlite3pager_stats(Pager*);
|
|
102 void sqlite3pager_set_safety_level(Pager*,int,int);
|
|
103 const char *sqlite3pager_filename(Pager*);
|
|
104 const char *sqlite3pager_dirname(Pager*);
|
|
105 const char *sqlite3pager_journalname(Pager*);
|
|
106 int sqlite3pager_nosync(Pager*);
|
|
107 int sqlite3pager_rename(Pager*, const char *zNewName);
|
|
108 void sqlite3pager_set_codec(Pager*,void*(*)(void*,void*,Pgno,int),void*);
|
|
109 int sqlite3pager_movepage(Pager*,void*,Pgno);
|
|
110 int sqlite3pager_reset(Pager*);
|
|
111 int sqlite3pager_release_memory(int);
|
|
112
|
|
113 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
|
|
114 int sqlite3pager_lockstate(Pager*);
|
|
115 #endif
|
|
116
|
|
117 #ifdef SQLITE_TEST
|
|
118 void sqlite3pager_refdump(Pager*);
|
|
119 int pager3_refinfo_enable;
|
|
120 #endif
|
|
121
|
|
122 #endif /* _PAGER_H_ */
|