use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testFloatToShort.
@Test
public void testFloatToShort() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Float((float) 123.0), Float.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("short", Short.class) }, Short.class);
// $NON-NLS-1$
helpGetString1(func, "cast(123.0 AS smallint)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testBooleanToDoublea.
@Test
public void testBooleanToDoublea() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("double", Double.class) }, Double.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1 AS double precision)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testBooleanToFloata.
@Test
public void testBooleanToFloata() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("float", Float.class) }, Float.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1 AS real)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testStringToBigDecimal.
/**
*************** End of cast(double AS input)*****************
*/
/**
*************** Beginning of cast(bigdecimal AS input) ***********
*/
@Test
public void testStringToBigDecimal() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral("123", String.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("bigdecimal", java.math.BigDecimal.class) }, java.math.BigDecimal.class);
// $NON-NLS-1$
helpGetString1(func, "cast('123' AS numeric(38, 19))");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testLongToBoolean.
@Test
public void testLongToBoolean() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Long(1), Long.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("boolean", Boolean.class) }, Boolean.class);
// $NON-NLS-1$
helpGetString1(func, "CASE WHEN 1 = 0 THEN 0 WHEN 1 IS NOT NULL THEN 1 END");
}
Aggregations