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