From 596d83898a3ba6cfcbcb80dde9431dea93e18be9 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Wed, 20 Mar 2013 01:51:12 +0000 Subject: [PATCH] util method for getting new RowId git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/branches/jackcess-2@698 f203690c-595d-4dc9-a70b-905162fa7fd2 --- .../jackcess/complex/ComplexColumnInfo.java | 3 ++- .../com/healthmarketscience/jackcess/impl/TableImpl.java | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/java/com/healthmarketscience/jackcess/complex/ComplexColumnInfo.java b/src/java/com/healthmarketscience/jackcess/complex/ComplexColumnInfo.java index ae17510..3b9ab66 100644 --- a/src/java/com/healthmarketscience/jackcess/complex/ComplexColumnInfo.java +++ b/src/java/com/healthmarketscience/jackcess/complex/ComplexColumnInfo.java @@ -273,7 +273,8 @@ public abstract class ComplexColumnInfo protected ComplexValueIdImpl getValueId(Object[] row) { int idVal = (Integer)getPrimaryKeyColumn().getRowValue(row); - return new ComplexValueIdImpl(idVal, (RowId)row[row.length - 1]); + return new ComplexValueIdImpl(idVal, + ((TableImpl)_flatTable).getRowId(row)); } protected Object[] asRow(Object[] row, V value) { diff --git a/src/java/com/healthmarketscience/jackcess/impl/TableImpl.java b/src/java/com/healthmarketscience/jackcess/impl/TableImpl.java index 919c17f..ae5a33a 100644 --- a/src/java/com/healthmarketscience/jackcess/impl/TableImpl.java +++ b/src/java/com/healthmarketscience/jackcess/impl/TableImpl.java @@ -1281,6 +1281,15 @@ public class TableImpl implements Table return asRow(rowMap, Column.KEEP_VALUE, false); } + /** + * @return the generated RowId added to a row of values created via {@link + * #asRowWithRowId} + * @usage _intermediate_method_ + */ + public RowId getRowId(Object[] row) { + return (RowId)row[_columns.size()]; + } + /** * Converts a map of columnName -> columnValue to an array of row values. */ -- 2.39.5