public void setBinaryStream(OptimizedElementArray row, int columnPosition, InputStream stream, long length, LobService lobService) throws SQLException { if (length <= Integer.MAX_VALUE) { setBlob(row, columnPosition, lobService.createBlob(stream, length)); } else { throw ThriftExceptionUtil.newSQLException( SQLState.BLOB_TOO_LARGE_FOR_CLIENT, null, length, Integer.MAX_VALUE); } }
public final void initializeLobs(LobService lobService) throws SQLException { if (!hasLobs || nonPrimitives == null) return; final Object[] nonPrimitives = this.nonPrimitives; final long[] primitives = this.primitives; final int headerSize = this.headerSize; final int size = primitives.length - headerSize; for (int index = 0; index < size; index++) { final int type = getType(index); if (type == SnappyType.BLOB.getValue()) { final int lobIndex = (int)primitives[headerSize + index]; if (nonPrimitives[lobIndex] instanceof BlobChunk) { BlobChunk chunk = (BlobChunk)nonPrimitives[lobIndex]; nonPrimitives[lobIndex] = lobService.createBlob(chunk, false); } } else if (type == SnappyType.CLOB.getValue()) { final int lobIndex = (int)primitives[headerSize + index]; if (nonPrimitives[lobIndex] instanceof ClobChunk) { ClobChunk chunk = (ClobChunk)nonPrimitives[lobIndex]; nonPrimitives[lobIndex] = lobService.createClob(chunk, false); } } } }