throw new IndexOutOfBoundsException();
}
public void setObject(ExecutionContext ec, PreparedStatement preparedStmt, int[] exprIndex, Object value)
{
Blob blob = ((Blob)value);
if (blob == null) {
getDatastoreMapping(0).setString(preparedStmt, exprIndex[0], null);
getDatastoreMapping(1).setString(preparedStmt, exprIndex[1], null);
// using:
// getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], null);
// fails for PostgreSQL, as interprets as a reference to an oid (pointer to offline blob)
// rather than a bytea (inline blob)
try {
preparedStmt.setBytes(exprIndex[2], null);
} catch (SQLException e) {
// ignore
}
} else {
getDatastoreMapping(0).setString(preparedStmt, exprIndex[0], blob.getName());
getDatastoreMapping(1).setString(preparedStmt, exprIndex[1], blob.getMimeType().getBaseType());
getDatastoreMapping(2).setObject(preparedStmt, exprIndex[2], blob.getBytes());
}
}