use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testShortToInteger.
@Test
public void testShortToInteger() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Short((short) 1243), Short.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("integer", Integer.class) }, Integer.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1243 AS int)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBooleanToBigDecimala.
@Test
public void testBooleanToBigDecimala() 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("bigdecimal", java.math.BigDecimal.class) }, java.math.BigDecimal.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1 AS numeric(38, 19))");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testFloatToByte.
@Test
public void testFloatToByte() 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("byte", Byte.class) }, Byte.class);
// $NON-NLS-1$
helpGetString1(func, "cast(123.0 AS smallint)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBigDecimalToString.
@Test
public void testBigDecimalToString() throws Exception {
// $NON-NLS-1$
java.math.BigDecimal m = new java.math.BigDecimal("-123124534.3");
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(m, java.math.BigDecimal.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("string", String.class) }, String.class);
// $NON-NLS-1$
helpGetString1(func, "cast(-123124534.3 AS varchar(4000))");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testShortToBoolean.
@Test
public void testShortToBoolean() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Short((short) 0), Short.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("boolean", Boolean.class) }, Boolean.class);
// $NON-NLS-1$
helpGetString1(func, "CASE WHEN 0 = 0 THEN 0 WHEN 0 IS NOT NULL THEN 1 END");
}
Aggregations