@Override public StorageMode getStorageMode() { if (!saved) { try { getInputStream().close(); } catch (IOException e) { return StorageMode.OTHER; } } return fsisf.getStorageMode(); } };
@Override public StorageMode getStorageMode() { if (!saved) { try { getInputStream().close(); } catch (IOException e) { CommandContext cc = CommandContext.getThreadLocalContext(); if (cc != null) { cc.addWarning(e); } LogManager.logInfo(LogConstants.CTX_DQP, e.getMessage()); return StorageMode.FREE; } } return fsisf.getStorageMode(); }
@Override public StorageMode getStorageMode() { if (!saved) { try { getInputStream().close(); } catch (IOException e) { CommandContext cc = CommandContext.getThreadLocalContext(); if (cc != null) { cc.addWarning(e); } LogManager.logInfo(LogConstants.CTX_DQP, e.getMessage()); return StorageMode.FREE; } } return fsisf.getStorageMode(); }
public JsonType close(CommandContext cc) throws TeiidProcessingException { try { writer.close(); } catch (IOException e) { remove(); throw new TeiidProcessingException(QueryPlugin.Event.TEIID30442, e); } if (fsisf.getStorageMode() == StorageMode.MEMORY) { //detach if just in memory byte[] bytes = fsisf.getMemoryBytes(); fsisf.free(); JsonType result = new JsonType(new ClobImpl(new String(bytes, Streamable.CHARSET))); return result; } JsonType result = new JsonType(new ClobImpl(fsisf, -1)); if (cc != null) { cc.addCreatedLob(fsisf); } return result; }
public JsonType close(CommandContext cc) throws TeiidProcessingException { try { writer.close(); } catch (IOException e) { remove(); throw new TeiidProcessingException(QueryPlugin.Event.TEIID30442, e); } if (fsisf.getStorageMode() == StorageMode.MEMORY) { //detach if just in memory byte[] bytes = fsisf.getMemoryBytes(); fsisf.free(); JsonType result = new JsonType(new ClobImpl(new String(bytes, Streamable.CHARSET))); return result; } JsonType result = new JsonType(new ClobImpl(fsisf, -1)); if (cc != null) { cc.addCreatedLob(fsisf); } return result; }
public ClobType close(CommandContext cc) throws TeiidProcessingException { try { writer.close(); } catch (IOException e) { remove(); throw new TeiidProcessingException(QueryPlugin.Event.TEIID30442, e); } if (fsisf.getStorageMode() == StorageMode.MEMORY) { //detach if just in memory byte[] bytes = fsisf.getMemoryBytes(); fsisf.free(); ClobType result = new ClobType(new ClobImpl(new String(bytes, Streamable.CHARSET))); result.setType(Type.JSON); return result; } ClobType result = new ClobType(new ClobImpl(fsisf, -1)); if (cc != null) { cc.addCreatedLob(fsisf); } result.setType(Type.JSON); return result; }
private static SQLXMLImpl createSQLXML( final FileStoreInputStreamFactory fsisf, final ExtendedWriter ew, CommandContext context) { if (ew.includes.isEmpty()) { if (fsisf.getStorageMode() == StorageMode.MEMORY) {
private static SQLXMLImpl createSQLXML( final FileStoreInputStreamFactory fsisf, final ExtendedWriter ew, CommandContext context) { if (ew.includes.isEmpty()) { if (fsisf.getStorageMode() == StorageMode.MEMORY) {
private static SQLXMLImpl createSQLXML( final FileStoreInputStreamFactory fsisf, final ExtendedWriter ew, CommandContext context) { if (ew.includes.isEmpty()) { if (fsisf.getStorageMode() == StorageMode.MEMORY) {
public static ClobType concat(CommandContext context, ClobType str1, ClobType str2) throws IOException, SQLException { BufferManager bm = context.getBufferManager(); FileStore fs = bm.createFileStore("clob"); //$NON-NLS-1$ FileStoreInputStreamFactory fsisf = new FileStoreInputStreamFactory(fs, Streamable.ENCODING); boolean remove = true; try (Reader characterStream = str1.getCharacterStream(); Reader characterStream2 = str2.getCharacterStream();){ Writer writer = fsisf.getWriter(); int chars = ObjectConverterUtil.write(writer, characterStream, -1, false); chars += ObjectConverterUtil.write(writer, characterStream2, -1, false); writer.close(); if (fsisf.getStorageMode() == StorageMode.MEMORY) { //detach if just in memory byte[] bytes = fsisf.getMemoryBytes(); return new ClobType(new ClobImpl(new String(bytes, Streamable.ENCODING))); } remove = false; context.addCreatedLob(fsisf); return new ClobType(new ClobImpl(fsisf, chars)); } finally { if (remove) { fs.remove(); } } }
public static ClobType concat(CommandContext context, ClobType str1, ClobType str2) throws IOException, SQLException { BufferManager bm = context.getBufferManager(); FileStore fs = bm.createFileStore("clob"); //$NON-NLS-1$ FileStoreInputStreamFactory fsisf = new FileStoreInputStreamFactory(fs, Streamable.ENCODING); boolean remove = true; try (Reader characterStream = str1.getCharacterStream(); Reader characterStream2 = str2.getCharacterStream();){ Writer writer = fsisf.getWriter(); int chars = ObjectConverterUtil.write(writer, characterStream, -1, false); chars += ObjectConverterUtil.write(writer, characterStream2, -1, false); writer.close(); if (fsisf.getStorageMode() == StorageMode.MEMORY) { //detach if just in memory byte[] bytes = fsisf.getMemoryBytes(); return new ClobType(new ClobImpl(new String(bytes, Streamable.ENCODING))); } remove = false; context.addCreatedLob(fsisf); return new ClobType(new ClobImpl(fsisf, chars)); } finally { if (remove) { fs.remove(); } } }
public static ClobType concat(CommandContext context, ClobType str1, ClobType str2) throws IOException, SQLException { BufferManager bm = context.getBufferManager(); FileStore fs = bm.createFileStore("clob"); //$NON-NLS-1$ FileStoreInputStreamFactory fsisf = new FileStoreInputStreamFactory(fs, Streamable.ENCODING); boolean remove = true; try (Reader characterStream = str1.getCharacterStream(); Reader characterStream2 = str2.getCharacterStream();){ Writer writer = fsisf.getWriter(); int chars = ObjectConverterUtil.write(writer, characterStream, -1, false); chars += ObjectConverterUtil.write(writer, characterStream2, -1, false); writer.close(); if (fsisf.getStorageMode() == StorageMode.MEMORY) { //detach if just in memory byte[] bytes = fsisf.getMemoryBytes(); return new ClobType(new ClobImpl(new String(bytes, Streamable.ENCODING))); } remove = false; context.addCreatedLob(fsisf); return new ClobType(new ClobImpl(fsisf, chars)); } finally { if (remove) { fs.remove(); } } }