@Override public XMLSerialize clone() { XMLSerialize clone = new XMLSerialize(); clone.document = this.document; clone.expression = (Expression)this.expression.clone(); clone.typeString = this.typeString; clone.type = this.type; clone.declaration = this.declaration; clone.version = this.version; clone.encoding = this.encoding; return clone; }
@Override public XMLSerialize clone() { XMLSerialize clone = new XMLSerialize(); clone.document = this.document; clone.expression = (Expression)this.expression.clone(); clone.typeString = this.typeString; clone.type = this.type; clone.declaration = this.declaration; clone.version = this.version; clone.encoding = this.encoding; return clone; }
@Override public XMLSerialize clone() { XMLSerialize clone = new XMLSerialize(); clone.document = this.document; clone.expression = (Expression)this.expression.clone(); clone.typeString = this.typeString; clone.type = this.type; clone.declaration = this.declaration; clone.version = this.version; clone.encoding = this.encoding; return clone; }
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))); }
XMLSerialize serialize = new XMLSerialize(); serialize.setTypeString("blob"); //$NON-NLS-1$ serialize.setDeclaration(true);
@Test public void testXmlSerialize1() throws Exception { XMLSerialize f = new XMLSerialize(); f.setExpression(new ElementSymbol("x")); f.setTypeString("CLOB"); helpTestExpression("xmlserialize(x as CLOB)", "XMLSERIALIZE(x AS CLOB)", f); }
@Test public void testXmlSerialize() throws Exception { XMLSerialize f = new XMLSerialize(); f.setDocument(true); f.setExpression(new ElementSymbol("x")); f.setTypeString("CLOB"); helpTestExpression("xmlserialize(document x as CLOB)", "XMLSERIALIZE(DOCUMENT x AS CLOB)", f); }
@Test public void testXmlSerialize2() throws Exception { XMLSerialize f = new XMLSerialize(); f.setExpression(new ElementSymbol("x")); f.setTypeString("BLOB"); f.setDeclaration(Boolean.TRUE); f.setVersion("1.0"); f.setEncoding("UTF-8"); helpTestExpression("xmlserialize(x as BLOB encoding \"UTF-8\" version '1.0' INCLUDING xmldeclaration)", "XMLSERIALIZE(x AS BLOB ENCODING \"UTF-8\" VERSION '1.0' INCLUDING XMLDECLARATION)", f); }
XMLSerialize result = new XMLSerialize(); result.setEncoding(enc); result.setVersion(ver);
XMLSerialize result = new XMLSerialize(); result.setEncoding(enc); result.setVersion(ver);
XMLSerialize result = new XMLSerialize(); result.setEncoding(enc); result.setVersion(ver);