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 TypeMethodDescriptionvoidA call to this routine tells the pager that if a rollback occurs, it is not necessary to restore the data on the given page.voidA 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()getExtra()getFlags()longgetHash()Hash of page contentgetNext()intgetPager()getPrev()intbooleanReturn TRUE if the page given in the argument was previously passed to sqlite3PagerWrite().voidmove(int pageNumber, boolean isCommit) Move the page to location pageNumber in the file.voidref()Increment the reference count for a page.voidvoidsetFlags(Set<SqlJetPageFlags> flags) voidsetHash(long hash) voidsetPageNumber(int pageNumber) voidsetPager(ISqlJetPager pager) voidunref()Release a page.voidwrite()This function is used to mark a data-page as writable.
-
Field Details
-
BUFFER_TYPE
-
-
Constructor Details
-
SqlJetPage
public SqlJetPage()
-
-
Method Details
-
dontRollback
public void dontRollback()Description copied from interface:ISqlJetPageA 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:
dontRollbackin interfaceISqlJetPage
-
dontWrite
public void dontWrite()Description copied from interface:ISqlJetPageA 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:
dontWritein interfaceISqlJetPage
-
getData
Description copied from interface:ISqlJetPageReturn a pointer to the data for the specified page.- Specified by:
getDatain interfaceISqlJetPage
-
getExtra
- Specified by:
getExtrain interfaceISqlJetPage
-
setExtra
- Specified by:
setExtrain interfaceISqlJetPage
-
move
Description copied from interface:ISqlJetPageMove 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:
movein interfaceISqlJetPage- Parameters:
pageNumber-isCommit-- Throws:
SqlJetException
-
ref
public void ref()Description copied from interface:ISqlJetPageIncrement the reference count for a page.- Specified by:
refin interfaceISqlJetPage
-
unref
Description copied from interface:ISqlJetPageRelease 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:
unrefin interfaceISqlJetPage- Throws:
SqlJetException
-
write
Description copied from interface:ISqlJetPageThis 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:
writein interfaceISqlJetPage- Throws:
SqlJetException
-
getFlags
- Specified by:
getFlagsin interfaceISqlJetPage
-
getHash
public long getHash()Description copied from interface:ISqlJetPageHash of page content- Specified by:
getHashin interfaceISqlJetPage- Returns:
-
getPager
- Specified by:
getPagerin interfaceISqlJetPage
-
setFlags
- Specified by:
setFlagsin interfaceISqlJetPage
-
setHash
public void setHash(long hash) - Specified by:
setHashin interfaceISqlJetPage
-
setPager
- Specified by:
setPagerin interfaceISqlJetPage
-
getPageNumber
public int getPageNumber()- Specified by:
getPageNumberin interfaceISqlJetPage
-
setPageNumber
public void setPageNumber(int pageNumber) - Specified by:
setPageNumberin interfaceISqlJetPage
-
getNext
- Specified by:
getNextin interfaceISqlJetPage
-
getPrev
- Specified by:
getPrevin interfaceISqlJetPage
-
getRefCount
public int getRefCount()- Specified by:
getRefCountin interfaceISqlJetPage
-
isWriteable
public boolean isWriteable()Description copied from interface:ISqlJetPageReturn 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:
isWriteablein interfaceISqlJetPage- Returns:
-
getDirty
- Specified by:
getDirtyin interfaceISqlJetPage- Returns:
-