Author: shawkins
Date: 2012-05-21 15:03:10 -0400 (Mon, 21 May 2012)
New Revision: 4132
Modified:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
Log:
TEIID-2056 fix for oracle lob handling
Modified:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java
===================================================================
---
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-05-21
19:02:53 UTC (rev 4131)
+++
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/JDBCExecutionFactory.java 2012-05-21
19:03:10 UTC (rev 4132)
@@ -24,14 +24,7 @@
import java.math.BigDecimal;
import java.math.BigInteger;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Time;
-import java.sql.Timestamp;
+import java.sql.*;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Calendar;
@@ -47,34 +40,14 @@
import javax.sql.DataSource;
import org.teiid.core.util.PropertiesUtils;
-import org.teiid.language.Argument;
-import org.teiid.language.Call;
-import org.teiid.language.ColumnReference;
-import org.teiid.language.Command;
-import org.teiid.language.Expression;
-import org.teiid.language.Function;
-import org.teiid.language.LanguageObject;
-import org.teiid.language.Limit;
-import org.teiid.language.Literal;
-import org.teiid.language.QueryExpression;
-import org.teiid.language.SQLConstants;
-import org.teiid.language.SetQuery;
+import org.teiid.language.*;
import org.teiid.language.Argument.Direction;
import org.teiid.language.SetQuery.Operation;
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.MetadataFactory;
import org.teiid.metadata.RuntimeMetadata;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.ExecutionFactory;
-import org.teiid.translator.ProcedureExecution;
-import org.teiid.translator.ResultSetExecution;
-import org.teiid.translator.SourceSystemFunctions;
-import org.teiid.translator.Translator;
-import org.teiid.translator.TranslatorException;
-import org.teiid.translator.TranslatorProperty;
-import org.teiid.translator.TypeFacility;
-import org.teiid.translator.UpdateExecution;
+import org.teiid.translator.*;
/**
@@ -841,6 +814,19 @@
stmt.setBigDecimal(i, (BigDecimal)param);
return;
}
+
+ if (useStreamsForLobs()) {
+ if (param instanceof Blob) {
+ Blob blob = (Blob)param;
+ stmt.setBinaryStream(i, blob.getBinaryStream(), blob.length());
+ return;
+ }
+ if (param instanceof Clob) {
+ Clob clob = (Clob)param;
+ stmt.setCharacterStream(i, clob.getCharacterStream(), clob.length());
+ return;
+ }
+ }
//convert these the following to jdbc safe values
if (TypeFacility.RUNTIME_TYPES.BIG_INTEGER.equals(paramType)) {
param = new BigDecimal((BigInteger)param);
@@ -853,6 +839,14 @@
stmt.setObject(i, param, type);
}
+ /**
+ * If streams should be used for Blob/Clob sets on {@link PreparedStatement}s
+ * @return
+ */
+ public boolean useStreamsForLobs() {
+ return false;
+ }
+
/**
* Retrieve the value on the current resultset row for the given column index.
* @param results
Modified:
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
---
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2012-05-21
19:02:53 UTC (rev 4131)
+++
branches/7.7.x/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2012-05-21
19:03:10 UTC (rev 4132)
@@ -449,6 +449,11 @@
}
@Override
+ public boolean useStreamsForLobs() {
+ return true;
+ }
+
+ @Override
public NullOrder getDefaultNullOrder() {
return NullOrder.HIGH;
}
Show replies by date