Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support additional filetypes #69

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,12 @@ private void executeCommand(final Assertion assertion, final MysqlExecutionConfi
}
}
else {
if (sqlStatement.startsWith("create table")
if (sqlStatement.startsWith("create table")) {
// only add engine if we do not create using a like statement
&& (!(sqlStatement.contains("like") || sqlStatement.contains("as")))){
sqlStatement = sqlStatement + " ENGINE = MyISAM";
if (!sqlStatement.toUpperCase().contains(" ENGINE") &&
!(sqlStatement.contains("like") || sqlStatement.contains("as"))) {
sqlStatement = sqlStatement + " ENGINE = MyISAM";
}
}
executeUpdateStatement(connection, sqlStatement);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.ihtsdo.rvf.core.service.util;

import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;

Expand All @@ -11,6 +11,7 @@ public class RF2FileTableMapper {
private static final String STATED_RELATIONSHIP_FILE_HEADER = "sct2_StatedRelationship_";
private static final String SIMPLE_FILE_HEADER = "der2_Refset_.*Simple";
private static final String SIMPLE_MAP_FILE_HEADER = "der2_sRefset_.*SimpleMap";
private static final String INTEGER_SIMPLE_MAP_FILE_HEADER = "der2_iRefset_.*SimpleMap";
private static final String RELATIONSHIP_FILE_HEADER = "sct2_Relationship_";
private static final String RELATIONSHIP_CONCRETE_VALUES_FILE_HEADER = "sct2_RelationshipConcreteValues";
private static final String LANGUAGE_FILE_HEADER = "der2_cRefset_.*Language";
Expand All @@ -30,7 +31,14 @@ public class RF2FileTableMapper {
private static final String MRCM_ATRRIBUTE_RANGE_FILE_HEADER = "der2_ssccRefset_.*MRCMAttributeRange";
private static final String MRCM_DOMAIN_FILE_HEADER = "der2_sssssssRefset_.*MRCMDomain";
private static final String DESCRIPTION_TYPE_FILE_HEADER = "der2_ciRefset_.*DescriptionType";
private static final Map<String,String> tableNameMap = new HashMap<>();
private static final String ATTRIBUTE_VALUE_MAP_FILE_HEADER = "der2_csRefset_.*AttributeValueMap";
private static final String EXTENDED_ASSOCIATION_FILE_HEADER = "der2_ccRefset_.*ExtendedAssociation";
private static final String IDENTIFIER_FILE_HEADER = "sct2_Identifier_";
private static final String CCS_REFSET_FILE_HEADER = "der2_ccsRefset_";
private static final String CCI_REFSET_FILE_HEADER = "der2_cciRefset_";
private static final String C_REFSET_FILE_HEADER = "der2_cRefset_";

private static final Map<String,String> tableNameMap = new LinkedHashMap<>();
private static final String DELTA = ".*Delta.*_*_\\d{8}.txt";
private static final String SNAPSHOT = ".*Snapshot.*_*_\\d{8}.txt";
private static final String FULL = ".*Full.*_*_\\d{8}.txt";
Expand Down Expand Up @@ -60,7 +68,14 @@ public class RF2FileTableMapper {
tableNameMap.put(MRCM_ATRRIBUTE_RANGE_FILE_HEADER + DELTA, "mrcmattributerangerefset_d");
tableNameMap.put(MRCM_DOMAIN_FILE_HEADER + DELTA, "mrcmdomainrefset_d");
tableNameMap.put(DESCRIPTION_TYPE_FILE_HEADER + DELTA, "descriptiontyperefset_d");

tableNameMap.put(ATTRIBUTE_VALUE_MAP_FILE_HEADER + DELTA, "attributevaluemap_d");
tableNameMap.put(EXTENDED_ASSOCIATION_FILE_HEADER + DELTA, "extendedassociation_d");
tableNameMap.put(IDENTIFIER_FILE_HEADER + DELTA, "identifier_d");
tableNameMap.put(INTEGER_SIMPLE_MAP_FILE_HEADER + DELTA, "isimplemaprefset_d");
tableNameMap.put(CCS_REFSET_FILE_HEADER + DELTA, "ccsrefset_d");
tableNameMap.put(CCI_REFSET_FILE_HEADER + DELTA, "ccirefset_d");
tableNameMap.put(C_REFSET_FILE_HEADER + DELTA, "crefset_d");

//Full
tableNameMap.put(CONCEPT_FILE_HEADER + FULL, "concept_f");
tableNameMap.put(DESCRIPTION_FILE_HEADER + FULL, "description_f");
Expand All @@ -85,7 +100,14 @@ public class RF2FileTableMapper {
tableNameMap.put(MRCM_ATRRIBUTE_RANGE_FILE_HEADER + FULL, "mrcmattributerangerefset_f");
tableNameMap.put(MRCM_DOMAIN_FILE_HEADER + FULL, "mrcmdomainrefset_f");
tableNameMap.put(DESCRIPTION_TYPE_FILE_HEADER + FULL, "descriptiontyperefset_f");

tableNameMap.put(ATTRIBUTE_VALUE_MAP_FILE_HEADER + FULL, "attributevaluemap_f");
tableNameMap.put(EXTENDED_ASSOCIATION_FILE_HEADER + FULL, "extendedassociation_f");
tableNameMap.put(IDENTIFIER_FILE_HEADER + FULL, "identifier_f");
tableNameMap.put(INTEGER_SIMPLE_MAP_FILE_HEADER + FULL, "isimplemaprefset_f");
tableNameMap.put(CCS_REFSET_FILE_HEADER + FULL, "ccsrefset_f");
tableNameMap.put(CCI_REFSET_FILE_HEADER + FULL, "ccirefset_f");
tableNameMap.put(C_REFSET_FILE_HEADER + FULL, "crefset_f");

//Snapshot
tableNameMap.put(CONCEPT_FILE_HEADER + SNAPSHOT, "concept_s");
tableNameMap.put(DESCRIPTION_FILE_HEADER + SNAPSHOT, "description_s");
Expand All @@ -110,6 +132,13 @@ public class RF2FileTableMapper {
tableNameMap.put(MRCM_ATRRIBUTE_RANGE_FILE_HEADER + SNAPSHOT, "mrcmattributerangerefset_s");
tableNameMap.put(MRCM_DOMAIN_FILE_HEADER + SNAPSHOT, "mrcmdomainrefset_s");
tableNameMap.put(DESCRIPTION_TYPE_FILE_HEADER + SNAPSHOT, "descriptiontyperefset_s");
tableNameMap.put(ATTRIBUTE_VALUE_MAP_FILE_HEADER + SNAPSHOT, "attributevaluemap_s");
tableNameMap.put(EXTENDED_ASSOCIATION_FILE_HEADER + SNAPSHOT, "extendedassociation_s");
tableNameMap.put(IDENTIFIER_FILE_HEADER + SNAPSHOT, "identifier_s");
tableNameMap.put(INTEGER_SIMPLE_MAP_FILE_HEADER + SNAPSHOT, "isimplemaprefset_s");
tableNameMap.put(CCS_REFSET_FILE_HEADER + SNAPSHOT, "ccsrefset_s");
tableNameMap.put(CCI_REFSET_FILE_HEADER + SNAPSHOT, "ccirefset_s");
tableNameMap.put(C_REFSET_FILE_HEADER + SNAPSHOT, "crefset_s");
}

public static String getLegacyTableName(final String filename) {
Expand Down
Loading