String id = lob.getReferenceStreamId(); LobHolder lobHolder = this.lobReferences.get(id); switch (mode) { if (lob.getReference() == null) { if (lobHolder == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30033, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30033)); lob.setReference(lobHolder.lob.getReference()); try { StorageMode storageMode = InputStreamFactory.getStorageMode(lob); if (lob.getReferenceStreamId() == null || (inlineLobs && (storageMode == StorageMode.MEMORY || (storageMode != StorageMode.FREE && lob.length()*(lob instanceof ClobType?2:1) <= maxMemoryBytes)))) { lob.setReferenceStreamId(null); if (lob.getReference() == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30034, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30034));
public long length() throws SQLException { if (length == -1) { if (InputStreamFactory.getStorageMode(this.reference) == StorageMode.FREE) { throw new SQLException("Already freed or streaming"); //$NON-NLS-1$ } length = computeLength(); } return length; }
public void readExternal(ObjectInput in, byte version) throws IOException, ClassNotFoundException { super.readExternal(in); try { this.encoding = (String)in.readObject(); } catch (OptionalDataException e) { this.encoding = Streamable.ENCODING; } try { if (version > 0) { this.type = ExternalizeUtil.readEnum(in, Type.class, Type.UNKNOWN); } else { this.type = (Type)in.readObject(); } } catch (OptionalDataException e) { this.type = Type.UNKNOWN; } catch(IOException e) { this.type = Type.UNKNOWN; } catch(ClassNotFoundException e) { this.type = Type.UNKNOWN; } }
@Override public void writeExternal(ObjectOutput out) throws IOException { try { length(); } catch (SQLException e) { writeReference(dataOutput); dataOutput.close(); writeBuffer = true;
public static InputStreamFactory getInputStreamFactory(Streamable<?> s) { if (s.getReference() instanceof Streamable<?>) { return getInputStreamFactory((Streamable<?>) s.getReference()); } if (s.getReference() instanceof BaseLob) { BaseLob bl = (BaseLob) s.getReference(); try { InputStreamFactory isf = bl.getStreamFactory(); if (isf != null) { return isf; } } catch (SQLException e) { } } if (s instanceof BaseClobType) { return new InputStreamFactory.ClobInputStreamFactory((Clob)s.getReference()); } else if (s instanceof BlobType){ return new InputStreamFactory.BlobInputStreamFactory((Blob)s.getReference()); } return new InputStreamFactory.SQLXMLInputStreamFactory((SQLXML)s.getReference()); }
byteLength = lob.length()*(lob instanceof ClobType?2:1); } catch (SQLException e) { if (lob.getReferenceStreamId() == null || (inlineLobs && (byteLength <= maxMemoryBytes))) { lob.setReferenceStreamId(null); if (InputStreamFactory.getStorageMode(lob) == StorageMode.MEMORY) { return;
public LobChunk getNextChunk() throws IOException { try { Future<LobChunk> result = dqp.requestNextLobChunk(streamRequestId, requestId, streamable.getReferenceStreamId()); return result.get(); } catch (Exception e) { IOException ex = new IOException(JDBCPlugin.Util.getString("StreamImpl.Unable_to_read_data_from_stream", e.getMessage())); //$NON-NLS-1$ ex.initCause(e); throw ex; } }
@Override public long length() throws SQLException { if (this.length != -1) { return length; } StorageMode storageMode = InputStreamFactory.getStorageMode(this); if (storageMode != StorageMode.OTHER) { return super.length(); } throw new SQLException("Computing the length may leave the XML value unreadable"); //$NON-NLS-1$ } }
public static InputStreamFactory getInputStreamFactory(Streamable<?> s) { if (s.getReference() instanceof Streamable<?>) { return getInputStreamFactory((Streamable<?>) s.getReference()); } if (s.getReference() instanceof BaseLob) { BaseLob bl = (BaseLob) s.getReference(); try { InputStreamFactory isf = bl.getStreamFactory(); if (isf != null) { return isf; } } catch (SQLException e) { } } if (s instanceof ClobType) { return new InputStreamFactory.ClobInputStreamFactory((Clob)s.getReference()); } else if (s instanceof BlobType){ return new InputStreamFactory.BlobInputStreamFactory((Blob)s.getReference()); } return new InputStreamFactory.SQLXMLInputStreamFactory((SQLXML)s.getReference()); }
byteLength = lob.length()*(lob instanceof BaseClobType?2:1); } catch (SQLException e) { if (lob.getReferenceStreamId() == null || (inlineLobs && (byteLength <= maxMemoryBytes))) { lob.setReferenceStreamId(null); if (InputStreamFactory.getStorageMode(lob) == StorageMode.MEMORY) { return;
public LobChunk getNextChunk() throws IOException { try { Future<LobChunk> result = dqp.requestNextLobChunk(streamRequestId, requestId, streamable.getReferenceStreamId()); return result.get(); } catch (Exception e) { IOException ex = new IOException(JDBCPlugin.Util.getString("StreamImpl.Unable_to_read_data_from_stream", e.getMessage())); //$NON-NLS-1$ ex.initCause(e); throw ex; } }
@Override public void writeExternal(ObjectOutput out) throws IOException { try { length(); } catch (SQLException e) { writeReference(dataOutput); dataOutput.close(); writeBuffer = true;
@Override public long length() throws SQLException { if (this.length != -1) { return length; } StorageMode storageMode = InputStreamFactory.getStorageMode(this); if (storageMode != StorageMode.OTHER) { return super.length(); } throw new SQLException("Computing the length may leave the XML value unreadable"); //$NON-NLS-1$ } }
String id = lob.getReferenceStreamId(); LobHolder lobHolder = this.lobReferences.get(id); switch (mode) { if (lob.getReference() == null) { if (lobHolder == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30033, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30033)); lob.setReference(lobHolder.lob.getReference()); if (id == null || (inlineLobs && (storageMode == StorageMode.MEMORY || (storageMode != StorageMode.FREE && lob.length()*(lob instanceof BaseClobType?2:1) <= maxMemoryBytes)))) { lob.setReferenceStreamId(null); if (lob.getReference() == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30034, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30034));
public static InputStreamFactory getInputStreamFactory(Streamable<?> s) { if (s.getReference() instanceof Streamable<?>) { return getInputStreamFactory((Streamable<?>) s.getReference()); } if (s.getReference() instanceof BaseLob) { BaseLob bl = (BaseLob) s.getReference(); try { InputStreamFactory isf = bl.getStreamFactory(); if (isf != null) { return isf; } } catch (SQLException e) { } } if (s instanceof BaseClobType) { return new InputStreamFactory.ClobInputStreamFactory((Clob)s.getReference()); } else if (s instanceof BlobType){ return new InputStreamFactory.BlobInputStreamFactory((Blob)s.getReference()); } return new InputStreamFactory.SQLXMLInputStreamFactory((SQLXML)s.getReference()); }
byteLength = lob.length()*(lob instanceof BaseClobType?2:1); } catch (SQLException e) { if (lob.getReferenceStreamId() == null || (inlineLobs && (byteLength <= maxMemoryBytes))) { lob.setReferenceStreamId(null); if (InputStreamFactory.getStorageMode(lob) == StorageMode.MEMORY) { return;
public void close() throws IOException { try { dqp.closeLobChunkStream(streamRequestId, requestId, streamable.getReferenceStreamId()); } catch (TeiidException e) { IOException ex = new IOException(e.getMessage()); ex.initCause(e); throw ex; } } }
public long length() throws SQLException { if (length == -1) { if (InputStreamFactory.getStorageMode(this.reference) == StorageMode.FREE) { throw new SQLException("Already freed or streaming"); //$NON-NLS-1$ } length = computeLength(); } return length; }
public void readExternal(ObjectInput in, byte version) throws IOException, ClassNotFoundException { super.readExternal(in); try { this.encoding = (String)in.readObject(); } catch (OptionalDataException e) { this.encoding = Streamable.ENCODING; } try { if (version > 0) { this.type = ExternalizeUtil.readEnum(in, Type.class, Type.UNKNOWN); } else { this.type = (Type)in.readObject(); } } catch (OptionalDataException e) { this.type = Type.UNKNOWN; } catch(IOException e) { this.type = Type.UNKNOWN; } catch(ClassNotFoundException e) { this.type = Type.UNKNOWN; } }
String id = lob.getReferenceStreamId(); LobHolder lobHolder = this.lobReferences.get(id); switch (mode) { if (lob.getReference() == null) { if (lobHolder == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30033, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30033)); lob.setReference(lobHolder.lob.getReference()); if (id == null || (inlineLobs && (storageMode == StorageMode.MEMORY || (storageMode != StorageMode.FREE && lob.length()*(lob instanceof BaseClobType?2:1) <= maxMemoryBytes)))) { lob.setReferenceStreamId(null); if (lob.getReference() == null) { throw new TeiidComponentException(QueryPlugin.Event.TEIID30034, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30034));