Parcourir la source

add some methods to approximate table size

git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@569 f203690c-595d-4dc9-a70b-905162fa7fd2
tags/jackcess-1.2.5
James Ahlborn il y a 13 ans
Parent
révision
599d2da23e

+ 3
- 0
src/changes/changes.xml Voir le fichier

@@ -15,6 +15,9 @@
<action dev="jahlborn" type="update">
Enable basic handling of unsupported data types as binary content.
</action>
<action dev="jahlborn" type="update">
Add methods to approximate table size.
</action>
</release>
<release version="1.2.4" date="2011-05-14">
<action dev="jahlborn" type="update">

+ 7
- 0
src/java/com/healthmarketscience/jackcess/IndexData.java Voir le fichier

@@ -330,6 +330,13 @@ public abstract class IndexData {
return _maxPageEntrySize;
}

/**
* Returns the number of database pages owned by this index data.
*/
public int getOwnedPageCount() {
return _ownedPages.getPageCount();
}
void addOwnedPage(int pageNumber) throws IOException {
_ownedPages.addPageNumber(pageNumber);
}

+ 23
- 0
src/java/com/healthmarketscience/jackcess/Table.java Voir le fichier

@@ -289,6 +289,29 @@ public class Table
protected UsageMap.PageCursor getOwnedPagesCursor() {
return _ownedPages.cursor();
}

/**
* Returns the <i>approximate</i> number of database pages owned by this
* table and all related indexes (this number does <i>not</i> take into
* account pages used for large OLE/MEMO fields).
* <p>
* To calculate the approximate number of bytes owned by a table:
* <code>
* int approxTableBytes = (table.getApproximateOwnedPageCount() *
* table.getFormat().PAGE_SIZE);
* </code>
*/
public int getApproximateOwnedPageCount() {
// add a page for the table def (although that might actually be more than
// one page)
int count = _ownedPages.getPageCount() + 1;
// note, we count owned pages from _physical_ indexes, not logical indexes
// (otherwise we could double count pages)
for(IndexData indexData : _indexDatas) {
count += indexData.getOwnedPageCount();
}
return count;
}
protected TempPageHolder getLongValueBuffer() {
return _longValueBufferH;

+ 4
- 0
src/java/com/healthmarketscience/jackcess/UsageMap.java Voir le fichier

@@ -150,6 +150,10 @@ public class UsageMap
return new PageCursor();
}

public int getPageCount() {
return _pageNumbers.cardinality();
}
protected short getRowStart() {
return _rowStart;
}

Chargement…
Annuler
Enregistrer