GT-3294 Added support for sparse DB schemas. No need to version

ProgramUserData which does not utilize index tables
This commit is contained in:
ghidra1 2020-07-17 23:49:12 -04:00
parent fcb3151f94
commit 6783ae669f
34 changed files with 1306 additions and 379 deletions

View file

@ -50,8 +50,11 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
/**
* DB_VERSION should be incremented any time a change is made to the overall
* database schema associated with any of the managers.
*
* NOTE: 19-Jun-2020 Corrections to DB index tables should have no impact on user data
* PropertyMaps which are not indexed.
*/
static final int DB_VERSION = 2;
static final int DB_VERSION = 1;
/**
* UPGRADE_REQUIRED_BFORE_VERSION should be changed to DB_VERSION any time the
@ -59,7 +62,7 @@ class ProgramUserDataDB extends DomainObjectAdapterDB implements ProgramUserData
* until upgrade is performed). It is assumed that read-only mode is supported
* if the data's version is >= UPGRADE_REQUIRED_BEFORE_VERSION and <= DB_VERSION.
*/
private static final int UPGRADE_REQUIRED_BEFORE_VERSION = 2;
private static final int UPGRADE_REQUIRED_BEFORE_VERSION = 1;
private static final String TABLE_NAME = "ProgramUserData";
private final static Field[] COL_FIELDS = new Field[] { StringField.INSTANCE };

View file

@ -776,19 +776,18 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
currentHandler = currentHandler.getSubsequentHandler();
}
SourceArchive sourceArchive = dataType.getSourceArchive();
if (sourceArchive != null && sourceArchive.getArchiveType() == ArchiveType.BUILT_IN) {
return resolveBuiltIn(dataType, currentHandler);
}
resolvedDataType = getCachedResolve(dataType);
if (resolvedDataType != null) {
return resolvedDataType;
}
// if the dataType has no source or it has no ID (datatypes with no ID are
// always local i.e. pointers)
if (sourceArchive == null || dataType.getUniversalID() == null) {
SourceArchive sourceArchive = dataType.getSourceArchive();
if (sourceArchive != null && sourceArchive.getArchiveType() == ArchiveType.BUILT_IN) {
resolvedDataType = resolveBuiltIn(dataType, currentHandler);
}
else if (sourceArchive == null || dataType.getUniversalID() == null) {
// if the dataType has no source or it has no ID (datatypes with no ID are
// always local i.e. pointers)
resolvedDataType = resolveNoSourceDataType(dataType, currentHandler);
}
else if (!sourceArchive.getSourceArchiveID().equals(getUniversalID()) &&
@ -3690,11 +3689,6 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
@Override
public DataType getDataType(SourceArchive sourceArchive, UniversalID datatypeID) {
if (datatypeID.getValue() == 0) {
// DT remove this check
throw new AssertException("should not be called with id of 0");
}
UniversalID sourceID = sourceArchive == null ? null : sourceArchive.getSourceArchiveID();
return idsToDataTypeMap.getDataType(sourceID, datatypeID);
}

View file

@ -29,9 +29,9 @@ import ghidra.util.Saveable;
*/
public class GenericSaveable implements Saveable {
Record record;
Schema schema;
Class<?>[] fieldClasses = new Class<?>[0];
final Record record;
final Schema schema;
final Class<?>[] fieldClasses = new Class<?>[0];
/**
* Creates a generic saveable that can be used by the property map manager