Skip to content

Commit

Permalink
Fixed #100
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisser committed Jan 26, 2023
1 parent ed18697 commit 8c8cd31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ public static class Factory implements TransformerFactory {
private final EntityGraph entityGraph;
private final String scriptFile;
private final DatabaseMetaData metaData;
private final String datePattern;
private final String timePattern;
private final String timestampPattern;
private final Session session;

/**
Expand All @@ -103,15 +100,12 @@ public static class Factory implements TransformerFactory {
* database meta data
*/
public Factory(TransformerHandler transformerHandler, DatabaseMetaData metaData,
EntityGraph entityGraph, String scriptFile, String datePattern, String timePattern, String timestampPattern, Session session, ExecutionContext executionContext) {
EntityGraph entityGraph, String scriptFile, Session session, ExecutionContext executionContext) {
this.executionContext = executionContext;
this.transformerHandler = transformerHandler;
this.entityGraph = entityGraph;
this.scriptFile = scriptFile;
this.metaData = metaData;
this.datePattern = datePattern;
this.timePattern = timePattern;
this.timestampPattern = timestampPattern;
this.session = session;
}

Expand All @@ -124,20 +118,23 @@ public Factory(TransformerHandler transformerHandler, DatabaseMetaData metaData,
*/
@Override
public ResultSetReader create(Table table) throws SQLException {
return new LiquibaseXMLTransformer(table, transformerHandler, metaData, entityGraph, scriptFile, datePattern, timePattern, timestampPattern, session, executionContext);
return new LiquibaseXMLTransformer(table, transformerHandler, metaData, entityGraph, scriptFile, session, executionContext);
}
}

private LiquibaseXMLTransformer(Table table, TransformerHandler transformerHandler, DatabaseMetaData metaData,
EntityGraph entityGraph, String scriptFile, String datePattern, String timePattern, String timestampPattern, Session session, ExecutionContext executionContext) throws SQLException {
EntityGraph entityGraph, String scriptFile, Session session, ExecutionContext executionContext) throws SQLException {
this.executionContext = executionContext;
this.transformerHandler = transformerHandler;
this.entityGraph = entityGraph;
this.rowElementName = qualifiedTableName(table);
this.scriptFile = new File(scriptFile);
this.datePattern = new SimpleDateFormat(datePattern, Locale.ENGLISH);
this.timePattern = new SimpleDateFormat(timePattern, Locale.ENGLISH);
this.timestampPattern = new SimpleDateFormat(timestampPattern, Locale.ENGLISH);

// https://docs.liquibase.com/change-types/nested-tags/column.html
// valueDate: The date and time value to set the column to. Accepts the following formats: YYYY-MM-DD, hh:mm:ss, or YYYY-MM-DDThh:mm:ss.
this.datePattern = new SimpleDateFormat("YYYY-MM-DD", Locale.ENGLISH);
this.timePattern = new SimpleDateFormat("hh:mm:ss", Locale.ENGLISH);
this.timestampPattern = new SimpleDateFormat("YYYY-MM-DD'T'hh:mm:ss", Locale.ENGLISH);
this.session = session;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,7 @@ private TransformerFactory createTransformerFactory(OutputStreamWriter outputWri
} if (ScriptFormat.DBUNIT_FLAT_XML.equals(executionContext.getScriptFormat())) {
return new FlatXMLTransformer.Factory(transformerHandler, targetSession.getMetaData(), targetSession.dbms, executionContext);
} else if (ScriptFormat.LIQUIBASE_XML.equals(executionContext.getScriptFormat())) {
return new LiquibaseXMLTransformer.Factory(transformerHandler,targetSession.getMetaData(), entityGraph, filepath,
executionContext.getXmlDatePattern(),
executionContext.getXmlTimePattern(),
executionContext.getXmlTimeStampPattern(),
return new LiquibaseXMLTransformer.Factory(transformerHandler, targetSession.getMetaData(), entityGraph, filepath,
targetSession,
executionContext);
} else {
Expand Down Expand Up @@ -2094,7 +2091,7 @@ public void run() {
// bei "Delete" keine "deferred collections"
// aber: zutun weil auch bei delete optim.potential (z.b. single-table-export ohne jede assoc.)
// cli argument "-minimize-collections-optimation on|off" (oder besseren namen)
// API berücksichtigen
// API ber�cksichtigen
// export mit optimierung in stats (* 128? 256?) ((`s6`) % 1000) max 180, anderes sx?
//
// defer working table creation too, maybe they are don't needed
Expand Down

0 comments on commit 8c8cd31

Please sign in to comment.