use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testDateToTimestamp.
@Test
public void testDateToTimestamp() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(TimestampUtil.createDate(89, 2, 3), java.sql.Date.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("timestamp", String.class) }, java.sql.Timestamp.class);
// $NON-NLS-1$
helpGetString1(func, "CAST('1989-03-03' AS DATE)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier 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 TestSybaseConvertModifier method testByteToBoolean.
@Test
public void testByteToBoolean() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Byte((byte) 1), Byte.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");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testStringToInteger.
/**
*************** End of cast(short AS input)*****************
*/
/**
*************** Beginning of cast(integer AS input) ***********
*/
@Test
public void testStringToInteger() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral("12332", String.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("integer", Integer.class) }, Integer.class);
// $NON-NLS-1$
helpGetString1(func, "cast('12332' AS int)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseConvertModifier method testBigIntegerToBoolean.
@Test
public void testBigIntegerToBoolean() 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("1"), java.math.BigInteger.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