openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r955283 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java
Date Wed, 16 Jun 2010 16:07:14 GMT
Author: faywang
Date: Wed Jun 16 16:07:14 2010
New Revision: 955283

URL: http://svn.apache.org/viewvc?rev=955283&view=rev
Log:
OPENJPA-1699: Streaming LOB support for DB2

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java?rev=955283&r1=955282&r2=955283&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DB2Dictionary.java
Wed Jun 16 16:07:14 2010
@@ -19,6 +19,9 @@
 package org.apache.openjpa.jdbc.sql;
 
 import java.io.ByteArrayInputStream;
+import java.io.CharArrayReader;
+import java.io.InputStream;
+import java.io.Reader;
 import java.lang.reflect.Method;
 import java.sql.Blob;
 import java.sql.Connection;
@@ -29,12 +32,11 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
 import java.util.Arrays;
-import java.util.Set;
 import java.util.StringTokenizer;
 
 import org.apache.openjpa.jdbc.identifier.DBIdentifier;
-import org.apache.openjpa.jdbc.identifier.QualifiedDBIdentifier;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
+import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
 import org.apache.openjpa.jdbc.kernel.exps.Lit;
 import org.apache.openjpa.jdbc.kernel.exps.Param;
@@ -1034,4 +1036,41 @@ public class DB2Dictionary
             }
         }
     }
+    
+    public void insertBlobForStreamingLoad(Row row, Column col, 
+            JDBCStore store, Object ob, Select sel) throws SQLException {
+        if (ob != null) {
+            if (ob instanceof InputStream) {
+                InputStream is = (InputStream)ob;
+                row.setBinaryStream(col, is, -1);
+            } else
+                row.setBinaryStream(col, 
+                        new ByteArrayInputStream(new byte[0]), 0);
+        } else {
+            row.setNull(col);
+        }
+    }
+
+    public void insertClobForStreamingLoad(Row row, Column col, Object ob)
+    throws SQLException {
+        if (ob != null) {
+            if (ob instanceof Reader) {
+                row.setCharacterStream(col, (Reader)ob, -1);
+            } else
+                row.setCharacterStream(col,
+                        new CharArrayReader(new char[0]), 0);
+        } else {
+            row.setNull(col);
+        }
+    }
+
+    public void updateBlob(Select sel, JDBCStore store, InputStream is)
+        throws SQLException {
+        //NO-OP
+    }
+
+    public void updateClob(Select sel, JDBCStore store, Reader reader)
+        throws SQLException {
+        //NO-OP
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java?rev=955283&r1=955282&r2=955283&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/jdbc/meta/strats/AbstractLobTest.java
Wed Jun 16 16:07:14 2010
@@ -30,6 +30,7 @@ import javax.persistence.Query;
 import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.datacache.DataCachePCData;
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.MySQLDictionary;
 import org.apache.openjpa.jdbc.sql.OracleDictionary;
@@ -50,9 +51,10 @@ public abstract class AbstractLobTest ex
 
     protected static boolean firstTestExecuted;
 
-    protected List<Class<? extends DBDictionary>> supportedDatabases =
-        new ArrayList<Class<? extends DBDictionary>>
-            (Arrays.asList(MySQLDictionary.class, OracleDictionary.class, SQLServerDictionary.class));
+    protected List<Class<?>> supportedDatabases =
+        new ArrayList<Class<?>>
+            (Arrays.asList(MySQLDictionary.class, OracleDictionary.class, SQLServerDictionary.class,
+                    DB2Dictionary.class));
         
     public void setUp() throws Exception {
         setSupportedDatabases(supportedDatabases.toArray(new Class<?>[] {}));



Mime
View raw message