aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/healthmarketscience
diff options
context:
space:
mode:
authorJames Ahlborn <jtahlborn@yahoo.com>2009-12-22 02:39:46 +0000
committerJames Ahlborn <jtahlborn@yahoo.com>2009-12-22 02:39:46 +0000
commit8c625cfd2cfe8c76e1598daad488939a93d5eb04 (patch)
tree93b12b935ed3a035f30294431bd358b85d4e5629 /src/java/com/healthmarketscience
parent7556fa9a1600a1b1de1aed4fe4524d55b20236f3 (diff)
downloadjackcess-8c625cfd2cfe8c76e1598daad488939a93d5eb04.tar.gz
jackcess-8c625cfd2cfe8c76e1598daad488939a93d5eb04.zip
add support for index owned pages usage maps
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@422 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/java/com/healthmarketscience')
-rw-r--r--src/java/com/healthmarketscience/jackcess/Index.java13
-rw-r--r--src/java/com/healthmarketscience/jackcess/IndexPageCache.java3
2 files changed, 15 insertions, 1 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Index.java b/src/java/com/healthmarketscience/jackcess/Index.java
index 5300fe6..2da1fc2 100644
--- a/src/java/com/healthmarketscience/jackcess/Index.java
+++ b/src/java/com/healthmarketscience/jackcess/Index.java
@@ -154,6 +154,8 @@ public abstract class Index implements Comparable<Index> {
private byte _indexType;
/** Index name */
private String _name;
+ /** Usage map of pages that this index owns */
+ private UsageMap _ownedPages;
/** <code>true</code> if the index entries have been initialized,
<code>false</code> otherwise */
private boolean _initialized;
@@ -277,6 +279,10 @@ public abstract class Index implements Comparable<Index> {
return _maxPageEntrySize;
}
+ void addOwnedPage(int pageNumber) throws IOException {
+ _ownedPages.addPageNumber(pageNumber);
+ }
+
/**
* Returns the number of index entries in the index. Only called by unit
* tests.
@@ -353,7 +359,12 @@ public abstract class Index implements Comparable<Index> {
_columns.add(newColumnDescriptor(idxCol, colFlags));
}
}
- tableBuffer.getInt(); //Forward past Unknown
+
+ int umapRowNum = tableBuffer.get();
+ int umapPageNum = ByteUtil.get3ByteInt(tableBuffer);
+ _ownedPages = UsageMap.read(getTable().getDatabase(), umapPageNum,
+ umapRowNum, false);
+
_rootPageNumber = tableBuffer.getInt();
tableBuffer.getInt(); //Forward past Unknown
_indexFlags = tableBuffer.get();
diff --git a/src/java/com/healthmarketscience/jackcess/IndexPageCache.java b/src/java/com/healthmarketscience/jackcess/IndexPageCache.java
index b9940ab..6f9b6a7 100644
--- a/src/java/com/healthmarketscience/jackcess/IndexPageCache.java
+++ b/src/java/com/healthmarketscience/jackcess/IndexPageCache.java
@@ -741,6 +741,9 @@ public class IndexPageCache
// add to our page cache
_dataPages.put(dpMain._pageNumber, dpMain);
+ // update owned pages cache
+ _index.addOwnedPage(dpMain._pageNumber);
+
// needs to be written out
CacheDataPage cacheDataPage = new CacheDataPage(dpMain, dpExtra);
setModified(cacheDataPage);