diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2021-06-04 22:32:31 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2021-06-04 22:32:31 +0000 |
commit | 3ff4ae6d6737e0a4411e259de9c042e1be9fa2e0 (patch) | |
tree | cb613e7f807e1afc974fc7e605ca2f9a1c17a553 | |
parent | 332c3c787f03c39f43bc6fb4ed83c98bef10ad8c (diff) | |
download | jackcess-3ff4ae6d6737e0a4411e259de9c042e1be9fa2e0.tar.gz jackcess-3ff4ae6d6737e0a4411e259de9c042e1be9fa2e0.zip |
Add basic support for access 2019+ dbs.
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@1364 f203690c-595d-4dc9-a70b-905162fa7fd2
-rw-r--r-- | src/changes/changes.xml | 3 | ||||
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/Database.java | 2 | ||||
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java | 3 | ||||
-rw-r--r-- | src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java | 36 | ||||
-rwxr-xr-x | src/main/resources/com/healthmarketscience/jackcess/empty2019.accdb | bin | 0 -> 434176 bytes | |||
-rw-r--r-- | src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java | 7 |
6 files changed, 47 insertions, 4 deletions
diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 7fbba3e..e263ce4 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -8,6 +8,9 @@ <action dev="jahlborn" type="fix"> Ignore trailing spaces when creating text index entries. </action> + <action dev="jahlborn" type="update"> + Add basic support for access 2019+ dbs. + </action> </release> <release version="4.0.0" date="2021-01-20"> <action dev="jahlborn" type="update"> diff --git a/src/main/java/com/healthmarketscience/jackcess/Database.java b/src/main/java/com/healthmarketscience/jackcess/Database.java index 7e9dd85..7b93c5e 100644 --- a/src/main/java/com/healthmarketscience/jackcess/Database.java +++ b/src/main/java/com/healthmarketscience/jackcess/Database.java @@ -164,6 +164,8 @@ public interface Database extends Iterable<Table>, Closeable, Flushable V2010(".accdb"), /** A database which was created by MS Access 2016+ */ V2016(".accdb"), + /** A database which was created by MS Access 2019+ (Office 365) */ + V2019(".accdb"), /** A database which was created by MS Money */ MSISAM(".mny"); diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java b/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java index 1ff129e..7af0b87 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java @@ -123,6 +123,7 @@ public class DatabaseImpl implements Database, DateTimeContext addFileFormatDetails(FileFormat.V2007, "empty2007", JetFormat.VERSION_12); addFileFormatDetails(FileFormat.V2010, "empty2010", JetFormat.VERSION_14); addFileFormatDetails(FileFormat.V2016, "empty2016", JetFormat.VERSION_16); + addFileFormatDetails(FileFormat.V2019, "empty2019", JetFormat.VERSION_17); addFileFormatDetails(FileFormat.MSISAM, null, JetFormat.VERSION_MSISAM); } @@ -189,7 +190,7 @@ public class DatabaseImpl implements Database, DateTimeContext private static final int DB_PARENT_ID = 0xF000000; /** the maximum size of any of the included "empty db" resources */ - private static final long MAX_EMPTYDB_SIZE = 370000L; + private static final long MAX_EMPTYDB_SIZE = 440000L; /** this object is a "system" object */ static final int SYSTEM_OBJECT_FLAG = 0x80000000; diff --git a/src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java b/src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java index 8a3aa64..ff3c00f 100644 --- a/src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java +++ b/src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java @@ -59,8 +59,10 @@ public abstract class JetFormat { private static final byte CODE_VERSION_12 = 0x2; /** Version code for Jet version 14.0 */ private static final byte CODE_VERSION_14 = 0x3; - /** Version code for Jet version 16.7 */ + /** Version code for Jet version 16.0 */ private static final byte CODE_VERSION_16 = 0x5; + /** Version code for Jet version 17.0 */ + private static final byte CODE_VERSION_17 = 0x6; /** location of the engine name in the header */ public static final int OFFSET_ENGINE_NAME = 0x4; @@ -127,6 +129,9 @@ public abstract class JetFormat { private static final Map<String,Database.FileFormat> POSSIBLE_VERSION_16 = Collections.singletonMap((String)null, Database.FileFormat.V2016); + private static final Map<String,Database.FileFormat> POSSIBLE_VERSION_17 = + Collections.singletonMap((String)null, Database.FileFormat.V2019); + private static final Map<String,Database.FileFormat> POSSIBLE_VERSION_MSISAM = Collections.singletonMap((String)null, Database.FileFormat.MSISAM); @@ -160,8 +165,10 @@ public abstract class JetFormat { public static final JetFormat VERSION_12 = new Jet12Format(); /** the JetFormat constants for the Jet database version "14.0" */ public static final JetFormat VERSION_14 = new Jet14Format(); - /** the JetFormat constants for the Jet database version "16.7" */ + /** the JetFormat constants for the Jet database version "16.0" */ public static final JetFormat VERSION_16 = new Jet16Format(); + /** the JetFormat constants for the Jet database version "17.0" */ + public static final JetFormat VERSION_17 = new Jet17Format(); //These constants are populated by this class's constructor. They can't be //populated by the subclass's constructor because they are final, and Java @@ -306,6 +313,8 @@ public abstract class JetFormat { return VERSION_14; } else if (version == CODE_VERSION_16) { return VERSION_16; + } else if (version == CODE_VERSION_17) { + return VERSION_17; } throw new IOException("Unsupported " + ((version < CODE_VERSION_3) ? "older" : "newer") + @@ -1093,12 +1102,16 @@ public abstract class JetFormat { } } - private static final class Jet16Format extends Jet14Format { + private static class Jet16Format extends Jet14Format { private Jet16Format() { super("VERSION_16"); } + private Jet16Format(String name) { + super(name); + } + @Override public boolean isSupportedDataType(DataType type) { return true; @@ -1115,4 +1128,21 @@ public abstract class JetFormat { } } + private static final class Jet17Format extends Jet16Format { + + private Jet17Format() { + super("VERSION_17"); + } + + @Override + public boolean isSupportedDataType(DataType type) { + return true; + } + + @Override + protected Map<String,Database.FileFormat> getPossibleFileFormats() { + return PossibleFileFormats.POSSIBLE_VERSION_17; + } + } + } diff --git a/src/main/resources/com/healthmarketscience/jackcess/empty2019.accdb b/src/main/resources/com/healthmarketscience/jackcess/empty2019.accdb Binary files differnew file mode 100755 index 0000000..e1bdbed --- /dev/null +++ b/src/main/resources/com/healthmarketscience/jackcess/empty2019.accdb diff --git a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java index d127f9f..aa90a41 100644 --- a/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java +++ b/src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java @@ -773,6 +773,13 @@ public class DatabaseTest extends TestCase sysTables.add("f_12D7448B56564D8AAE333BCC9B3718E5_Data"); sysTables.add("MSysResources"); } + if(fileFormat.ordinal() >= FileFormat.V2019.ordinal()) { + sysTables.remove("f_12D7448B56564D8AAE333BCC9B3718E5_Data"); + sysTables.add("f_8FA5340F56044616AE380F64A2FEC135_Data"); + sysTables.add("MSysWSDPCacheComplexColumnMapping"); + sysTables.add("MSysWSDPChangeTokenMapping"); + sysTables.add("MSysWSDPRelationshipMapping"); + } } assertEquals(sysTables, db.getSystemTableNames()); |