use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testDoubleToBoolean.
@Test
public void testDoubleToBoolean() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Double(1.0), Double.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("boolean", Boolean.class) }, Boolean.class);
// $NON-NLS-1$
helpGetString1(func, "CASE WHEN 1.0 = 0 THEN 0 WHEN 1.0 IS NOT NULL THEN 1 END");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testBooleanToIntegera.
@Test
public void testBooleanToIntegera() 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("integer", Integer.class) }, Integer.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1 AS int)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testByteToShort.
@Test
public void testByteToShort() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Byte((byte) 12), Byte.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("short", Short.class) }, Short.class);
// $NON-NLS-1$
helpGetString1(func, "12");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testBigDecimalToShort.
@Test
public void testBigDecimalToShort() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral(new java.math.BigDecimal("12.3"), java.math.BigDecimal.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("short", Short.class) }, Short.class);
// $NON-NLS-1$
helpGetString1(func, "cast(12.3 AS smallint)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testBooleanToBigIntegera.
@Test
public void testBooleanToBigIntegera() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", // $NON-NLS-1$
new Expression[] { LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class), LANG_FACTORY.createLiteral("biginteger", java.math.BigInteger.class) }, BigInteger.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1 AS numeric(38, 0))");
}
Aggregations