improved sql parser. add new feature JdbcUtils.getCreateTableScript, for issue #1342

This commit is contained in:
wenshao
2017-07-24 01:16:43 +08:00
parent 2d8ded4f0c
commit 7a241d7da5
28 changed files with 662 additions and 40 deletions
@@ -766,4 +766,20 @@ public final class JdbcUtils implements JdbcConstants {
close(conn);
}
}
public static String getCreateTableScript(String dbType, Connection conn) throws SQLException {
return getCreateTableScript(dbType, conn, true, true);
}
public static String getCreateTableScript(String dbType, Connection conn, boolean sorted, boolean simplify) throws SQLException {
if (JdbcConstants.MYSQL.equals(dbType)) {
return MySqlUtils.getCreateTableScript(conn, sorted, simplify);
}
if (JdbcConstants.ORACLE.equals(dbType)) {
return OracleUtils.getCreateTableScript(conn, sorted, simplify);
}
throw new SQLException("getCreateTableScript dbType not support for " + dbType);
}
}