Package org.teiid.language

Examples of org.teiid.language.Function


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

    public void helpTestMod(Expression c, String expectedStr, String target) throws Exception {
        Function func = LANG_FACTORY.createFunction(target,
            Arrays.asList(c),
            Integer.class);
       
        ExtractFunctionModifier mod = new ExtractFunctionModifier ();
        JDBCExecutionFactory trans = new JDBCExecutionFactory();
View Full Code Here


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

    public void helpTestMod(Expression c, String expectedStr, String target) throws Exception {
      Function func = null;
      if (c != null) {
          func = LANG_FACTORY.createFunction(target,
            Arrays.asList(c),
            String.class);
      } else {
View Full Code Here

    }

    public void testEscape() {
        Literal arg1 = CommandBuilder.getLanuageFactory().createLiteral("arg1", String.class); //$NON-NLS-1$
        Literal arg2 = CommandBuilder.getLanuageFactory().createLiteral("arg2", String.class);//$NON-NLS-1$
        Function func = CommandBuilder.getLanuageFactory().createFunction("concat", Arrays.asList( arg1, arg2), Integer.class); //$NON-NLS-1$
               
        helpTest(func, "{fn concat('arg1', 'arg2')}");
    }
View Full Code Here

   
    public void testTimestampAdd() {
        Literal arg1 = CommandBuilder.getLanuageFactory().createLiteral(NonReserved.SQL_TSI_HOUR, String.class);
        Literal arg2 = CommandBuilder.getLanuageFactory().createLiteral(Integer.valueOf(1), Integer.class);
        Literal arg3 = CommandBuilder.getLanuageFactory().createLiteral(TimestampUtil.createTimestamp(0, 0, 0, 0, 0, 0, 0), Timestamp.class);
        Function func = CommandBuilder.getLanuageFactory().createFunction("timestampadd", Arrays.asList( arg1, arg2, arg3), Timestamp.class); //$NON-NLS-1$
               
        helpTest(func, "{fn timestampadd(SQL_TSI_HOUR, 1, {ts '1899-12-31 00:00:00.0'})}");
    }
View Full Code Here

    }      
    /***************** End of cast(short AS input)******************/
   
    /***************** Beginning of cast(integer AS input) ************/
    @Test public void testStringToInteger() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert"//$NON-NLS-1$
            new Expression[] {
                LANG_FACTORY.createLiteral("12332", String.class)//$NON-NLS-1$
                LANG_FACTORY.createLiteral("integer", Integer.class)}, //$NON-NLS-1$
            Integer.class);
       
View Full Code Here

       
        helpGetString1(func,  "cast('12332' AS int)")//$NON-NLS-1$
    }
   
    @Test public void testBooleanToIntegera() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert"//$NON-NLS-1$
            new Expression[] {
                LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class),
                LANG_FACTORY.createLiteral("integer", Integer.class)}, //$NON-NLS-1$
            Integer.class);
       
View Full Code Here

       
        helpGetString1(func,  "cast(1 AS int)")//$NON-NLS-1$
   
   
    @Test public void testBooleanToIntegerb() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert"//$NON-NLS-1$
            new Expression[] {
                LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class),
                LANG_FACTORY.createLiteral("integer", Integer.class)}, //$NON-NLS-1$
            Integer.class);
       
View Full Code Here

       
        helpGetString1(func,  "cast(0 AS int)")//$NON-NLS-1$
    }
   
    @Test public void testByteToInteger() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert"//$NON-NLS-1$
            new Expression[] {
                LANG_FACTORY.createLiteral(new Byte((byte)12), Byte.class),
                LANG_FACTORY.createLiteral("integer",  Integer.class)}, //$NON-NLS-1$
            Integer.class);
       
View Full Code Here

       
        helpGetString1(func,  "cast(12 AS int)")//$NON-NLS-1$
    }
   
    @Test public void testShortToInteger() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert"//$NON-NLS-1$
            new Expression[] {
                LANG_FACTORY.createLiteral(new Short((short)1243 ), Short.class),
                LANG_FACTORY.createLiteral("integer",  Integer.class)}, //$NON-NLS-1$
            Integer.class);
       
View Full Code Here

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

    public void helpTestMod(Literal c, String format, String expectedStr) throws Exception {
        Function func = LANG_FACTORY.createFunction(format, 
            Arrays.asList(c),
            String.class);
       
        OracleExecutionFactory trans = new OracleExecutionFactory();
        trans.start();
View Full Code Here

TOP

Related Classes of org.teiid.language.Function

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.