From fb0a7e9abc1920b08521d8d70195972d3730c356 Mon Sep 17 00:00:00 2001 From: Naohide Sano Date: Fri, 31 May 2024 16:35:03 +0900 Subject: [PATCH 1/2] simplify --- src/main/java/vavi/sql/EngineBase.java | 14 ++++++++------ src/main/java/vavi/sql/JSqlParserEngine.java | 16 ---------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/main/java/vavi/sql/EngineBase.java b/src/main/java/vavi/sql/EngineBase.java index 98fc7af..4945375 100644 --- a/src/main/java/vavi/sql/EngineBase.java +++ b/src/main/java/vavi/sql/EngineBase.java @@ -59,7 +59,7 @@ public String columnNameAt(int index) { protected boolean isSelectAll; /** values set by a prepared statement */ - protected Map params; + private Map params; /** table name and columns name, type and value */ private ResultSettable database; @@ -184,7 +184,12 @@ public Function eval(Phrase... prims) { } } - /** engine specific routine */ + /** + * engine specific routine + * @after {@link #isSelect} + * @after {@link #table} + * @after {@link #whereClause} + */ protected abstract void executeInternal(String sql) throws IOException; @Override @@ -200,14 +205,11 @@ public boolean execute(String sql) throws IOException { } } - /** engine specific routine */ - protected abstract void executeInternal(String sql, Map params) throws IOException; - @Override public boolean execute(String sql, Map params) throws IOException { this.params = params; - executeInternal(sql, params); + executeInternal(sql); // rpn Deque stack = new ArrayDeque<>(); diff --git a/src/main/java/vavi/sql/JSqlParserEngine.java b/src/main/java/vavi/sql/JSqlParserEngine.java index 59d24d5..470d791 100644 --- a/src/main/java/vavi/sql/JSqlParserEngine.java +++ b/src/main/java/vavi/sql/JSqlParserEngine.java @@ -11,7 +11,6 @@ import java.io.StringReader; import java.lang.System.Logger.Level; import java.util.List; -import java.util.Map; import net.sf.jsqlparser.JSQLParserException; import net.sf.jsqlparser.expression.Alias; @@ -66,21 +65,6 @@ protected void executeInternal(String sql) throws IOException { } } - @Override - protected void executeInternal(String sql, Map params) throws IOException { - try { - this.params = params; - - Reader reader = new StringReader(sql); - net.sf.jsqlparser.statement.Statement statement = parser.parse(reader); -logger.log(Level.TRACE, "statement: " + statement); - - statement.accept(statementVisitor); - } catch (JSQLParserException e) { - throw new IOException(e); - } - } - /** */ private final SelectVisitor selectVisitor = new SelectVisitorAdapter() { From b2afa2f9bae7e011029ebe210a261f10808e6b3f Mon Sep 17 00:00:00 2001 From: Naohide Sano Date: Fri, 31 May 2024 16:35:25 +0900 Subject: [PATCH 2/2] bump version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0e19bbf..ca1e6c5 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ vavi vavi-sql-mdb - 0.0.7 + 0.0.8 Vavi SQL MDB API