]> source.dussan.org Git - jackcess.git/commitdiff
restrict new tables to only one autonumber column
authorJames Ahlborn <jtahlborn@yahoo.com>
Fri, 14 Mar 2008 19:18:07 +0000 (19:18 +0000)
committerJames Ahlborn <jtahlborn@yahoo.com>
Fri, 14 Mar 2008 19:18:07 +0000 (19:18 +0000)
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

index 6d510dfc4388c6e300dbd070e9e9b2e9a41d3b4b..d99393b30f1661df25ba742300078792b32f4a6f 100644 (file)
@@ -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) {