Skip to content

Commit

Permalink
Merge pull request #8 from umjammer/0.0.8
Browse files Browse the repository at this point in the history
0.0.8
  • Loading branch information
umjammer authored May 31, 2024
2 parents 99de9fe + b2afa2f commit 495bbaf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>vavi</groupId>
<artifactId>vavi-sql-mdb</artifactId>
<version>0.0.7</version>
<version>0.0.8</version>

<name>Vavi SQL MDB API</name>
<organization>
Expand Down
14 changes: 8 additions & 6 deletions src/main/java/vavi/sql/EngineBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public String columnNameAt(int index) {
protected boolean isSelectAll;

/** values set by a prepared statement */
protected Map<Integer, Object> params;
private Map<Integer, Object> params;

/** table name and columns name, type and value */
private ResultSettable database;
Expand Down Expand Up @@ -184,7 +184,12 @@ public Function<Object[], Object> 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
Expand All @@ -200,14 +205,11 @@ public boolean execute(String sql) throws IOException {
}
}

/** engine specific routine */
protected abstract void executeInternal(String sql, Map<Integer, Object> params) throws IOException;

@Override
public boolean execute(String sql, Map<Integer, Object> params) throws IOException {
this.params = params;

executeInternal(sql, params);
executeInternal(sql);

// rpn
Deque<EngineBase.Phrase> stack = new ArrayDeque<>();
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/vavi/sql/JSqlParserEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,21 +65,6 @@ protected void executeInternal(String sql) throws IOException {
}
}

@Override
protected void executeInternal(String sql, Map<Integer, Object> 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() {

Expand Down

0 comments on commit 495bbaf

Please sign in to comment.