Skip to content

Commit

Permalink
fix Oracle的分隔符也使用了MySQL中使用的`,只需要使用默认的"就可以了
Browse files Browse the repository at this point in the history
  • Loading branch information
zouzg committed Jan 21, 2019
1 parent 12e9f18 commit e70dc25
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,9 @@ public void generate() throws Exception {
Configuration configuration = new Configuration();
Context context = new Context(ModelType.CONDITIONAL);
configuration.addContext(context);

context.addProperty("autoDelimitKeywords", "true");
context.addProperty("beginningDelimiter", "`");
context.addProperty("endingDelimiter", "`");


context.addProperty("javaFileEncoding", "UTF-8");

String dbType = selectedDatabaseConfig.getDbType();
String connectorLibPath = ConfigHelper.findConnectorLibPath(dbType);
_LOG.info("connectorLibPath: {}", connectorLibPath);
Expand All @@ -77,9 +74,13 @@ public void generate() throws Exception {
tableConfig.setSelectByExampleStatementEnabled(false);
}

context.addProperty("autoDelimitKeywords", "true");
if (DbType.MySQL.name().equals(dbType) || DbType.MySQL_8.name().equals(dbType)) {
tableConfig.setSchema(selectedDatabaseConfig.getSchema());
} else {
// 由于beginningDelimiter和endingDelimiter的默认值为双引号("),在Mysql中不能这么写,所以还要将这两个默认值改为`
context.addProperty("beginningDelimiter", "`");
context.addProperty("endingDelimiter", "`");
} else {
tableConfig.setCatalog(selectedDatabaseConfig.getSchema());
}
if (generatorConfig.isUseSchemaPrefix()) {
Expand Down

0 comments on commit e70dc25

Please sign in to comment.