Package org.teiid.core.types

Examples of org.teiid.core.types.XMLType


              tuple.add(null);
            }
            continue;
          }
          if (proColumn.getSymbol().getType() == DataTypeManager.DefaultDataClasses.XML) {
            XMLType value = table.getXQueryExpression().createXMLType(pathIter.getAnother(), this.getBufferManager(), false);
            tuple.add(value);
            continue;
          }
          if (pathIter.next() != null) {
            throw new TeiidProcessingException(QueryPlugin.Util.getString("XMLTableName.multi_value", proColumn.getName())); //$NON-NLS-1$
View Full Code Here


      }
      else if (lob instanceof ClobType) {
        persistedLob = new ClobType(new ClobImpl(isf, ((ClobType)lob).length()));
      }
      else {
        persistedLob = new XMLType(new SQLXMLImpl(isf));
        ((XMLType)persistedLob).setEncoding(((XMLType)lob).getEncoding());
        ((XMLType)persistedLob).setType(((XMLType)lob).getType());
      }
    } catch (SQLException e) {
      throw new TeiidComponentException(e);
View Full Code Here

      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

      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

  }
 
  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

        // 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

              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

        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

Related Classes of org.teiid.core.types.XMLType

Copyright © 2018 www.massapicom. 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.