Author: shawkins
Date: 2010-10-21 14:49:17 -0400 (Thu, 21 Oct 2010)
New Revision: 2672
Modified:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
Log:
TEIID-1314 fix to address bigdecimal truncation with jConnect 6
Modified:
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
---
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-10-21
18:43:02 UTC (rev 2671)
+++
branches/7.1.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-10-21
18:49:17 UTC (rev 2672)
@@ -817,6 +817,11 @@
stmt.setTimestamp(i,(java.sql.Timestamp)param, getDatabaseCalendar());
return;
}
+ //not all drivers handle the setObject call with BigDecimal correctly (namely
jConnect 6.05)
+ if (TypeFacility.RUNTIME_TYPES.BIG_DECIMAL.equals(paramType)) {
+ stmt.setBigDecimal(i, (BigDecimal)param);
+ return;
+ }
//convert these the following to jdbc safe values
if (TypeFacility.RUNTIME_TYPES.BIG_INTEGER.equals(paramType)) {
param = new BigDecimal((BigInteger)param);
@@ -824,7 +829,8 @@
param = new Double(((Float)param).doubleValue());
} else if (TypeFacility.RUNTIME_TYPES.CHAR.equals(paramType)) {
param = ((Character)param).toString();
- }
+ }
+
stmt.setObject(i, param, type);
}
Show replies by date