[TRAFODION-2753]LOB: filetolob() no longer works in trafci

Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/de664c37
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/de664c37
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/de664c37

Branch: refs/heads/master
Commit: de664c37a95f89573ccc4466357d5ebf94df22a5
Parents: 1ade420
Author: Weiqing Xu <weiqing...@esgyn.cn>
Authored: Mon Sep 25 05:47:56 2017 +0000
Committer: Weiqing Xu <weiqing...@esgyn.cn>
Committed: Mon Sep 25 05:47:56 2017 +0000

----------------------------------------------------------------------
 .../org/trafodion/jdbc/t4/T4Properties.java     | 20 ++++++++++++++++++++
 .../org/trafodion/jdbc/t4/TrafT4ResultSet.java  |  8 ++++----
 .../java/org/trafodion/ci/SessionInterface.java |  2 ++
 3 files changed, 26 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/de664c37/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java
----------------------------------------------------------------------
diff --git 
a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java 
b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java
index 202bc27..3e87910 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/T4Properties.java
@@ -120,6 +120,7 @@ public class T4Properties {
        String blobTableName_;
 
     private int lobChunkSize_ = 10; // default 10M
+    private boolean useLobHandle_ = false;
 
     // private short transportBufferSize_;
        private boolean useArrayBinding_;
@@ -429,6 +430,7 @@ public class T4Properties {
         setTcpNoDelay(getProperty("tcpNoDelay"));
 
         setLobChunkSize(getProperty("lobChunkSize"));
+        setUseLobHandle(getProperty("useLobHandle"));
        }
 
        T4Properties getT4Properties() {
@@ -523,6 +525,7 @@ public class T4Properties {
         props.setProperty("tcpNoDelay", String.valueOf(_tcpNoDelay));
         
         props.setProperty("lobChunkSize", String.valueOf(lobChunkSize_));
+        props.setProperty("useLobHandle", String.valueOf(useLobHandle_));
 
                return props;
        }
@@ -1910,6 +1913,23 @@ public class T4Properties {
         }
     }
 
+    public boolean getUseLobHandle() {
+        return useLobHandle_;
+    }
+
+    public void setUseLobHandle(boolean useLobHandle) {
+        this.useLobHandle_ = useLobHandle;
+    }
+
+    public void setUseLobHandle(String val) {
+        if (val != null) {
+            setUseLobHandle(Boolean.parseBoolean(val));
+        }
+        else {
+            setUseLobHandle(false);
+        }
+    }
+
        /**
         * Returns the rounding mode set for the driver as an Integer value 
with one
         * of the following values. static int ROUND_CEILING Rounding mode to 
round

http://git-wip-us.apache.org/repos/asf/trafodion/blob/de664c37/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java
----------------------------------------------------------------------
diff --git 
a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java 
b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java
index 20338a8..9997f98 100644
--- a/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java
+++ b/core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/TrafT4ResultSet.java
@@ -1857,16 +1857,16 @@ public class TrafT4ResultSet extends TrafT4Handle 
implements java.sql.ResultSet
                        break;
         case Types.BLOB:
             data = getLocalString(columnIndex);
-            if (data != null) {
+            if ( !connection_.props_.getUseLobHandle() && data != null) {
                 Blob blob = new TrafT4Blob(connection_, data, null);
-                return new String((blob.getBytes(1, (int) blob.length())));
+                data = new String((blob.getBytes(1, (int) blob.length())));
             }
             break;
         case Types.CLOB:
             data = getLocalString(columnIndex);
-            if (data != null) {
+            if ( !connection_.props_.getUseLobHandle() && data != null) {
                 Clob clob = new TrafT4Clob(connection_, data, null);
-                return clob.getSubString(1, (int)clob.length());
+                data =  clob.getSubString(1, (int)clob.length());
             }
             break;
                case Types.VARBINARY:

http://git-wip-us.apache.org/repos/asf/trafodion/blob/de664c37/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java
----------------------------------------------------------------------
diff --git 
a/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java 
b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java
index 0243eb1..cf167b5 100644
--- a/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java
+++ b/core/conn/trafci/src/main/java/org/trafodion/ci/SessionInterface.java
@@ -1133,6 +1133,7 @@ public class SessionInterface implements SessionDefaults
       driver.getMajorVersion();
       driver.getMinorVersion();
 
+      connProp.put("useLobHandle", String.valueOf(true));
       connProp.put("user",sessObj.getSessionUser());
       connProp.put("password",sessObj.getSessionPass());
 
@@ -1238,6 +1239,7 @@ public class SessionInterface implements SessionDefaults
       driver.getMajorVersion();
       driver.getMinorVersion();
 
+      connProp.put("useLobHandle", String.valueOf(true));
       connProp.put("user", (user==null?sessObj.getSessionUser():user) );
       
connProp.put("password",(password==null?sessObj.getSessionPass():password));
       connProp.put("roleName", (null==role?"":role));

Reply via email to