mirror of
https://github.com/apache/openjpa.git
synced 2025-02-21 01:15:30 +00:00
OPENJPA-1699: Streaming LOB support for DB2
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@955283 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8a2b1c1f08
commit
7450df02a4
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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 extends SingleEMFTestCase {
|
||||
|
||||
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<?>[] {}));
|
||||
|
Loading…
x
Reference in New Issue
Block a user