use of org.firebirdsql.jdbc.field.FBCloseableField in project jaybird by FirebirdSQL.
the class FBResultSet method closeFields.
/**
* Close the fields if they were open (applies mainly to the stream fields).
*
* @throws SQLException
* if something wrong happened.
*/
protected void closeFields() throws SQLException {
// TODO See if we can apply completion reason logic (eg no need to close blob on commit)
wasNullValid = false;
// if there are no fields to close, then nothing to do
if (closeableFields.isEmpty())
return;
SQLExceptionChainBuilder<SQLException> chain = new SQLExceptionChainBuilder<>();
// close current fields, so that resources are freed.
for (final FBCloseableField field : closeableFields) {
try {
field.close();
} catch (SQLException ex) {
chain.append(ex);
}
}
if (chain.hasException()) {
throw chain.getException();
}
}
use of org.firebirdsql.jdbc.field.FBCloseableField in project jaybird by FirebirdSQL.
the class FBResultSet method prepareVars.
private void prepareVars(boolean cached) throws SQLException {
for (int i = 0; i < rowDescriptor.getCount(); i++) {
final int fieldPosition = i;
FieldDataProvider dataProvider = new FieldDataProvider() {
@Override
public byte[] getFieldData() {
return row.getFieldData(fieldPosition);
}
@Override
public void setFieldData(byte[] data) {
row.setFieldData(fieldPosition, data);
}
};
final FBField field = FBField.createField(rowDescriptor.getFieldDescriptor(i), dataProvider, gdsHelper, cached);
if (field instanceof FBCloseableField) {
closeableFields.add((FBCloseableField) field);
}
fields[i] = field;
}
}
Aggregations