trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevinxu021 <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #799: [TRAFODION-2308]JDBC T4 support read ...
Date Fri, 04 Nov 2016 08:03:27 GMT
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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message