Browse Source

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
tags/jackcess-4.0.1
James Ahlborn 2 years ago
parent
commit
3ff4ae6d67

+ 3
- 0
src/changes/changes.xml View File

<action dev="jahlborn" type="fix"> <action dev="jahlborn" type="fix">
Ignore trailing spaces when creating text index entries. Ignore trailing spaces when creating text index entries.
</action> </action>
<action dev="jahlborn" type="update">
Add basic support for access 2019+ dbs.
</action>
</release> </release>
<release version="4.0.0" date="2021-01-20"> <release version="4.0.0" date="2021-01-20">
<action dev="jahlborn" type="update"> <action dev="jahlborn" type="update">

+ 2
- 0
src/main/java/com/healthmarketscience/jackcess/Database.java View File

V2010(".accdb"), V2010(".accdb"),
/** A database which was created by MS Access 2016+ */ /** A database which was created by MS Access 2016+ */
V2016(".accdb"), V2016(".accdb"),
/** A database which was created by MS Access 2019+ (Office 365) */
V2019(".accdb"),
/** A database which was created by MS Money */ /** A database which was created by MS Money */
MSISAM(".mny"); MSISAM(".mny");



+ 2
- 1
src/main/java/com/healthmarketscience/jackcess/impl/DatabaseImpl.java View File

addFileFormatDetails(FileFormat.V2007, "empty2007", JetFormat.VERSION_12); addFileFormatDetails(FileFormat.V2007, "empty2007", JetFormat.VERSION_12);
addFileFormatDetails(FileFormat.V2010, "empty2010", JetFormat.VERSION_14); addFileFormatDetails(FileFormat.V2010, "empty2010", JetFormat.VERSION_14);
addFileFormatDetails(FileFormat.V2016, "empty2016", JetFormat.VERSION_16); addFileFormatDetails(FileFormat.V2016, "empty2016", JetFormat.VERSION_16);
addFileFormatDetails(FileFormat.V2019, "empty2019", JetFormat.VERSION_17);
addFileFormatDetails(FileFormat.MSISAM, null, JetFormat.VERSION_MSISAM); addFileFormatDetails(FileFormat.MSISAM, null, JetFormat.VERSION_MSISAM);
} }


private static final int DB_PARENT_ID = 0xF000000; private static final int DB_PARENT_ID = 0xF000000;


/** the maximum size of any of the included "empty db" resources */ /** 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 */ /** this object is a "system" object */
static final int SYSTEM_OBJECT_FLAG = 0x80000000; static final int SYSTEM_OBJECT_FLAG = 0x80000000;

+ 33
- 3
src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java View File

private static final byte CODE_VERSION_12 = 0x2; private static final byte CODE_VERSION_12 = 0x2;
/** Version code for Jet version 14.0 */ /** Version code for Jet version 14.0 */
private static final byte CODE_VERSION_14 = 0x3; 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; 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 */ /** location of the engine name in the header */
public static final int OFFSET_ENGINE_NAME = 0x4; public static final int OFFSET_ENGINE_NAME = 0x4;
private static final Map<String,Database.FileFormat> POSSIBLE_VERSION_16 = private static final Map<String,Database.FileFormat> POSSIBLE_VERSION_16 =
Collections.singletonMap((String)null, Database.FileFormat.V2016); 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 = private static final Map<String,Database.FileFormat> POSSIBLE_VERSION_MSISAM =
Collections.singletonMap((String)null, Database.FileFormat.MSISAM); Collections.singletonMap((String)null, Database.FileFormat.MSISAM);


public static final JetFormat VERSION_12 = new Jet12Format(); public static final JetFormat VERSION_12 = new Jet12Format();
/** the JetFormat constants for the Jet database version "14.0" */ /** the JetFormat constants for the Jet database version "14.0" */
public static final JetFormat VERSION_14 = new Jet14Format(); 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(); 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 //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 //populated by the subclass's constructor because they are final, and Java
return VERSION_14; return VERSION_14;
} else if (version == CODE_VERSION_16) { } else if (version == CODE_VERSION_16) {
return VERSION_16; return VERSION_16;
} else if (version == CODE_VERSION_17) {
return VERSION_17;
} }
throw new IOException("Unsupported " + throw new IOException("Unsupported " +
((version < CODE_VERSION_3) ? "older" : "newer") + ((version < CODE_VERSION_3) ? "older" : "newer") +
} }
} }


private static final class Jet16Format extends Jet14Format {
private static class Jet16Format extends Jet14Format {


private Jet16Format() { private Jet16Format() {
super("VERSION_16"); super("VERSION_16");
} }


private Jet16Format(String name) {
super(name);
}

@Override @Override
public boolean isSupportedDataType(DataType type) { public boolean isSupportedDataType(DataType type) {
return true; return true;
} }
} }


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;
}
}

} }

BIN
src/main/resources/com/healthmarketscience/jackcess/empty2019.accdb View File


+ 7
- 0
src/test/java/com/healthmarketscience/jackcess/DatabaseTest.java View File

sysTables.add("f_12D7448B56564D8AAE333BCC9B3718E5_Data"); sysTables.add("f_12D7448B56564D8AAE333BCC9B3718E5_Data");
sysTables.add("MSysResources"); 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()); assertEquals(sysTables, db.getSystemTableNames());

Loading…
Cancel
Save