Author: shawkins
Date: 2011-10-07 16:31:32 -0400 (Fri, 07 Oct 2011)
New Revision: 3545
Modified:
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java
Log:
TEIID-1776 back port of fix
Modified:
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java
===================================================================
---
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2011-10-07
16:52:06 UTC (rev 3544)
+++
branches/7.4.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/ingres/IngresExecutionFactory.java 2011-10-07
20:31:32 UTC (rev 3545)
@@ -57,13 +57,14 @@
convert.addTypeMapping("decimal(38,19)", FunctionModifier.BIGDECIMAL);
//$NON-NLS-1$
convert.addTypeMapping("decimal(15,0)", FunctionModifier.BIGINTEGER);
//$NON-NLS-1$
convert.addTypeMapping("date", FunctionModifier.DATE); //$NON-NLS-1$
- convert.addTypeMapping("time with time zone", FunctionModifier.TIME);
//$NON-NLS-1$
- convert.addTypeMapping("timestamp with time zone",
FunctionModifier.TIMESTAMP); //$NON-NLS-1$
+ convert.addTypeMapping("time", FunctionModifier.TIME); //$NON-NLS-1$
+ convert.addTypeMapping("timestamp", FunctionModifier.TIMESTAMP);
//$NON-NLS-1$
convert.addTypeMapping("char(1)", FunctionModifier.CHAR); //$NON-NLS-1$
convert.addTypeMapping("varchar(4000)", FunctionModifier.STRING);
//$NON-NLS-1$
convert.addTypeMapping("blob", FunctionModifier.BLOB); //$NON-NLS-1$
convert.addTypeMapping("clob", FunctionModifier.CLOB); //$NON-NLS-1$
convert.addNumericBooleanConversions();
+ convert.setWideningNumericImplicit(true);
registerFunctionModifier(SourceSystemFunctions.CONVERT, convert);
registerFunctionModifier(SourceSystemFunctions.BITAND, new
AliasModifier("bit_and")); //$NON-NLS-1$
Modified:
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java
===================================================================
---
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java 2011-10-07
16:52:06 UTC (rev 3544)
+++
branches/7.4.x/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/ingres/TestIngresConvertModifier.java 2011-10-07
20:31:32 UTC (rev 3545)
@@ -68,7 +68,7 @@
}
@Test public void testBooleanToBigDecimal() throws Exception {
- helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class),
"bigdecimal", "cast(1 AS decimal(38,19))"); //$NON-NLS-1$
//$NON-NLS-2$
+ helpTest(LANG_FACTORY.createLiteral(Boolean.TRUE, Boolean.class),
"bigdecimal", "1"); //$NON-NLS-1$ //$NON-NLS-2$
}
// Source = BYTE
@@ -82,7 +82,7 @@
}
@Test public void testBigIntegerToDouble() throws Exception {
- helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"),
BigInteger.class), "double", "cast(1 AS float)"); //$NON-NLS-1$
//$NON-NLS-2$ //$NON-NLS-3$
+ helpTest(LANG_FACTORY.createLiteral(new BigInteger("1"),
BigInteger.class), "double", "1"); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
}
// Source = FLOAT
@@ -106,7 +106,7 @@
// Source = DATE
@Test public void testDateToTimestamp() throws Exception {
- helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1),
java.sql.Date.class), "timestamp", "cast(DATE '2003-11-01' AS
timestamp with time zone)"); //$NON-NLS-1$ //$NON-NLS-2$
+ helpTest(LANG_FACTORY.createLiteral(TimestampUtil.createDate(103, 10, 1),
java.sql.Date.class), "timestamp", "cast(DATE '2003-11-01' AS
timestamp)"); //$NON-NLS-1$ //$NON-NLS-2$
}
// Source = TIME