use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testShortToByte.
@Test
public void testShortToByte() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Short((short) 123), Short.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("byte", Byte.class) }, Byte.class);
// $NON-NLS-1$
helpGetString1(func, "123");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBooleanToShorta.
@Test
public void testBooleanToShorta() 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("short", Short.class) }, Short.class);
// $NON-NLS-1$
helpGetString1(func, "1");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBooleanToFloatb.
@Test
public void testBooleanToFloatb() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(Boolean.FALSE, Boolean.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("float", Float.class) }, Float.class);
// $NON-NLS-1$
helpGetString1(func, "cast(0 AS real)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBigIntegerToInteger.
@Test
public void testBigIntegerToInteger() 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.BigInteger("123"), java.math.BigInteger.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("integer", Integer.class) }, Integer.class);
// $NON-NLS-1$
helpGetString1(func, "cast(123 AS int)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testTimestampToTime.
@Test
public void testTimestampToTime() throws Exception {
Literal c = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(89, 2, 3, 7, 8, 12, 99999), Timestamp.class);
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { c, // $NON-NLS-1$
LANG_FACTORY.createLiteral("time", String.class) }, java.sql.Time.class);
// $NON-NLS-1$
helpGetString1(func, "cast(CAST('1989-03-03 07:08:12.0' AS TIMESTAMP) AS time)");
}
Aggregations