@Override public InputStream getBinaryStream() throws SQLException { try { return new XMLInputStream(getSource(StAXSource.class), XMLOutputFactory.newFactory(), getCharset().name()); } catch (XMLStreamException e) { throw new SQLException(e); } catch (FactoryConfigurationError e) { throw new SQLException(e); } }
public StAXSQLXML(StAXSourceProvider provider, Charset charSet) { this.sourceProvider = provider; this.setCharset(charSet); }
@Test public void testStaxComment() throws Exception { String sql = "select * from xmltable('/*:Person/phoneNumber' passing cast(? as xml) columns x string path 'type', y string path 'number') as x"; //$NON-NLS-1$ List<?>[] expected = new List<?>[] { Arrays.asList(null, "8881112222"), }; XMLInputFactory factory = XMLInputFactory.newInstance(); XMLEventReader reader = factory.createXMLEventReader(new StringReader("<Person><!--hello--><phoneNumber><number>8881112222</number></phoneNumber></Person>")); XMLType value = new XMLType(new StAXSQLXML(new StAXSource(reader))); value.setType(Type.DOCUMENT); Command command = helpParse(sql); CommandContext context = createCommandContext(); QueryMetadataInterface metadata = RealMetadataFactory.example1Cached(); context.setMetadata(metadata); CapabilitiesFinder capFinder = new DefaultCapabilitiesFinder(); ProcessorPlan plan = helpGetPlan(command, metadata, capFinder, context); setParameterValues(Arrays.asList(value), command, context); doProcess(plan, dataManager, expected, context); }
@Override public String getString() throws SQLException { StringWriter sw = new StringWriter(); try { new StandardXMLTranslator(getSource(StAXSource.class)).translate(sw); } catch (TransformerException e) { throw new SQLException(e); } catch (IOException e) { throw new SQLException(e); } return sw.toString(); }
value = new XMLType(new StAXSQLXML(sourceProvider, encoding)); value.setType(type); value = new XMLType(new StAXSQLXML(sourceProvider, encoding)); value.setType(Type.DOCUMENT);
@Override public Reader getCharacterStream() throws SQLException { try { return new XMLReader(getSource(StAXSource.class), XMLOutputFactory.newFactory()); } catch (XMLStreamException e) { throw new SQLException(e); } catch (FactoryConfigurationError e) { throw new SQLException(e); } }
value = new XMLType(new StAXSQLXML(sourceProvider, encoding)); value.setType(type); value = new XMLType(new StAXSQLXML(sourceProvider, encoding)); value.setType(Type.DOCUMENT);
value = new XMLType(new StAXSQLXML(sourceProvider, encoding)); value.setType(type); value = new XMLType(new StAXSQLXML(sourceProvider, encoding)); value.setType(Type.DOCUMENT);
sqlXml = new StAXSQLXML(new StAXSource(reader)); } catch (XMLStreamException e) { throw new TeiidProcessingException(e);
sqlXml = new StAXSQLXML(new StAXSource(reader)); } catch (XMLStreamException e) { throw new TeiidProcessingException(e);
sqlXml = new StAXSQLXML(new StAXSource(reader)); } catch (XMLStreamException e) { throw new TeiidProcessingException(e);