diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2009-11-17 01:33:30 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2009-11-17 01:33:30 +0000 |
commit | efca0b593bc32e274b0923b87ecba989ca0406b4 (patch) | |
tree | bfed8b267c8e0a434a569eb902dd2e6c8b0f5b82 /src/java/com/healthmarketscience/jackcess/Table.java | |
parent | a49de754bce849d94719a473567e78b595fbdc9a (diff) | |
download | jackcess-efca0b593bc32e274b0923b87ecba989ca0406b4.tar.gz jackcess-efca0b593bc32e274b0923b87ecba989ca0406b4.zip |
add some more tests/utility code for row updates
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@410 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'src/java/com/healthmarketscience/jackcess/Table.java')
-rw-r--r-- | src/java/com/healthmarketscience/jackcess/Table.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/java/com/healthmarketscience/jackcess/Table.java b/src/java/com/healthmarketscience/jackcess/Table.java index efc9a1a..a358406 100644 --- a/src/java/com/healthmarketscience/jackcess/Table.java +++ b/src/java/com/healthmarketscience/jackcess/Table.java @@ -1152,6 +1152,24 @@ public class Table } /** + * Converts a map of columnName -> columnValue to an array of row values + * appropriate for a call to {@link #updateCurrentRow(Object...)}. + */ + public Object[] asUpdateRow(Map<String,Object> rowMap) { + Object[] row = new Object[_columns.size()]; + Arrays.fill(row, Column.KEEP_VALUE); + if(rowMap == null) { + return row; + } + for(Column col : _columns) { + if(rowMap.containsKey(col.getName())) { + row[col.getColumnIndex()] = rowMap.get(col.getName()); + } + } + return row; + } + + /** * Add a single row to this table and write it to disk * <p> * Note, if this table has an auto-number column, the value written will be |