Skip to content

Package: PreparedStatement

PreparedStatement

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.ontodriver;
19:
20: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
21:
22: /**
23: * This interface extends the {@code Statement} and adds the possibility to parametrize queries
24: * <p>
25: * Implementations are also expected to support at least a basic level of character escaping (e.g. quotes) and other
26: * injection-protection methods.
27: */
28: public interface PreparedStatement extends Statement {
29:
30: /**
31: * Executes query represented by this statement.
32: *
33: * @return ResultSet of the query
34: * @throws OntoDriverException If an ontology access error occurs
35: * @throws IllegalStateException If called on a closed statement
36: */
37: ResultSet executeQuery() throws OntoDriverException;
38:
39: /**
40: * Executes an update represented by this statement.
41: *
42: * @throws OntoDriverException If an ontology access error occurs
43: * @throws IllegalStateException If called on a closed statement
44: */
45: void executeUpdate() throws OntoDriverException;
46:
47: /**
48: * Sets value of binding with the specified name.
49: *
50: * @param binding Binding name
51: * @param value The value of the parameter
52: * @throws OntoDriverException If there is no such binding in the statement or some other error occurs
53: * @throws IllegalStateException If called on a closed statement
54: */
55: void setObject(String binding, Object value) throws OntoDriverException;
56:
57: /**
58: * Clears the currently set parameters.
59: *
60: * @throws OntoDriverException If an ontology access error occurs
61: * @throws IllegalStateException If called on a closed statement
62: */
63: void clearParameters() throws OntoDriverException;
64: }