Examples of XMLType


Examples of org.teiid.core.types.XMLType

      case GETXMLSCHEMAS:
        try {
          Object groupID = indexMetadata.getGroupID((String)((Constant)proc.getParameter(1).getExpression()).getValue());
          List<SQLXMLImpl> schemas = indexMetadata.getXMLSchemas(groupID);
          for (SQLXMLImpl schema : schemas) {
            rows.add(Arrays.asList(new XMLType(schema)));
          }
        } catch (QueryMetadataException e) {
          throw new TeiidProcessingException(e);
        }
        break;
View Full Code Here

Examples of org.teiid.core.types.XMLType

      throw new ExpressionEvaluationException(e, e.getMessage());
    }
    if (!xp.isDocument()) {
      type = Type.CONTENT;
    }
    XMLType xml = new XMLType(result);
    xml.setType(type);
    return xml;
  }
View Full Code Here

Examples of org.teiid.core.types.XMLType

  }
 
  private Object evaluateXMLSerialize(List<?> tuple, XMLSerialize xs)
      throws ExpressionEvaluationException, BlockedException,
      TeiidComponentException, FunctionExecutionException {
    XMLType value = (XMLType) internalEvaluate(xs.getExpression(), tuple);
    if (value == null) {
      return null;
    }
    try {
      if (xs.isDocument() == null || !xs.isDocument()) {
        return serialize(xs, value);
      }
      if (value.getType() == Type.UNKNOWN) {
        Type type = StringToSQLXMLTransform.isXml(value.getCharacterStream());
        value.setType(type);
      }
      if (value.getType() == Type.DOCUMENT || value.getType() == Type.ELEMENT) {
        return serialize(xs, value);
      }
    } catch (SQLException e) {
      throw new FunctionExecutionException(e, e.getMessage());
    } catch (TransformationException e) {
View Full Code Here

Examples of org.teiid.core.types.XMLType

        // the original sources.
        Streamable<?> streamable = parent.resultsBuffer.getLobReference(referenceStreamId);
       
        try {
            if (streamable instanceof XMLType) {
                XMLType xml = (XMLType)streamable;
                return new ByteLobChunkStream(xml.getBinaryStream(), chunkSize);
            }
            else if (streamable instanceof ClobType) {
                ClobType clob = (ClobType)streamable;
                return new ByteLobChunkStream(new ReaderInputStream(clob.getCharacterStream(), Charset.forName(Streamable.ENCODING)), chunkSize);           
            }
View Full Code Here

Examples of org.teiid.core.types.XMLType

              InputStreamFactory isf = createInputStreamFactory((BlobType)currentValue);
              isf.setLength(((BlobType)currentValue).getLength());
              currentValue = new BlobImpl(isf);
            }
            else if (currentValue instanceof XMLType) {
              XMLType val = (XMLType)currentValue;
              currentValue = new SQLXMLImpl(createInputStreamFactory(val));
              ((SQLXMLImpl)currentValue).setEncoding(val.getEncoding());
            }
        }
        else if (currentValue instanceof java.util.Date) {
            return TimestampWithTimezone.create((java.util.Date)currentValue, serverTimeZone, getDefaultCalendar(), currentValue.getClass());
        }
        else if (maxFieldSize > 0 && currentValue instanceof String) {
          String val = (String)currentValue;
          currentValue = val.substring(0, Math.min(maxFieldSize/2, val.length()));
        }
        return currentValue;
    }
View Full Code Here

Examples of org.teiid.core.types.XMLType

        assertEquals("test", value); //$NON-NLS-1$
    }

    // simulate what would happen if someone passed the output of an XML query to the xpathvalue function
    @Test public void testXMLInput() throws Exception {
        XMLType doc = new XMLType(new SQLXMLImpl("<foo/>"));//$NON-NLS-1$
        String xpath = "a/b/c"; //$NON-NLS-1$
        String value = XMLSystemFunctions.xpathValue(doc, xpath);
        assertNull(value);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.