sqlite bug fix
This commit is contained in:
parent
89d8834d80
commit
d3ba64477b
1 changed files with 6 additions and 6 deletions
|
|
@ -216,40 +216,40 @@ public class DBConnection implements Closeable{
|
||||||
public static <T> T exec(PreparedStatement stmt, SQLResultHandler<T> handler) throws SQLException{
|
public static <T> T exec(PreparedStatement stmt, SQLResultHandler<T> handler) throws SQLException{
|
||||||
try{
|
try{
|
||||||
// Execute
|
// Execute
|
||||||
stmt.execute();
|
boolean isResultSet = stmt.execute();
|
||||||
|
|
||||||
// Handle result
|
// Handle result
|
||||||
if( handler != null ){
|
if( handler != null ){
|
||||||
ResultSet result = null;
|
ResultSet result = null;
|
||||||
try{
|
try{
|
||||||
if(stmt.getMoreResults()){
|
if(isResultSet){
|
||||||
result = stmt.getResultSet();
|
result = stmt.getResultSet();
|
||||||
return handler.handleQueryResult(stmt, result);
|
return handler.handleQueryResult(stmt, result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}catch(SQLException sqlex){
|
}catch(SQLException sqlex){
|
||||||
logger.throwing(null, null, sqlex);
|
logger.log(Level.WARNING, null, sqlex);
|
||||||
}finally{
|
}finally{
|
||||||
if(result != null){
|
if(result != null){
|
||||||
try {
|
try {
|
||||||
result.close();
|
result.close();
|
||||||
} catch (SQLException sqlex) {
|
} catch (SQLException sqlex) {
|
||||||
logger.throwing(null, null, sqlex);
|
logger.log(Level.WARNING, null, sqlex);
|
||||||
}
|
}
|
||||||
result = null;
|
result = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(SQLException sqlex){
|
}catch(SQLException sqlex){
|
||||||
logger.throwing(null, null, sqlex);
|
logger.log(Level.WARNING, null, sqlex);
|
||||||
// Cleanup
|
// Cleanup
|
||||||
} finally {
|
} finally {
|
||||||
if (stmt != null) {
|
if (stmt != null) {
|
||||||
try {
|
try {
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (SQLException sqlex) {
|
} catch (SQLException sqlex) {
|
||||||
logger.throwing(null, null, sqlex);
|
logger.log(Level.WARNING, null, sqlex);
|
||||||
}
|
}
|
||||||
stmt = null;
|
stmt = null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue