statement = connection.prepareStatement(sql);
if (pid != null){
statement.setString(1,pid);
}
if (statement.execute()) {
throw new LowlevelStorageException(true,
"sql returned query results for a nonquery");
}
ensureSingleUpdate(statement);
} catch (SQLException e1) {
throw new LowlevelStorageException(true, "sql failurex (exec)", e1);
} finally {
try {
if (statement != null) {
statement.close();
}
if (connection != null) {
connectionPool.free(connection);
}
} catch (Exception e2) { // purposely general to include uninstantiated statement, connection
throw new LowlevelStorageException(true,
"sql failure closing statement, connection, pool (exec)",
e2);
} finally {
statement = null;
connection = null;