Author: shawkins
Date: 2010-08-06 01:00:38 -0400 (Fri, 06 Aug 2010)
New Revision: 2422
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
Log:
TEIID-1181 updating sqlserver/sybase logic to avoid the byte type
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
---
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-08-06
04:57:28 UTC (rev 2421)
+++
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2010-08-06
05:00:38 UTC (rev 2422)
@@ -930,7 +930,7 @@
* @return the value
* @throws SQLException
*/
- public Object retrieveValue(CallableStatement results, int parameterIndex, Class
expectedType) throws SQLException{
+ public Object retrieveValue(CallableStatement results, int parameterIndex,
Class<?> expectedType) throws SQLException{
Integer code = TYPE_CODE_MAP.get(expectedType);
if(code != null) {
switch(code.intValue()) {
Modified:
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java
===================================================================
---
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java 2010-08-06
04:57:28 UTC (rev 2421)
+++
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/sybase/SybaseExecutionFactory.java 2010-08-06
05:00:38 UTC (rev 2422)
@@ -24,6 +24,10 @@
*/
package org.teiid.translator.jdbc.sybase;
+import java.sql.CallableStatement;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -37,6 +41,7 @@
import org.teiid.translator.TranslatorException;
import org.teiid.translator.ExecutionContext;
import org.teiid.translator.SourceSystemFunctions;
+import org.teiid.translator.TypeFacility;
import org.teiid.translator.jdbc.AliasModifier;
import org.teiid.translator.jdbc.ConvertModifier;
import org.teiid.translator.jdbc.EscapeSyntaxModifier;
@@ -332,4 +337,32 @@
public boolean booleanNullable() {
return false;
}
+
+ @Override
+ public Object retrieveValue(ResultSet results, int columnIndex,
+ Class<?> expectedType) throws SQLException {
+ if (expectedType == TypeFacility.RUNTIME_TYPES.BYTE) {
+ expectedType = TypeFacility.RUNTIME_TYPES.SHORT;
+ }
+ return super.retrieveValue(results, columnIndex, expectedType);
+ }
+
+ @Override
+ public Object retrieveValue(CallableStatement results, int parameterIndex,
+ Class<?> expectedType) throws SQLException {
+ if (expectedType == TypeFacility.RUNTIME_TYPES.BYTE) {
+ expectedType = TypeFacility.RUNTIME_TYPES.SHORT;
+ }
+ return super.retrieveValue(results, parameterIndex, expectedType);
+ }
+
+ @Override
+ public void bindValue(PreparedStatement stmt, Object param,
+ Class<?> paramType, int i) throws SQLException {
+ if (paramType == TypeFacility.RUNTIME_TYPES.BYTE) {
+ paramType = TypeFacility.RUNTIME_TYPES.SHORT;
+ param = ((Byte)param).shortValue();
+ }
+ super.bindValue(stmt, param, paramType, i);
+ }
}
Show replies by date