org.h2.index
Class PageDataLeaf

java.lang.Object
  extended by org.h2.util.CacheObject
      extended by org.h2.store.Record
          extended by org.h2.store.Page
              extended by org.h2.index.PageDataLeaf

public class PageDataLeaf
extends Page

A leaf page that contains data of one or multiple rows. Format:


Field Summary
protected  Data data
          The data page.
protected  int entryCount
          The number of entries.
protected  PageDataIndex index
          The index.
protected  long[] keys
          The row keys.
protected  int parentPageId
          The page number of the parent.
protected  boolean written
          Whether the data page is up-to-date.
 
Fields inherited from class org.h2.store.Page
FLAG_LAST, TYPE_BTREE_LEAF, TYPE_BTREE_NODE, TYPE_DATA_LEAF, TYPE_DATA_NODE, TYPE_DATA_OVERFLOW, TYPE_EMPTY, TYPE_FREE_LIST, TYPE_STREAM_DATA, TYPE_STREAM_TRUNK
 
Fields inherited from class org.h2.util.CacheObject
blockCount, cacheQueue, chained, next, previous
 
Method Summary
 int getByteCount(DataPage dummy)
          Get the number of bytes required for the data if the given data page would be used.
 int getMemorySize()
          Get the estimated memory size.
 void moveTo(Session session, int newPos)
          Copy the data to a new location, change the parent to point to the new location, and free up the current page.
static Page read(PageDataIndex index, Data data, int pageId)
          Read a data leaf page.
protected  void remapChildren()
          Update the parent id of all children.
 java.lang.String toString()
           
 void write(DataPage buff)
          Write the record to the data page.
 
Methods inherited from class org.h2.store.Record
canRemove, commit, getSessionId, getStorageId, isDeleted, isEmpty, isLogWritten, prepareWrite, setDeleted, setLastLog, setLogWritten, setSessionId, setStorageId
 
Methods inherited from class org.h2.util.CacheObject
getBlockCount, getPos, isChanged, isPinned, setBlockCount, setChanged, setPos, sort
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

index

protected final PageDataIndex index
The index.


parentPageId

protected int parentPageId
The page number of the parent.


data

protected final Data data
The data page.


entryCount

protected int entryCount
The number of entries.


keys

protected long[] keys
The row keys.


written

protected boolean written
Whether the data page is up-to-date.

Method Detail

read

public static Page read(PageDataIndex index,
                        Data data,
                        int pageId)
                 throws java.sql.SQLException
Read a data leaf page.

Parameters:
index - the index
data - the data
pageId - the page id
Returns:
the page
Throws:
java.sql.SQLException

remapChildren

protected void remapChildren()
                      throws java.sql.SQLException
Update the parent id of all children.

Throws:
java.sql.SQLException

getByteCount

public int getByteCount(DataPage dummy)
Description copied from class: Record
Get the number of bytes required for the data if the given data page would be used.

Specified by:
getByteCount in class Record
Parameters:
dummy - the template data page
Returns:
the number of bytes

write

public void write(DataPage buff)
           throws java.sql.SQLException
Description copied from class: Record
Write the record to the data page.

Specified by:
write in class Record
Parameters:
buff - the data page
Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

moveTo

public void moveTo(Session session,
                   int newPos)
            throws java.sql.SQLException
Description copied from class: Page
Copy the data to a new location, change the parent to point to the new location, and free up the current page.

Specified by:
moveTo in class Page
Parameters:
session - the session
newPos - the new position
Throws:
java.sql.SQLException

getMemorySize

public int getMemorySize()
Get the estimated memory size.

Returns:
number of double words (4 bytes)