use of org.xipki.datasource.DataAccessException in project xipki by xipki.
the class DbToolBase method deleteFromTableWithLargerId.
public boolean deleteFromTableWithLargerId(String tableName, String idColumn, long id, Logger log) {
ParamUtil.requireNonBlank("tableName", tableName);
ParamUtil.requireNonBlank("idColumn", idColumn);
String sql = StringUtil.concatObjects("DELETE FROM ", tableName, " WHERE ", idColumn, ">", id);
Statement stmt;
try {
stmt = createStatement();
} catch (DataAccessException ex) {
log.error("could not create statement", ex);
return false;
}
try {
stmt.execute(sql);
} catch (Throwable th) {
String msg = String.format("could not delete columns from table %s with %s > %s", tableName, idColumn, id);
LogUtil.error(log, th, msg);
return false;
} finally {
releaseResources(stmt, null);
}
return true;
}
Aggregations