Package org.teiid.query.sql.symbol

Examples of org.teiid.query.sql.symbol.Constant


        es2.setType(DataTypeManager.DefaultDataClasses.STRING);
       
        List elements = new ArrayList();
        elements.add(es1);

        Function func = new Function("lookup", new Expression[] { new Constant("pm1.g1"), new Constant("e2"), new Constant("e1"), es1 }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        FunctionDescriptor desc = FakeMetadataFactory.SFM.getSystemFunctionLibrary().findFunction("lookup", new Class[] { String.class, String.class, String.class, Integer.class } ); //$NON-NLS-1$
        func.setFunctionDescriptor(desc);
        func.setType(DataTypeManager.DefaultDataClasses.INTEGER);
        CompareCriteria crit = new CompareCriteria(func, CompareCriteria.EQ, new Constant(new Integer(1)));
       
        List[] data = new List[20];
        for(int i=0; i<20; i++) {
            data[i] = new ArrayList();
            data[i].add(new Integer((i*51) % 11));
View Full Code Here


        case NodeConstants.Types.TUPLE_LIMIT: {
          if (!(parent.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT) instanceof Constant)
              || parent.getProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT) != null) {
            return true;
          }
          Constant constant = (Constant)parent.getProperty(NodeConstants.Info.MAX_TUPLE_LIMIT);
          if (!Integer.valueOf(1).equals(constant.getValue())) {
            return true;
          }
        }
        //we assmue that projects of non-deterministic expressions do not matter
      }
View Full Code Here

    public Expression replaceExpression(Expression expr) {
        if(expr instanceof ElementSymbol) {
            ElementSymbol elem = (ElementSymbol) expr;
            Object metadataID = elem.getMetadataID();           
            if(metadataID instanceof MultiSourceElement) {
                Constant bindingConst = new Constant(this.bindingName, DataTypeManager.DefaultDataClasses.STRING);
                return bindingConst;
            }
        }
       
        return expr;
View Full Code Here

    ProcedureExecution exec = new FakeProcedureExecution(2, 1);

    // this has two result set columns and 1 out parameter
    int total_columns = 3;
    StoredProcedure command = (StoredProcedure)helpGetCommand("{call pm2.spTest8(?)}", EXAMPLE_BQT); //$NON-NLS-1$     
    command.getInputParameters().get(0).setExpression(new Constant(1));
    Call proc = (Call)new LanguageBridgeFactory(EXAMPLE_BQT).translate(command);

    ProcedureBatchHandler pbh = new ProcedureBatchHandler(proc, exec);

    assertEquals(total_columns, pbh.padRow(Arrays.asList(null, null)).size());
View Full Code Here

   
    public static org.teiid.query.sql.lang.Update helpExample() {
        GroupSymbol group = TestGroupImpl.helpExample("vm1.g1"); //$NON-NLS-1$
        org.teiid.query.sql.lang.Update result = new org.teiid.query.sql.lang.Update();
        result.setGroup(group);
        result.addChange(TestElementImpl.helpExample("vm1.g1", "e1"), new Constant(new Integer(1)));
        result.addChange(TestElementImpl.helpExample("vm1.g1", "e2"), new Constant(new Integer(1)));
        result.addChange(TestElementImpl.helpExample("vm1.g1", "e3"), new Constant(new Integer(1)));
        result.addChange(TestElementImpl.helpExample("vm1.g1", "e4"), new Constant(new Integer(1)));
        result.setCriteria(new CompareCriteria(new Constant(new Integer(1)), CompareCriteria.EQ, new Constant(new Integer(1))));
        return result;
    }
View Full Code Here

    public static AggregateFunction example(String name, String functionName, boolean distinct, int value) throws Exception {
        AggregateSymbol symbol = new AggregateSymbol(name,
                                                     functionName,
                                                     distinct,
                                                      new Constant(new Integer(value)));
        return TstLanguageBridgeFactory.factory.translate(symbol);
       
    }
View Full Code Here

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

    public static org.teiid.query.sql.symbol.Function helpExample(String name) {
        Constant c1 = new Constant(new Integer(100));
        Constant c2 = new Constant(new Integer(200));
        org.teiid.query.sql.symbol.Function f = new org.teiid.query.sql.symbol.Function(name, new org.teiid.query.sql.symbol.Expression[] {c1, c2});
        f.setType(Integer.class);
        return f;
    }
View Full Code Here

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

    public static Constant helpExample(int val) {
        return new Constant(new Integer(val));
    }
View Full Code Here

    public static Constant helpExample(int val) {
        return new Constant(new Integer(val));
    }
   
    public static Constant helpExample(Object val) {
        return new Constant(val);
    }
View Full Code Here

    public static Constant helpExample(Object val) {
        return new Constant(val);
    }
   
    public static Literal example(int val) {
        Constant c = helpExample(val);
        return new Literal(c.getValue(), c.getType());
    }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.symbol.Constant

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.