From 14dfafc20d30463a3f248aaa628567bc9db421c6 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Thu, 21 Feb 2008 04:19:03 +0000 Subject: [PATCH] update rowCount in common method git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@228 f203690c-595d-4dc9-a70b-905162fa7fd2 --- src/java/com/healthmarketscience/jackcess/Table.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java index cfc7fcf..3e3cbbe 100644 --- a/src/java/com/healthmarketscience/jackcess/Table.java +++ b/src/java/com/healthmarketscience/jackcess/Table.java @@ -314,8 +314,7 @@ public class Table } // make sure table def gets updated - --_rowCount; - updateTableDefinition(); + updateTableDefinition(-1); } /** @@ -1107,20 +1106,20 @@ public class Table writeDataPage(dataPage, pageNumber); //Update tdef page - _rowCount += rows.size(); - updateTableDefinition(); + updateTableDefinition(rows.size()); } /** * Updates the table definition after rows are modified. */ - private void updateTableDefinition() throws IOException + private void updateTableDefinition(int rowCountInc) throws IOException { // load table definition ByteBuffer tdefPage = getPageChannel().createPageBuffer(); getPageChannel().readPage(tdefPage, _tableDefPageNumber); // make sure rowcount and autonumber are up-to-date + _rowCount += rowCountInc; tdefPage.putInt(getFormat().OFFSET_NUM_ROWS, _rowCount); tdefPage.putInt(getFormat().OFFSET_NEXT_AUTO_NUMBER, _lastAutoNumber); -- 2.39.5