use of org.firebirdsql.jdbc.field.FBFlushableField in project jaybird by FirebirdSQL.
the class AbstractPreparedStatement method flushFields.
/**
* Flush fields that might have cached data.
*
* @throws SQLException if something went wrong.
*/
private void flushFields() throws SQLException {
// flush any cached data that can be hanging
for (int i = 0; i < isParamSet.length; i++) {
FBField field = getField(i + 1);
if (!(field instanceof FBFlushableField))
continue;
((FBFlushableField) field).flushCachedData();
}
}
use of org.firebirdsql.jdbc.field.FBFlushableField in project jaybird by FirebirdSQL.
the class FBCachedFetcher method cacheBlobsInRow.
private static void cacheBlobsInRow(final GDSHelper gdsHelper, final RowDescriptor rowDescriptor, final boolean[] isBlob, final RowValue localRow) throws SQLException {
// ugly blob caching workaround.
for (int j = 0; j < localRow.getCount(); j++) {
// if field is blob and there is a value to cache
final byte[] tempData = localRow.getFieldData(j);
if (isBlob[j] && tempData != null) {
final FieldDataProvider dataProvider = new FieldDataProvider() {
@Override
public byte[] getFieldData() {
return tempData;
}
@Override
public void setFieldData(byte[] data) {
throw new UnsupportedOperationException();
}
};
// copy data from current row
final FBFlushableField blob = (FBFlushableField) FBField.createField(rowDescriptor.getFieldDescriptor(j), dataProvider, gdsHelper, false);
// TODO setCachedObject instead?
localRow.setFieldData(j, blob.getCachedData());
}
}
}
Aggregations