[
https://issues.apache.org/jira/browse/TRAFODION-2308?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15635604#comment-15635604
]
ASF GitHub Bot commented on TRAFODION-2308:
-------------------------------------------
Github user kevinxu021 commented on a diff in the pull request:
https://github.com/apache/incubator-trafodion/pull/799#discussion_r86500943
--- Diff:
core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Clob.java ---
@@ -0,0 +1,204 @@
+// @@@ START COPYRIGHT @@@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+// @@@ END COPYRIGHT @@@
+
+package org.trafodion.jdbc.t4;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.io.Writer;
+import java.sql.Clob;
+import java.sql.SQLException;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+public class TrafT4Clob implements Clob {
+
+ private String data_;
+ private boolean isFreed_;
+ private String lobHandle_ = null;
+ private TrafT4Connection connection_ = null;
+
+ public TrafT4Clob(TrafT4Connection connection, String lobHandle) throws
SQLException {
+ if (connection == null) {
+ throw
TrafT4Messages.createSQLException(connection_.props_, null, null, null);
+ }
+
+ this.connection_ = connection;
+ this.lobHandle_ = lobHandle;
+ if (connection_.props_.t4Logger_.isLoggable(Level.FINE) ==
true) {
+ Object p[] =
T4LoggingUtilities.makeParams(connection_.props_, connection, lobHandle);
+ connection_.props_.t4Logger_.logp(Level.FINE,
"TrafT4ResultSet", "getClob", "", p);
+ }
+ if (connection_.props_.getLogWriter() != null) {
+ LogRecord lr = new LogRecord(Level.FINE, "");
+ Object p[] =
T4LoggingUtilities.makeParams(connection_.props_, connection, lobHandle);
+ lr.setParameters(p);
+ lr.setSourceClassName("TrafT4ResultSet");
+ lr.setSourceMethodName("getClob");
+ T4LogFormatter lf = new T4LogFormatter();
+ String temp = lf.format(lr);
+ connection_.props_.getLogWriter().println(temp);
+ }
+
+ try {
+ if (lobHandle_ != null) {
+ T4Connection t4connection =
this.connection_.getServerHandle().getT4Connection();
+ LogicalByteArray wbuffer =
ExtractLobMessage.marshal(ExtractLobMessage.LOB_EXTRACT_BUFFER, lobHandle_, 1,
0,
+ connection_.ic_);
+ LogicalByteArray rbuffer =
t4connection.getReadBuffer(TRANSPORT.SRVR_API_EXTRACTLOB, wbuffer);
+ ExtractLobReply reply = new
ExtractLobReply(rbuffer, connection_.ic_);
+
+ this.data_ = new String(reply.lobDataValue,
"UTF-8");
+ isFreed_ = false;
+ }
+ }
+ catch (Exception e) {
+
--- End diff --
log this exception
> JDBC T4 support read LOB
> ------------------------
>
> Key: TRAFODION-2308
> URL: https://issues.apache.org/jira/browse/TRAFODION-2308
> Project: Apache Trafodion
> Issue Type: Sub-task
> Components: client-jdbc-t4, connectivity-mxosrvr
> Reporter: Weiqing Xu
> Assignee: Weiqing Xu
>
> JDBC T4 need implement some API to support CLOB and BLOB.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)