public interface ISqlJetPager
Modifier and Type | Field and Description |
---|---|
static ISqlJetMemoryPointer |
aJournalMagic
Journal files begin with the following magic string.
|
static java.lang.String |
JOURNAL |
static java.lang.String |
MEMORY_DB
In-memory database's "file-name".
|
static int |
PAGER_MAX_PGNO
The maximum legal page number is (2^31 - 1).
|
static int |
SQLJET_DEFAULT_JOURNAL_SIZE_LIMIT
If defined as non-zero, auto-vacuum is enabled by default.
|
static int |
SQLJET_MIN_SECTOR_SIZE
The minimum sector size is 512
|
Modifier and Type | Method and Description |
---|---|
ISqlJetPage |
acquirePage(int pageNumber,
boolean read)
Acquire a page.
|
void |
begin(boolean exclusive)
Acquire a write-lock on the database.
|
void |
close()
Shutdown the page cache.
|
void |
commitPhaseOne(java.lang.String master,
boolean noSync)
Sync the database file for the pager pPager.
|
void |
commitPhaseTwo()
Commit all changes to the database and release the write lock.
|
int |
getCacheSize() |
java.io.File |
getDirectoryName()
Return the directory of the database file.
|
ISqlJetFile |
getFile()
Return the file handle for the database file associated with the pager.
|
java.io.File |
getFileName()
Return the path of the database file.
|
ISqlJetFileSystem |
getFileSystem()
Return the file system for the pager.
|
SqlJetPagerJournalMode |
getJournalMode()
Get the journal-mode for this pager.
|
java.io.File |
getJournalName()
Return the path of the journal file.
|
long |
getJournalSizeLimit()
Get the size-limit used for persistent journal files.
|
SqlJetPagerLockingMode |
getLockingMode()
Get the locking-mode for this pager.
|
int |
getMaxPageCount()
Return the current maximum page count.
|
ISqlJetPage |
getPage(int pageNumber)
Just call acquire( pageNumber, true);
|
int |
getPageCount()
Return the total number of pages in the disk file associated with pager.
|
int |
getPageSize()
Get the page size.
|
int |
getRefCount()
Return the number of references to the pager.
|
SqlJetSafetyLevel |
getSafetyLevel()
Get safety level
|
ISqlJetMemoryPointer |
getTempSpace()
Return a pointer to the "temporary page" buffer held internally by the
pager.
|
int |
imageSize()
Return the current size of the database file image in pages.
|
boolean |
isNoSync()
Return true if fsync() calls are disabled for this pager.
|
boolean |
isReadOnly()
Return TRUE if the database file is opened read-only.
|
ISqlJetPage |
lookupPage(int pageNumber)
Acquire a page if it is already in the in-memory cache.
|
void |
open(ISqlJetFileSystem fs,
java.io.File fileName,
java.util.Set<SqlJetPagerFlags> flags,
SqlJetFileType type,
java.util.Set<SqlJetFileOpenPermission> permissions)
Open a new page cache.
|
void |
openSavepoint(int nSavepoint)
Ensure that there are at least nSavepoint savepoints open.
|
void |
readFileHeader(int count,
ISqlJetMemoryPointer buffer)
Read the first N bytes from the beginning of the file into memory that
buffer points to.
|
void |
rollback()
Rollback all changes.
|
void |
savepoint(SqlJetSavepointOperation op,
int iSavepoint)
Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE.
|
void |
setBusyhandler(ISqlJetBusyHandler busyHandler)
Set the busy handler function.
|
void |
setCacheSize(int cacheSize)
Change the maximum number of in-memory pages that are allowed.
|
void |
setJournalMode(SqlJetPagerJournalMode journalMode)
Set the journal-mode for this pager.
|
void |
setJournalSizeLimit(long limit)
Set the size-limit used for persistent journal files.
|
void |
setLockingMode(SqlJetPagerLockingMode lockingMode)
Set the locking-mode for this pager.
|
void |
setMaxPageCount(int maxPageCount)
Attempt to set the maximum database page count if mxPage is positive.
|
int |
setPageSize(int pageSize)
Set the page size to pageSize.
|
void |
setReiniter(ISqlJetPageCallback reinitier)
Set the reinitializer for this pager.
|
void |
setSafetyLevel(SqlJetSafetyLevel safetyLevel)
Set safety level
|
void |
sync()
Sync the pager file to disk.
|
void |
truncateImage(int pagesNumber)
Truncate the in-memory database file image to nPage pages.
|
static final int SQLJET_MIN_SECTOR_SIZE
static final java.lang.String JOURNAL
static final ISqlJetMemoryPointer aJournalMagic
static final int PAGER_MAX_PGNO
static final int SQLJET_DEFAULT_JOURNAL_SIZE_LIMIT
static final java.lang.String MEMORY_DB
void open(ISqlJetFileSystem fs, java.io.File fileName, java.util.Set<SqlJetPagerFlags> flags, SqlJetFileType type, java.util.Set<SqlJetFileOpenPermission> permissions) throws SqlJetException
getPage(int)
and is only held open until the last
page is released using #unref(ISqlJetPage)
.
If fileName is null then a randomly-named temporary file is created and
used as the file to be cached. The file will be deleted automatically
when it is closed.
If fileName is MEMORY_DB
then all information is held in cache.
It is never written to disk. This can be used to implement an in-memory
database.fs
- The file system to usefileName
- Name of the database file to openflags
- flags controlling this filetype
- file type passed through to
ISqlJetFileSystem.open(java.io.File, SqlJetFileType, Set)
permissions
- permissions passed through to
ISqlJetFileSystem.open(java.io.File, SqlJetFileType, Set)
SqlJetException
java.io.File getFileName()
java.io.File getDirectoryName()
java.io.File getJournalName()
ISqlJetFileSystem getFileSystem()
ISqlJetFile getFile()
boolean isReadOnly()
boolean isNoSync()
SqlJetPagerLockingMode getLockingMode()
void setLockingMode(SqlJetPagerLockingMode lockingMode)
lockingMode
- SqlJetPagerJournalMode getJournalMode()
journalMode
- void setJournalMode(SqlJetPagerJournalMode journalMode)
journalMode
- long getJournalSizeLimit()
void setJournalSizeLimit(long limit)
limit
- void setSafetyLevel(SqlJetSafetyLevel safetyLevel)
safetyLevel
- SqlJetSafetyLevel getSafetyLevel()
ISqlJetMemoryPointer getTempSpace()
void setBusyhandler(ISqlJetBusyHandler busyHandler)
busyHandler
- void setReiniter(ISqlJetPageCallback reinitier)
reinitier
- int setPageSize(int pageSize) throws SqlJetException
pageSize
- SqlJetException
int getPageSize()
void setMaxPageCount(int maxPageCount) throws SqlJetException
maxPageCount
- SqlJetException
int getMaxPageCount()
void setCacheSize(int cacheSize)
cacheSize
- void readFileHeader(int count, ISqlJetMemoryPointer buffer) throws SqlJetIOException
count
- buffer
- SqlJetIOException
int getPageCount() throws SqlJetException
SqlJetException
- if pager is in error state.void close() throws SqlJetException
SqlJetException
ISqlJetPage acquirePage(int pageNumber, boolean read) throws SqlJetException
lookupPage(int)
. Both this routine and
lookupPage(int)
attempt to find a page in the in-memory cache
first. If the page is not already in memory, this routine goes to disk to
read it in whereas lookupPage(int)
just returns 0. This routine
acquires a read-lock the first time it has to go to disk, and could also
playback an old journal if necessary. Since lookupPage(int)
never goes to disk, it never has to deal with locks or journal files.
If noContent is false, the page contents are actually read from disk. If
noContent is true, it means that we do not care about the contents of the
page at this time, so do not do a disk read. Just fill in the page
content with zeros. But mark the fact that we have not read the content
by setting the PgHdr.needRead flag. Later on, if sqlite3PagerWrite() is
called on this page or if this routine is called again with noContent==0,
that means that the content is needed and the disk read should occur at
that point.pageNumber
- Page number to fetchread
- Do not bother reading content from disk if falseSqlJetException
ISqlJetPage getPage(int pageNumber) throws SqlJetException
pageNumber
- Page number to fetchSqlJetException
ISqlJetPage lookupPage(int pageNumber) throws SqlJetException
getPage(int)
. The difference between this routine and
getPage(int)
is that getPage(int)
will go to the disk
and read in the page if the page is not already in cache. This routine
returns null if the page is not in cache or if a disk I/O error has ever
happened.pageNumber
- Page number to lookupSqlJetException
void begin(boolean exclusive) throws SqlJetException
exclusive
- SqlJetException
void commitPhaseOne(java.lang.String master, boolean noSync) throws SqlJetException
master
- noSync
- SqlJetException
void commitPhaseTwo() throws SqlJetException
SqlJetException
void rollback() throws SqlJetException
SqlJetException
int getRefCount()
void sync() throws SqlJetIOException
SqlJetIOException
void openSavepoint(int nSavepoint) throws SqlJetException
SqlJetException
void savepoint(SqlJetSavepointOperation op, int iSavepoint) throws SqlJetException
SqlJetException
void truncateImage(int pagesNumber)
pageNumber
- int imageSize()
int getCacheSize()
Copyright © 2009-2010 TMate Software Ltd. All Rights Reserved.