Author: shawkins
Date: 2011-12-14 13:54:24 -0500 (Wed, 14 Dec 2011)
New Revision: 3738
Modified:
branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java
Log:
TEIID-1871 fix for calling getObject returing bytes, rather than a string
Modified:
branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java
===================================================================
---
branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java 2011-12-14
16:57:03 UTC (rev 3737)
+++
branches/7.6.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/mysql/MySQL5ExecutionFactory.java 2011-12-14
18:54:24 UTC (rev 3738)
@@ -22,6 +22,9 @@
package org.teiid.translator.jdbc.mysql;
+import java.sql.Blob;
+import java.sql.ResultSet;
+import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -30,6 +33,7 @@
import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.Translator;
import org.teiid.translator.TranslatorException;
+import org.teiid.translator.TypeFacility;
import org.teiid.translator.jdbc.FunctionModifier;
@Translator(name="mysql5", description="A translator for open source
MySQL5 Database")
@@ -75,5 +79,15 @@
public String getLikeRegexString() {
return "REGEXP"; //$NON-NLS-1$
}
-
+
+ @Override
+ public Object retrieveValue(ResultSet results, int columnIndex,
+ Class<?> expectedType) throws SQLException {
+ Object result = super.retrieveValue(results, columnIndex, expectedType);
+ if (expectedType == TypeFacility.RUNTIME_TYPES.STRING && result instanceof
Blob) {
+ return results.getString(columnIndex);
+ }
+ return result;
+ }
+
}
Show replies by date