diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2013-10-01 22:57:05 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2013-10-01 22:57:05 +0000 |
commit | 97eadc5acd14baf615376a47aca70ba739b88ab1 (patch) | |
tree | 139d2e526c155aead880f04210e983a58bc818a2 | |
parent | a79079c62392fca4e002716b166b8348361f8456 (diff) | |
download | jackcess-97eadc5acd14baf615376a47aca70ba739b88ab1.tar.gz jackcess-97eadc5acd14baf615376a47aca70ba739b88ab1.zip |
minor updates and refactors
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@812 f203690c-595d-4dc9-a70b-905162fa7fd2
4 files changed, 19 insertions, 35 deletions
@@ -6,8 +6,6 @@ Missing pieces: * MEDIUM - implement table creation w/ complex columns * MEDIUM -- implement (optional) foreign key enforcement - * MEDIUM - implement write support for properties * EASY - implement table, column, index renaming @@ -26,15 +24,7 @@ Refactor goals: - clean up javadocs - enhance public api classes * add @usage tags to util classes -* change CodecHandler usage to handle not-inline decoding - - pass filename to CodecHandler, enable pwd callbacks CallbackHandler - - pass custom context to CodecHandler? - - rework CryptCodecProvider to have custom - javax.security.auth.callback.CallbackHandler which is only invoked if - password is definitely required. - implement page buffering in PageChannel * need to implement logical flushing in update code (startUpdate/finishUpdate) -- refactor free-space handlers Table/Column? - implement "lazy" usage maps (load on first usage)? -- implement some OLE support - add typed getter methods to Row diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java index 7d26fd7..8f808cb 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/ColumnImpl.java @@ -2170,7 +2170,7 @@ public class ColumnImpl implements Column, Comparable<ColumnImpl> { if(TableImpl.rowFitsOnDataPage(dataLength, lvalPage, getFormat())) { // the current page has space return lvalPage; -} + } } // need new page diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java index 240ebf6..1d7e2e0 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/TableImpl.java @@ -1792,28 +1792,29 @@ public class TableImpl implements Table TempPageHolder rowBufferH) throws IOException { - // find last data page (Not bothering to check other pages for free - // space.) + // find last data page (Not bothering to check other pages for free + // space.) UsageMap.PageCursor revPageCursor = ownedPages.cursor(); - revPageCursor.afterLast(); - while(true) { - int tmpPageNumber = revPageCursor.getPreviousPage(); - if(tmpPageNumber < 0) { - break; - } + revPageCursor.afterLast(); + while(true) { + int tmpPageNumber = revPageCursor.getPreviousPage(); + if(tmpPageNumber < 0) { + break; + } + // only use if actually listed in free space pages + if(!freeSpacePages.containsPageNumber(tmpPageNumber)) { + continue; + } ByteBuffer dataPage = rowBufferH.setPage(ownedPages.getPageChannel(), tmpPageNumber); - if(dataPage.get() == PageTypes.DATA) { - // found last data page, only use if actually listed in free space - // pages - if(freeSpacePages.containsPageNumber(tmpPageNumber)) { - return dataPage; - } - } + if(dataPage.get() == PageTypes.DATA) { + // found last data page with free space + return dataPage; } + } return null; - } + } /** * Updates the table definition after rows are modified. diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/UsageMap.java b/src/main/java/com/healthmarketscience/jackcess/impl/UsageMap.java index ac49c44..5db2eac 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/UsageMap.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/UsageMap.java @@ -330,13 +330,6 @@ public class UsageMap /** * Remove a page number from this usage map */ - public void removePageNumber(int pageNumber) throws IOException { - removePageNumber(pageNumber, false); - } - - /** - * Remove a page number from this usage map - */ protected void removePageNumber(int pageNumber, boolean force) throws IOException { @@ -681,7 +674,7 @@ public class UsageMap } // lastly, remove the new page - removePageNumber(newPageNumber); + removePageNumber(newPageNumber, false); } } |