Package: JenaPreparedStatement
JenaPreparedStatement
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JenaPreparedStatement(StatementExecutor, String) |
|
|
|
|
|
||||||||||||||||||||
clearParameters() |
|
|
|
|
|
||||||||||||||||||||
executeQuery() |
|
|
|
|
|
||||||||||||||||||||
executeUpdate() |
|
|
|
|
|
||||||||||||||||||||
setObject(String, Object) |
|
|
|
|
|
Coverage
1: package cz.cvut.kbss.ontodriver.jena.query;
2:
3: import cz.cvut.kbss.ontodriver.PreparedStatement;
4: import cz.cvut.kbss.ontodriver.ResultSet;
5: import cz.cvut.kbss.ontodriver.jena.connector.StatementExecutor;
6: import cz.cvut.kbss.ontodriver.jena.exception.JenaDriverException;
7: import cz.cvut.kbss.ontodriver.util.StatementHolder;
8:
9: import java.util.Objects;
10:
11: public class JenaPreparedStatement extends JenaStatement implements PreparedStatement {
12:
13: private final StatementHolder holder;
14:
15: public JenaPreparedStatement(StatementExecutor executor, String sparql) {
16: super(executor);
17: this.holder = new StatementHolder(sparql);
18:• if (holder.getStatement().isEmpty()) {
19: throw new IllegalArgumentException("Statement cannot be empty.");
20: }
21: holder.analyzeStatement();
22: }
23:
24: @Override
25: public ResultSet executeQuery() throws JenaDriverException {
26: ensureOpen();
27: return executeQuery(holder.assembleStatement());
28: }
29:
30: @Override
31: public void executeUpdate() throws JenaDriverException {
32: ensureOpen();
33: executeUpdate(holder.assembleStatement());
34: }
35:
36: @Override
37: public void setObject(String binding, Object value) {
38: ensureOpen();
39: Objects.requireNonNull(binding);
40: Objects.requireNonNull(value);
41: holder.setParameter(binding, value.toString());
42: }
43:
44: @Override
45: public void clearParameters() {
46: ensureOpen();
47: holder.clearParameters();
48: }
49: }