|
8 | 8 | import io.arex.agent.bootstrap.model.Mocker.Target; |
9 | 9 | import io.arex.agent.bootstrap.util.MapUtils; |
10 | 10 | import io.arex.agent.bootstrap.util.StringUtil; |
11 | | -import io.arex.agent.thirdparty.util.parse.sqlparse.SqlParse; |
| 11 | +import io.arex.agent.thirdparty.util.parse.sqlparse.SqlParseManager; |
12 | 12 | import io.arex.agent.thirdparty.util.parse.sqlparse.constants.DbParseConstants; |
13 | 13 | import io.arex.agent.thirdparty.util.parse.sqlparse.util.ParseUtil; |
14 | 14 | import io.arex.inst.runtime.log.LogManager; |
|
25 | 25 | public final class MockUtils { |
26 | 26 |
|
27 | 27 | private static final String EMPTY_JSON = "{}"; |
28 | | - private static final SqlParse sqlParse = new SqlParse(); |
29 | 28 |
|
30 | 29 | private MockUtils() { |
31 | 30 | } |
@@ -59,14 +58,14 @@ public static ArexMocker createDatabase(String method, String sql, String dbName |
59 | 58 | try { |
60 | 59 | String[] splitSql = sql.split(";"); |
61 | 60 | for (String s : splitSql) { |
62 | | - JsonNode parse = sqlParse.parse(s); |
| 61 | + JsonNode parse = SqlParseManager.getInstance().parse(s); |
63 | 62 | if (parse != null) { |
64 | 63 | String action = parse.get(DbParseConstants.ACTION).asText(); |
65 | 64 | String tableName = ParseUtil.parseTable(parse); |
66 | 65 | operationName.append(dbName).append("-").append(tableName).append("-").append(action).append(";"); |
67 | 66 | } |
68 | 67 | } |
69 | | - } catch (JSQLParserException e) { |
| 68 | + } catch (Exception e) { |
70 | 69 | LogManager.warn("createDatabase", "parse sql error", e); |
71 | 70 | operationName = new StringBuilder(method); |
72 | 71 | } |
|
0 commit comments