Github user kevinxu021 commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/799#discussion_r86500287
  
    --- Diff: 
core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4Blob.java ---
    @@ -0,0 +1,166 @@
    +// @@@ 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.ByteArrayInputStream;
    +import java.io.IOException;
    +import java.io.InputStream;
    +import java.io.OutputStream;
    +import java.sql.Blob;
    +import java.sql.SQLException;
    +import java.util.logging.Level;
    +import java.util.logging.LogRecord;
    +
    +public class TrafT4Blob implements Blob {
    +   private byte[] data_;
    +   private boolean isFreed_ = false;
    +   private TrafT4Connection connection_ = null;
    +
    +   public TrafT4Blob(TrafT4Connection connection, String lobHandle) throws 
SQLException {
    +           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);
    +           }
    +   }
    +
    +   public InputStream getBinaryStream() throws SQLException {
    +           testAvailability();
    +           return new ByteArrayInputStream(this.data_);
    +   }
    +
    +   public InputStream getBinaryStream(long pos, long length) throws 
SQLException {
    +           testAvailability();
    +           
TrafT4Messages.throwUnsupportedFeatureException(connection_.props_, 
connection_.getLocale(),
    +                           "getBinaryStream()");
    +           return null;
    +   }
    +
    +   /*
    +    * Retrieves all or part of the BLOB value that this Blob object 
represents,
    +    * as an array of bytes. This byte array contains up to length 
consecutive
    +    * bytes starting at position pos.
    +    *  */
    +   public byte[] getBytes(long pos, int length) throws SQLException {
    +           testAvailability();
    +
    +           byte[] buf = null;
    +           int startPos = (int)pos - 1;
    +           int endPos = startPos + length;
    +
    +           if((startPos > data_.length) || (startPos < 0) || (length < 0))
    +                   throw 
TrafT4Messages.createSQLException(this.connection_.props_, 
this.connection_.getLocale(),
    +                                   "out_of_lob_bound_msg", null);
    --- End diff --
    
    should be "out_of_log_bound"


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to