public class CachedPreparedStatement extends Object implements Callable<PreparedStatement>, Closeable
A simple object that wraps a lazy initialized PreparedStatement.
| Constructor and Description |
|---|
CachedPreparedStatement(Connection dbc,
String sql)
Create a new cached prepared statement.
|
| Modifier and Type | Method and Description |
|---|---|
PreparedStatement |
call()
Get the prepared statement, creating one if necessary.
|
void |
close()
Close the prepared statement.
|
public CachedPreparedStatement(Connection dbc, String sql)
Create a new cached prepared statement.
dbc - The database connection.sql - The SQL string.public PreparedStatement call() throws SQLException
Get the prepared statement, creating one if necessary.
call in interface Callable<PreparedStatement>SQLException - if there is an error preparing the statement.public void close()
throws IOException
Close the prepared statement.
close in interface Closeableclose in interface AutoCloseableIOException - if there is an error closing the statement.