Package org.teiid.language

Examples of org.teiid.language.Function


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


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

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

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

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

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

       
        helpGetString1(func,  "cast('12332131413' AS numeric(19,0))")//$NON-NLS-1$
    }
   
    @Test public void testBooleanToLonga() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert", //$NON-NLS-1$
            new Expression[] { LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), LANG_FACTORY.createLiteral("long", Long.class)}, //$NON-NLS-1$
            Long.class);

        helpGetString1(func, "cast(1 AS numeric(19,0))"); //$NON-NLS-1$
    }
View Full Code Here

    /***************** End of cast(long AS input)******************/
   
    /***************** Beginning of cast(biginteger AS input) ************/
    @Test public void testStringToBigInteger() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert"//$NON-NLS-1$
            new Expression[] {
                LANG_FACTORY.createLiteral("12323143241414", String.class)//$NON-NLS-1$
                LANG_FACTORY.createLiteral("biginteger", java.math.BigInteger.class)}, //$NON-NLS-1$
            java.math.BigInteger.class);
       
View Full Code Here

       
        helpGetString1(func,  "cast('12323143241414' AS numeric(38, 0))")//$NON-NLS-1$
    }
   
    @Test public void testBooleanToBigIntegera() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert", //$NON-NLS-1$
            new Expression[] { LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), LANG_FACTORY.createLiteral("biginteger", java.math.BigInteger.class)}, //$NON-NLS-1$
            BigInteger.class);

        helpGetString1(func, "cast(1 AS numeric(38, 0))"); //$NON-NLS-1$
    }
View Full Code Here

    /***************** End of cast(biginteger AS input)******************/
   
    /***************** Beginning of cast(float AS input) ************/
    @Test public void testStringToFloat() throws Exception {
        Function func = LANG_FACTORY.createFunction("convert"//$NON-NLS-1$
            new Expression[] {
                LANG_FACTORY.createLiteral("123", String.class)//$NON-NLS-1$
                LANG_FACTORY.createLiteral("float", Float.class)}, //$NON-NLS-1$
            Float.class);
       
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.