use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBigIntegerToByte.
@Test
public void testBigIntegerToByte() 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("byte", Byte.class) }, Byte.class);
// $NON-NLS-1$
helpGetString1(func, "cast(123 AS smallint)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testByteToInteger.
@Test
public void testByteToInteger() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(new Byte((byte) 12), Byte.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("integer", Integer.class) }, Integer.class);
// $NON-NLS-1$
helpGetString1(func, "cast(12 AS int)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testBigIntegerToShort.
@Test
public void testBigIntegerToShort() 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("short", Short.class) }, Short.class);
// $NON-NLS-1$
helpGetString1(func, "cast(123 AS smallint)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testStringToLong.
/**
*************** End of cast(integer AS input)*****************
*/
/**
*************** Beginning of cast(long AS input) ***********
*/
@Test
public void testStringToLong() throws Exception {
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { // $NON-NLS-1$
LANG_FACTORY.createLiteral("12332131413", String.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("long", Long.class) }, Long.class);
// $NON-NLS-1$
helpGetString1(func, "cast('12332131413' AS bigint)");
}
use of org.teiid.language.Function in project teiid by teiid.
the class TestSybaseIQConvertModifier method testStringToTime.
/**
******************END of cast(date AS INPUT) *****************
*/
/**
******************Beginning of cast(time AS INPUT) *****************
*/
@Test
public void testStringToTime() throws Exception {
// $NON-NLS-1$
String timeStr = "12:08:07";
Function func = // $NON-NLS-1$
LANG_FACTORY.createFunction(// $NON-NLS-1$
"convert", new Expression[] { LANG_FACTORY.createLiteral(timeStr, String.class), // $NON-NLS-1$
LANG_FACTORY.createLiteral("time", String.class) }, java.sql.Time.class);
// $NON-NLS-1$
helpGetString1(func, "cast('12:08:07' AS time)");
}
Aggregations