Class SqlJetPage
java.lang.Object
org.tmatesoft.sqljet.core.internal.pager.SqlJetPage
- All Implemented Interfaces:
ISqlJetPage
- Author:
- TMate Software Ltd., Sergey Scherbina (sergey.scherbina@gmail.com)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
A call to this routine tells the pager that if a rollback occurs, it is not necessary to restore the data on the given page.void
A call to this routine tells the pager that it is not necessary to write the information on page pPg back to the disk, even though that page might be marked as dirty.getData()
Return a pointer to the data for the specified page.getDirty()
java.lang.Object
getExtra()
java.util.Set<SqlJetPageFlags>
getFlags()
long
getHash()
Hash of page contentgetNext()
int
getPager()
getPrev()
int
boolean
Return TRUE if the page given in the argument was previously passed to sqlite3PagerWrite().void
move
(int pageNumber, boolean isCommit) Move the page to location pageNumber in the file.void
ref()
Increment the reference count for a page.void
setExtra
(java.lang.Object extra) void
setFlags
(java.util.Set<SqlJetPageFlags> flags) void
setHash
(long hash) void
setPageNumber
(int pageNumber) void
setPager
(ISqlJetPager pager) void
unref()
Release a page.void
write()
This function is used to mark a data-page as writable.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
BUFFER_TYPE
-
-
Constructor Details
-
SqlJetPage
public SqlJetPage()
-
-
Method Details
-
dontRollback
public void dontRollback()Description copied from interface:ISqlJetPage
A call to this routine tells the pager that if a rollback occurs, it is not necessary to restore the data on the given page. This means that the pager does not have to record the given page in the rollback journal. If we have not yet actually read the content of this page (if the PgHdr.needRead flag is set) then this routine acts as a promise that we will never need to read the page content in the future. so the needRead flag can be cleared at this point.- Specified by:
dontRollback
in interfaceISqlJetPage
-
dontWrite
public void dontWrite()Description copied from interface:ISqlJetPage
A call to this routine tells the pager that it is not necessary to write the information on page pPg back to the disk, even though that page might be marked as dirty. This happens, for example, when the page has been added as a leaf of the freelist and so its content no longer matters. The overlying software layer calls this routine when all of the data on the given page is unused. The pager marks the page as clean so that it does not get written to disk. Tests show that this optimization, together with the sqlite3PagerDontRollback() below, more than double the speed of large INSERT operations and quadruple the speed of large DELETEs. When this routine is called, set the bit corresponding to pDbPage in the Pager.pAlwaysRollback bitvec. Subsequent calls to sqlite3PagerDontRollback() for the same page will thereafter be ignored. This is necessary to avoid a problem where a page with data is added to the freelist during one part of a transaction then removed from the freelist during a later part of the same transaction and reused for some other purpose. When it is first added to the freelist, this routine is called. When reused, the sqlite3PagerDontRollback() routine is called. But because the page contains critical data, we still need to be sure it gets rolled back in spite of the sqlite3PagerDontRollback() call.- Specified by:
dontWrite
in interfaceISqlJetPage
-
getData
Description copied from interface:ISqlJetPage
Return a pointer to the data for the specified page.- Specified by:
getData
in interfaceISqlJetPage
-
getExtra
public java.lang.Object getExtra()- Specified by:
getExtra
in interfaceISqlJetPage
-
setExtra
public void setExtra(java.lang.Object extra) - Specified by:
setExtra
in interfaceISqlJetPage
-
move
Description copied from interface:ISqlJetPage
Move the page to location pageNumber in the file. There must be no references to the page previously located at pageNumber (which we call pPgOld) though that page is allowed to be in cache. If the page previously located at pgno is not already in the rollback journal, it is not put there by by this routine. References to the page remain valid. Updating any meta-data associated with page (i.e. data stored in the nExtra bytes allocated along with the page) is the responsibility of the caller. A transaction must be active when this routine is called. It used to be required that a statement transaction was not active, but this restriction has been removed (CREATE INDEX needs to move a page when a statement transaction is active). If the second argument, isCommit, is true, then this page is being moved as part of a database reorganization just before the transaction is being committed. In this case, it is guaranteed that the database page refers to will not be written to again within this transaction.- Specified by:
move
in interfaceISqlJetPage
- Throws:
SqlJetException
-
ref
public void ref()Description copied from interface:ISqlJetPage
Increment the reference count for a page.- Specified by:
ref
in interfaceISqlJetPage
-
unref
Description copied from interface:ISqlJetPage
Release a page. If the number of references to the page drop to zero, then the page is added to the LRU list. When all references to all pages are released, a rollback occurs and the lock on the database is removed.- Specified by:
unref
in interfaceISqlJetPage
- Throws:
SqlJetException
-
write
Description copied from interface:ISqlJetPage
This function is used to mark a data-page as writable. It uses pager_write() to open a journal file (if it is not already open) and write the page *pData to the journal. The difference between this function and pager_write() is that this function also deals with the special case where 2 or more pages fit on a single disk sector. In this case all co-resident pages must have been written to the journal file before returning.- Specified by:
write
in interfaceISqlJetPage
- Throws:
SqlJetException
-
getFlags
- Specified by:
getFlags
in interfaceISqlJetPage
-
getHash
public long getHash()Description copied from interface:ISqlJetPage
Hash of page content- Specified by:
getHash
in interfaceISqlJetPage
- Returns:
-
getPager
- Specified by:
getPager
in interfaceISqlJetPage
-
setFlags
- Specified by:
setFlags
in interfaceISqlJetPage
-
setHash
public void setHash(long hash) - Specified by:
setHash
in interfaceISqlJetPage
-
setPager
- Specified by:
setPager
in interfaceISqlJetPage
-
getPageNumber
public int getPageNumber()- Specified by:
getPageNumber
in interfaceISqlJetPage
-
setPageNumber
public void setPageNumber(int pageNumber) - Specified by:
setPageNumber
in interfaceISqlJetPage
-
getNext
- Specified by:
getNext
in interfaceISqlJetPage
-
getPrev
- Specified by:
getPrev
in interfaceISqlJetPage
-
getRefCount
public int getRefCount()- Specified by:
getRefCount
in interfaceISqlJetPage
-
isWriteable
public boolean isWriteable()Description copied from interface:ISqlJetPage
Return TRUE if the page given in the argument was previously passed to sqlite3PagerWrite(). In other words, return TRUE if it is ok to change the content of the page.- Specified by:
isWriteable
in interfaceISqlJetPage
- Returns:
-
getDirty
- Specified by:
getDirty
in interfaceISqlJetPage
- Returns:
-