use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier 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 TestSybaseConvertModifier method testStringToBigInteger.
/**
*************** End of cast(long AS input)*****************
*/
/**
*************** Beginning of cast(biginteger AS input) ***********
*/
@Test
public void testStringToBigInteger() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral("12323143241414", String.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("biginteger", java.math.BigInteger.class) }, java.math.BigInteger.class);
// $NON-NLS-1$
helpGetString1(func, "cast('12323143241414' AS numeric(38, 0))");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testBooleanToBytea.
@Test
public void testBooleanToBytea() 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("byte", Byte.class) }, Byte.class);
// $NON-NLS-1$
helpGetString1(func, "1");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testTimestampToString.
@Test
public void testTimestampToString() throws Exception {
Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(ts, Timestamp.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("string", String.class) }, String.class);
// $NON-NLS-1$
helpGetString1(func, "stuff(stuff(convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 102), 5, 1, '-'), 8, 1, '-')+convert(varchar, CAST('2003-11-01 12:05:02.0' AS DATETIME), 8)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testLongToByte.
@Test
public void testLongToByte() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Long(1231232341), Long.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("byte", Byte.class) }, Byte.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1231232341 AS smallint)");
}
Aggregations