use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBooleanToLonga.
@Test
public void testBooleanToLonga() 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("long", Long.class) }, Long.class);
// $NON-NLS-1$
helpGetString1(func, "cast(1 AS bigint)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testStringToFloat.
/**
*************** End of cast(biginteger AS input)*****************
*/
/**
*************** Beginning of cast(float AS input) ***********
*/
@Test
public void testStringToFloat() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral("123", String.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("float", Float.class) }, Float.class);
// $NON-NLS-1$
helpGetString1(func, "cast('123' AS real)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier 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(CAST('1989-03-03' AS DATE) AS timestamp)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier 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)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testStringToBoolean.
/**
*************** End of cast(char AS input)*****************
*/
/**
*************** Beginning of cast(boolean AS input) ***********
*/
@Test
public void testStringToBoolean() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral("true", String.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("boolean", Boolean.class) }, Boolean.class);
// $NON-NLS-1$
helpGetString1(func, "CASE WHEN 'true' IN ('false', '0') THEN 0 WHEN 'true' IS NOT NULL THEN 1 END");
}
Aggregations