@Override @Nullable public InputStream getXmlAsBinaryStream(ResultSet rs, String columnName) throws SQLException { SQLXML xmlObject = rs.getSQLXML(columnName); return (xmlObject != null ? xmlObject.getBinaryStream() : null); }
@Override @Nullable public InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException { SQLXML xmlObject = rs.getSQLXML(columnIndex); return (xmlObject != null ? xmlObject.getBinaryStream() : null); }
@Override public InputStream call() throws SQLException { return sqlXML.getBinaryStream(); } });
public InputStream getBinaryStream() throws SQLException { return this.reference.getBinaryStream(); }
public InputStream getBinaryStream() throws SQLException { return this.reference.getBinaryStream(); }
SQLXML sqlxml = resultSet.getSQLXML(column); InputStream binaryStream = sqlxml.getBinaryStream();
@Override public InputStream getInputStream() throws IOException { try { return sqlxml.getBinaryStream(); } catch (SQLException e) { throw new IOException(e); } }
@Override public InputStream getInputStream() throws IOException { try { return sqlxml.getBinaryStream(); } catch (SQLException e) { throw new IOException(e); } }
@Override @Nullable public InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException { SQLXML xmlObject = rs.getSQLXML(columnIndex); return (xmlObject != null ? xmlObject.getBinaryStream() : null); }
public InputStream getXmlAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException { return rs.getSQLXML(columnIndex).getBinaryStream(); }
public InputStream getXmlAsBinaryStream(ResultSet rs, String columnName) throws SQLException { return rs.getSQLXML(columnName).getBinaryStream(); }
/** * Returns the encoding or null if it cannot be determined * @param xml * @return */ public static String getEncoding(SQLXML xml) { try { if (xml instanceof XMLType) { XMLType type = (XMLType)xml; if (type.encoding != null) { return type.encoding; } xml = type.reference; } if (xml instanceof SQLXMLImpl) { Charset cs = ((SQLXMLImpl)xml).getCharset(); if (cs != null) { return cs.name(); } } return getEncoding(xml.getBinaryStream()); } catch (SQLException e) { return null; } }
public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { Object value = getObject(columnIndex); if (value == null) { return null; } if (value instanceof Blob) { return ((Blob) value).getBinaryStream(); } if (value instanceof SQLXML) { return ((SQLXML)value).getBinaryStream(); } throw new TeiidSQLException(JDBCPlugin.Util.getString("MMResultSet.cannot_convert_to_binary_stream")); //$NON-NLS-1$ }
/** * Returns the encoding or null if it cannot be determined * @param xml * @return */ public static String getEncoding(SQLXML xml) { try { if (xml instanceof XMLType) { XMLType type = (XMLType)xml; if (type.encoding != null) { return type.encoding; } xml = type.reference; } if (xml instanceof SQLXMLImpl) { Charset cs = ((SQLXMLImpl)xml).getCharset(); if (cs != null) { return cs.name(); } } return getEncoding(xml.getBinaryStream()); } catch (SQLException e) { return null; } }
public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { Object value = getObject(columnIndex); if (value == null) { return null; } if (value instanceof Blob) { return ((Blob) value).getBinaryStream(); } if (value instanceof SQLXML) { return ((SQLXML)value).getBinaryStream(); } throw new TeiidSQLException(JDBCPlugin.Util.getString("MMResultSet.cannot_convert_to_binary_stream")); //$NON-NLS-1$ }
@Override public <X> X unwrap(SQLXML value, Class<X> valueClass, Connection connection) throws SQLException { if (value == null) { return null; } else if (valueClass.isAssignableFrom(SQLXML.class)) { return (X) value; } else if (valueClass.isAssignableFrom(String.class)) { try { return (X) IOUtils.toString(value.getCharacterStream()); } catch (IOException exception) { throw new JdbcTypeException(exception); } } else if (valueClass.isAssignableFrom(InputStream.class)) { try { return (X) IOUtils.toString(value.getBinaryStream()); } catch (IOException exception) { throw new JdbcTypeException(exception); } } else if (valueClass.isAssignableFrom(Reader.class)) { return (X) value.getCharacterStream(); } else { throw newUnwrapFailure(valueClass); } } }
private InputStream handleResult(String charSet, Object result) throws SQLException { if (result == null) { return null; //or should this be an empty result? } if (result instanceof SQLXML) { if (charSet != null) { XMLSerialize serialize = new XMLSerialize(); serialize.setTypeString("blob"); //$NON-NLS-1$ serialize.setDeclaration(true); serialize.setEncoding(charSet); serialize.setDocument(true); try { return ((BlobType)XMLSystemFunctions.serialize(serialize, new XMLType((SQLXML)result))).getBinaryStream(); } catch (TransformationException e) { throw new SQLException(e); } } return ((SQLXML)result).getBinaryStream(); } else if (result instanceof Blob) { return ((Blob)result).getBinaryStream(); } else if (result instanceof Clob) { return new ReaderInputStream(((Clob)result).getCharacterStream(), charSet==null?Charset.defaultCharset():Charset.forName(charSet)); } return new ByteArrayInputStream(result.toString().getBytes(charSet==null?Charset.defaultCharset():Charset.forName(charSet))); }
private InputStream handleResult(String charSet, Object result) throws SQLException { if (result == null) { return null; //or should this be an empty result? } if (result instanceof SQLXML) { if (charSet != null) { XMLSerialize serialize = new XMLSerialize(); serialize.setTypeString("blob"); //$NON-NLS-1$ serialize.setDeclaration(true); serialize.setEncoding(charSet); serialize.setDocument(true); try { return ((BlobType)XMLSystemFunctions.serialize(serialize, new XMLType((SQLXML)result))).getBinaryStream(); } catch (TransformationException e) { throw new SQLException(e); } } return ((SQLXML)result).getBinaryStream(); } else if (result instanceof Blob) { return ((Blob)result).getBinaryStream(); } else if (result instanceof Clob) { return new ReaderInputStream(((Clob)result).getCharacterStream(), charSet==null?Charset.defaultCharset():Charset.forName(charSet)); } return new ByteArrayInputStream(result.toString().getBytes(charSet==null?Charset.defaultCharset():Charset.forName(charSet))); }
return ((java.sql.SQLXML) value).getBinaryStream();
InputStream content = ((SQLXML)result).getBinaryStream(); response.writeContent(content, 200, false); response.writeOK(ContentType.APPLICATION_XML);