1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/extensions/sqlite/sqlite-source/pager.h Sun Mar 30 07:00:22 2008 +0000
1.3 @@ -0,0 +1,125 @@
1.4 +/*
1.5 +** 2001 September 15
1.6 +**
1.7 +** The author disclaims copyright to this source code. In place of
1.8 +** a legal notice, here is a blessing:
1.9 +**
1.10 +** May you do good and not evil.
1.11 +** May you find forgiveness for yourself and forgive others.
1.12 +** May you share freely, never taking more than you give.
1.13 +**
1.14 +*************************************************************************
1.15 +** This header file defines the interface that the sqlite page cache
1.16 +** subsystem. The page cache subsystem reads and writes a file a page
1.17 +** at a time and provides a journal for rollback.
1.18 +**
1.19 +** @(#) $Id$
1.20 +*/
1.21 +
1.22 +#ifndef _PAGER_H_
1.23 +#define _PAGER_H_
1.24 +
1.25 +/*
1.26 +** The type used to represent a page number. The first page in a file
1.27 +** is called page 1. 0 is used to represent "not a page".
1.28 +*/
1.29 +typedef unsigned int Pgno;
1.30 +
1.31 +/*
1.32 +** Each open file is managed by a separate instance of the "Pager" structure.
1.33 +*/
1.34 +typedef struct Pager Pager;
1.35 +
1.36 +/*
1.37 +** Handle type for pages.
1.38 +*/
1.39 +typedef struct PgHdr DbPage;
1.40 +
1.41 +/*
1.42 +** Allowed values for the flags parameter to sqlite3PagerOpen().
1.43 +**
1.44 +** NOTE: This values must match the corresponding BTREE_ values in btree.h.
1.45 +*/
1.46 +#define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */
1.47 +#define PAGER_NO_READLOCK 0x0002 /* Omit readlocks on readonly files */
1.48 +
1.49 +/*
1.50 +** Valid values for the second argument to sqlite3PagerLockingMode().
1.51 +*/
1.52 +#define PAGER_LOCKINGMODE_QUERY -1
1.53 +#define PAGER_LOCKINGMODE_NORMAL 0
1.54 +#define PAGER_LOCKINGMODE_EXCLUSIVE 1
1.55 +
1.56 +/*
1.57 +** See source code comments for a detailed description of the following
1.58 +** routines:
1.59 +*/
1.60 +int sqlite3PagerOpen(sqlite3_vfs *, Pager **ppPager, const char*, int,int,int);
1.61 +void sqlite3PagerSetBusyhandler(Pager*, BusyHandler *pBusyHandler);
1.62 +void sqlite3PagerSetDestructor(Pager*, void(*)(DbPage*,int));
1.63 +void sqlite3PagerSetReiniter(Pager*, void(*)(DbPage*,int));
1.64 +int sqlite3PagerSetPagesize(Pager*, u16*);
1.65 +int sqlite3PagerMaxPageCount(Pager*, int);
1.66 +int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
1.67 +void sqlite3PagerSetCachesize(Pager*, int);
1.68 +int sqlite3PagerClose(Pager *pPager);
1.69 +int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
1.70 +#define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0)
1.71 +DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
1.72 +int sqlite3PagerRef(DbPage*);
1.73 +int sqlite3PagerUnref(DbPage*);
1.74 +int sqlite3PagerWrite(DbPage*);
1.75 +int sqlite3PagerOverwrite(Pager *pPager, Pgno pgno, void*);
1.76 +int sqlite3PagerPagecount(Pager*);
1.77 +int sqlite3PagerTruncate(Pager*,Pgno);
1.78 +int sqlite3PagerBegin(DbPage*, int exFlag);
1.79 +int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, Pgno);
1.80 +int sqlite3PagerCommitPhaseTwo(Pager*);
1.81 +int sqlite3PagerRollback(Pager*);
1.82 +int sqlite3PagerIsreadonly(Pager*);
1.83 +int sqlite3PagerStmtBegin(Pager*);
1.84 +int sqlite3PagerStmtCommit(Pager*);
1.85 +int sqlite3PagerStmtRollback(Pager*);
1.86 +void sqlite3PagerDontRollback(DbPage*);
1.87 +void sqlite3PagerDontWrite(DbPage*);
1.88 +int sqlite3PagerRefcount(Pager*);
1.89 +void sqlite3PagerSetSafetyLevel(Pager*,int,int);
1.90 +const char *sqlite3PagerFilename(Pager*);
1.91 +const sqlite3_vfs *sqlite3PagerVfs(Pager*);
1.92 +sqlite3_file *sqlite3PagerFile(Pager*);
1.93 +const char *sqlite3PagerDirname(Pager*);
1.94 +const char *sqlite3PagerJournalname(Pager*);
1.95 +int sqlite3PagerNosync(Pager*);
1.96 +int sqlite3PagerMovepage(Pager*,DbPage*,Pgno);
1.97 +void *sqlite3PagerGetData(DbPage *);
1.98 +void *sqlite3PagerGetExtra(DbPage *);
1.99 +int sqlite3PagerLockingMode(Pager *, int);
1.100 +
1.101 +#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) && !defined(SQLITE_OMIT_DISKIO)
1.102 + int sqlite3PagerReleaseMemory(int);
1.103 +#endif
1.104 +
1.105 +#ifdef SQLITE_HAS_CODEC
1.106 + void sqlite3PagerSetCodec(Pager*,void*(*)(void*,void*,Pgno,int),void*);
1.107 +#endif
1.108 +
1.109 +#if !defined(NDEBUG) || defined(SQLITE_TEST)
1.110 + Pgno sqlite3PagerPagenumber(DbPage*);
1.111 + int sqlite3PagerIswriteable(DbPage*);
1.112 +#endif
1.113 +
1.114 +#ifdef SQLITE_TEST
1.115 + int *sqlite3PagerStats(Pager*);
1.116 + void sqlite3PagerRefdump(Pager*);
1.117 + int pager3_refinfo_enable;
1.118 +#endif
1.119 +
1.120 +#ifdef SQLITE_TEST
1.121 +void disable_simulated_io_errors(void);
1.122 +void enable_simulated_io_errors(void);
1.123 +#else
1.124 +# define disable_simulated_io_errors()
1.125 +# define enable_simulated_io_errors()
1.126 +#endif
1.127 +
1.128 +#endif /* _PAGER_H_ */