MCPcopy Create free account
hub / github.com/Nemo1870/sql-parse / SqlParser

Method SqlParser

src/main/java/com/sql/parse/util/SqlParser.java:39–56  ·  view source on GitHub ↗
(String sql)

Source from the content-addressed store, hash-verified

37 private String type;
38
39 public SqlParser(String sql) {
40 String normalizedSql = sql.toUpperCase().trim();
41 if (normalizedSql.indexOf("SELECT") == 0) {
42 statement = com.sql.parse.statement.Select.parse(sql);
43 type = "SELECT";
44 } else if (normalizedSql.indexOf("INSERT") == 0) {
45 statement = com.sql.parse.statement.Insert.parse(sql);
46 type = "INSERT";
47 } else if (normalizedSql.indexOf("UPDATE") == 0) {
48 statement = com.sql.parse.statement.Update.parse(sql);
49 type = "UPDATE";
50 } else if (normalizedSql.indexOf("DELETE") == 0) {
51 statement = com.sql.parse.statement.Delete.parse(sql);
52 type = "DELETE";
53 } else {
54 throw BaseException.errorCode(SqlParseConstant.CODE_010);
55 }
56 }
57
58 public String getType() {
59 return type;

Callers

nothing calls this directly

Calls 2

errorCodeMethod · 0.95
parseMethod · 0.45

Tested by

no test coverage detected