Package org.teiid.language

Examples of org.teiid.language.ColumnReference


    public TestSelectSymbolImpl(String name) {
        super(name);
    }

    public static DerivedColumn example(String symbolName, String alias) throws Exception {
        DerivedColumn selectSymbol = new DerivedColumn(alias, new ColumnReference(null, symbolName, null, DataTypeManager.DefaultDataClasses.INTEGER));
        return selectSymbol;
    }
View Full Code Here


    public NamedTable createGroup(String context, String definition) {
        return new NamedTable(context, definition, null);
    }
   
    public ColumnReference createElement(NamedTable group, String name) {
        return new ColumnReference(group, name, null, String.class);
    }
View Full Code Here

        return TstLanguageBridgeFactory.factory.translate(helpExampleSetQuery());
    }
   
    public static SetQuery example2() throws Exception {
        NamedTable group = new NamedTable("ted", null, null); //$NON-NLS-1$
        ColumnReference element = new ColumnReference(group, "nugent", null, String.class); //$NON-NLS-1$
        DerivedColumn symbol = new DerivedColumn(null,element);
        List symbols = new ArrayList();
        symbols.add(symbol);
        List items = new ArrayList();
        items.add(group);
       
        NamedTable group2 = new NamedTable("dave", null, null); //$NON-NLS-1$
        ColumnReference element2 = new ColumnReference(group2, "barry", null, String.class); //$NON-NLS-1$
        DerivedColumn symbol2 = new DerivedColumn(null, element2);
        List symbols2 = new ArrayList();
        symbols2.add(symbol2);
       
        List items2 = new ArrayList();
View Full Code Here

   
    public static SetQuery example3() throws Exception {
        SetQuery union = example2();
       
        List<SortSpecification> items = new ArrayList<SortSpecification>();
        items.add(new SortSpecification(Ordering.ASC, new ColumnReference(null, "nugent", null, DataTypeManager.DefaultDataClasses.STRING))); //$NON-NLS-1$
        OrderBy orderBy = new OrderBy(items);
       
        union.setOrderBy(orderBy);
        return union;
    }
View Full Code Here

     * {@link org.teiid.language.DerivedColumn}.
     * @param symbol Input ISelectSymbol
     * @return Element returned metadata runtime Element
     */
    private Column getElementFromSymbol(DerivedColumn symbol) {
        ColumnReference expr = (ColumnReference) symbol.getExpression();
        return expr.getMetadataObject();
    }
View Full Code Here

      if(columns.size() != values.size()) {
        throw new TranslatorException("Error:  columns.size and values.size are not the same.");
      }
     
      for(int i = 0; i < columns.size(); i++) {
        ColumnReference element = columns.get(i);
        Column column = element.getMetadataObject();
        Object value = values.get(i);
        String val;
        if(value instanceof Literal) {
          Literal literalValue = (Literal)value;
          val = literalValue.getValue().toString();
View Full Code Here

    @Override
    public void visit( In criteria ) {
        try {
            Expression lExpr = criteria.getLeftExpression();
            if (lExpr instanceof ColumnReference) {
              ColumnReference cr = (ColumnReference)lExpr;
                Column column = cr.getMetadataObject();
                if (column != null && (MULTIPICKLIST.equalsIgnoreCase(column.getNativeType()) || RESTRICTEDMULTISELECTPICKLIST.equalsIgnoreCase(column.getNativeType()))) {
                    appendMultiselectIn(column, criteria);
                } else {
                    appendCriteria(criteria);
                }
View Full Code Here

                                       Comparison compCriteria ) throws TranslatorException {
        Expression lExpr = compCriteria.getLeftExpression();
        if (lExpr instanceof Function) {
            parseFunction((Function)lExpr);
        } else {
            ColumnReference left = (ColumnReference)lExpr;
            Column column = left.getMetadataObject();
            String columnName = column.getNameInSource();
            StringBuffer queryString = new StringBuffer();
            queryString.append(column.getParent().getNameInSource());
            queryString.append('.');
            queryString.append(columnName).append(SPACE);
            queryString.append(comparisonOperators.get(compCriteria.getOperator()));
            queryString.append(' ');
            Expression rExp = compCriteria.getRightExpression();
            if(rExp instanceof Literal) {
              Literal literal = (Literal)rExp;
              if (column.getJavaType().equals(Boolean.class)) {
                queryString.append(((Boolean)literal.getValue()).toString());
              } else if (column.getJavaType().equals(java.sql.Timestamp.class)) {
                Timestamp datetime = (java.sql.Timestamp)literal.getValue();
                String value = Util.getSalesforceDateTimeFormat().format(datetime);
                String zoneValue = Util.getTimeZoneOffsetFormat().format(datetime);
                queryString.append(value).append(zoneValue.subSequence(0, 3)).append(':').append(zoneValue.subSequence(3, 5));
              } else if (column.getJavaType().equals(java.sql.Time.class)) {
                String value = Util.getSalesforceDateTimeFormat().format((java.sql.Time)literal.getValue());
                queryString.append(value);
              } else if (column.getJavaType().equals(java.sql.Date.class)) {
                String value = Util.getSalesforceDateFormat().format((java.sql.Date)literal.getValue());
                queryString.append(value);
              } else {
                queryString.append(compCriteria.getRightExpression().toString());
              }
            } else if(rExp instanceof ColumnReference) {
              ColumnReference right = (ColumnReference)lExpr;
                column = left.getMetadataObject();
                columnName = column.getNameInSource();
                queryString.append(columnName);
            }
View Full Code Here

    }

    protected String getValue( Expression expr ) throws TranslatorException {
        String result;
        if (expr instanceof ColumnReference) {
            ColumnReference element = (ColumnReference)expr;
            Column element2 = element.getMetadataObject();
            result = element2.getNameInSource();
        } else if (expr instanceof Literal) {
            Literal literal = (Literal)expr;
            result = literal.getValue().toString();
        } else {
View Full Code Here

    List<Expression> insertValueList = ((ExpressionValueSource)((Insert)command).getValueSource()).getValues();
    // create a new attribute list with case ignored in attribute
    // names
    Attributes insertAttrs = new BasicAttributes(true);
    Attribute insertAttr; // what we will use to populate the attribute list
    ColumnReference insertElement;
    String nameInsertElement;
    Object insertValue;
    String distinguishedName = null;
    // The IInsert interface uses separate List objects for
    // the element names and values to be inserted, limiting
View Full Code Here

TOP

Related Classes of org.teiid.language.ColumnReference

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.