Eneboo - Documentación para desarrolladores
|
00001 /* 00002 ** 2001 September 15 00003 ** 00004 ** The author disclaims copyright to this source code. In place of 00005 ** a legal notice, here is a blessing: 00006 ** 00007 ** May you do good and not evil. 00008 ** May you find forgiveness for yourself and forgive others. 00009 ** May you share freely, never taking more than you give. 00010 ** 00011 ************************************************************************* 00012 ** This header file defines the interface that the sqlite page cache 00013 ** subsystem. The page cache subsystem reads and writes a file a page 00014 ** at a time and provides a journal for rollback. 00015 ** 00016 ** @(#) $Id: qt/pager.h 3.3.8 edited Mar 30 2004 $ 00017 */ 00018 00019 /* 00020 ** The size of one page 00021 ** 00022 ** You can change this value to another (reasonable) value you want. 00023 ** It need not be a power of two, though the interface to the disk 00024 ** will likely be faster if it is. 00025 ** 00026 ** Experiments show that a page size of 1024 gives the best speed 00027 ** for common usages. The speed differences for different sizes 00028 ** such as 512, 2048, 4096, an so forth, is minimal. Note, however, 00029 ** that changing the page size results in a completely imcompatible 00030 ** file format. 00031 */ 00032 #ifndef SQLITE_PAGE_SIZE 00033 #define SQLITE_PAGE_SIZE 1024 00034 #endif 00035 00036 /* 00037 ** Number of extra bytes of data allocated at the end of each page and 00038 ** stored on disk but not used by the higher level btree layer. Changing 00039 ** this value results in a completely incompatible file format. 00040 */ 00041 #ifndef SQLITE_PAGE_RESERVE 00042 #define SQLITE_PAGE_RESERVE 0 00043 #endif 00044 00045 /* 00046 ** The total number of usable bytes stored on disk for each page. 00047 ** The usable bytes come at the beginning of the page and the reserve 00048 ** bytes come at the end. 00049 */ 00050 #define SQLITE_USABLE_SIZE (SQLITE_PAGE_SIZE-SQLITE_PAGE_RESERVE) 00051 00052 /* 00053 ** Maximum number of pages in one database. (This is a limitation of 00054 ** imposed by 4GB files size limits.) 00055 */ 00056 #define SQLITE_MAX_PAGE 1073741823 00057 00058 /* 00059 ** The type used to represent a page number. The first page in a file 00060 ** is called page 1. 0 is used to represent "not a page". 00061 */ 00062 typedef unsigned int Pgno; 00063 00064 /* 00065 ** Each open file is managed by a separate instance of the "Pager" structure. 00066 */ 00067 typedef struct Pager Pager; 00068 00069 /* 00070 ** See source code comments for a detailed description of the following 00071 ** routines: 00072 */ 00073 int sqlitepager_open(Pager **ppPager, const char *zFilename, 00074 int nPage, int nExtra, int useJournal); 00075 void sqlitepager_set_destructor(Pager*, void(*)(void*)); 00076 void sqlitepager_set_cachesize(Pager*, int); 00077 int sqlitepager_close(Pager *pPager); 00078 int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage); 00079 void *sqlitepager_lookup(Pager *pPager, Pgno pgno); 00080 int sqlitepager_ref(void*); 00081 int sqlitepager_unref(void*); 00082 Pgno sqlitepager_pagenumber(void*); 00083 int sqlitepager_write(void*); 00084 int sqlitepager_iswriteable(void*); 00085 int sqlitepager_overwrite(Pager *pPager, Pgno pgno, void*); 00086 int sqlitepager_pagecount(Pager*); 00087 int sqlitepager_truncate(Pager*,Pgno); 00088 int sqlitepager_begin(void*); 00089 int sqlitepager_commit(Pager*); 00090 int sqlitepager_rollback(Pager*); 00091 int sqlitepager_isreadonly(Pager*); 00092 int sqlitepager_ckpt_begin(Pager*); 00093 int sqlitepager_ckpt_commit(Pager*); 00094 int sqlitepager_ckpt_rollback(Pager*); 00095 void sqlitepager_dont_rollback(void*); 00096 void sqlitepager_dont_write(Pager*, Pgno); 00097 int *sqlitepager_stats(Pager*); 00098 void sqlitepager_set_safety_level(Pager*,int); 00099 const char *sqlitepager_filename(Pager*); 00100 int sqlitepager_rename(Pager*, const char *zNewName); 00101 void sqlitepager_set_codec(Pager*,void(*)(void*,void*,Pgno,int),void*); 00102 00103 #ifdef SQLITE_TEST 00104 void sqlitepager_refdump(Pager*); 00105 int pager_refinfo_enable; 00106 int journal_format; 00107 #endif