From a0c5a05bded5f265079f444b9e113a0d40660d75 Mon Sep 17 00:00:00 2001 From: James Ahlborn Date: Fri, 14 Mar 2008 19:18:07 +0000 Subject: [PATCH] restrict new tables to only one autonumber column git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@272 f203690c-595d-4dc9-a70b-905162fa7fd2 --- src/java/com/healthmarketscience/jackcess/Database.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/java/com/healthmarketscience/jackcess/Database.java b/src/java/com/healthmarketscience/jackcess/Database.java index 6d510df..d99393b 100644 --- a/src/java/com/healthmarketscience/jackcess/Database.java +++ b/src/java/com/healthmarketscience/jackcess/Database.java @@ -462,6 +462,11 @@ public class Database } } + if(Table.countAutoNumberColumns(columns) > 1) { + throw new IllegalArgumentException( + "Can have at most one AutoNumber column per table"); + } + //Write the tdef page to disk. int tdefPageNumber = Table.writeTableDefinition(columns, _pageChannel, _format); @@ -925,8 +930,8 @@ public class Database */ private static class TableInfo { - public Integer pageNumber; - public String tableName; + public final Integer pageNumber; + public final String tableName; private TableInfo(Integer newPageNumber, String newTableName) { -- 2.39.5