openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtyle...@apache.org
Subject svn commit: r895453 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java openjpa-project/src/doc/manual/ref_guide_mapping.xml openjpa-project/src/doc/manual/supported_databases.xml
Date Sun, 03 Jan 2010 17:55:36 GMT
Author: mtylenda
Date: Sun Jan  3 17:55:35 2010
New Revision: 895453

URL: http://svn.apache.org/viewvc?rev=895453&view=rev
Log:
OPENJPA-1248: Add limited support of LOB streaming on SQL Server; wording corrections.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
    openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_mapping.xml
    openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java?rev=895453&r1=895452&r2=895453&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SQLServerDictionary.java
Sun Jan  3 17:55:35 2010
@@ -16,21 +16,27 @@
  */
 package org.apache.openjpa.jdbc.sql;
 
+import java.io.InputStream;
+import java.io.Reader;
+import java.sql.Blob;
+import java.sql.Clob;
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Types;
 import java.util.Set;
 
+import org.apache.openjpa.jdbc.kernel.JDBCStore;
 import org.apache.openjpa.jdbc.kernel.exps.FilterValue;
-import org.apache.openjpa.kernel.Filters;
 import org.apache.openjpa.jdbc.schema.Column;
+import org.apache.openjpa.kernel.Filters;
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.meta.JavaTypes;
 import org.apache.openjpa.util.StoreException;
 
 /**
- * Dictionary for MS SQLServer.
+ * Dictionary for Microsoft SQL Server.
  */
 public class SQLServerDictionary extends AbstractSQLServerDictionary {
 
@@ -277,4 +283,38 @@
         }
         return recoverable;
     }
+
+    /**
+     * Obtain an {@link InputStream} by using {@link ResultSet#getBlob(int)} and
+     * {@link Blob#getBinaryStream()}.
+     * Unfortunately this will load entire BLOB into memory.
+     * The alternative {@link ResultSet#getBinaryStream(int)} provides true streaming but
+     * the stream can be consumed only as long as {@link ResultSet} is open.
+     */
+    @Override
+    public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException
{
+        Blob blob = rs.getBlob(column);
+        if (blob == null) {
+            return null;
+        }
+        return blob.getBinaryStream();
+    }
+
+    /**
+     * Obtain a {@link Reader} by using {@link ResultSet#getClob(int)} and
+     * {@link Clob#getCharacterStream()}.
+     * Unfortunately this will load entire CLOB into memory.
+     * The alternative {@link ResultSet#getCharacterStream(int)} provides true streaming
but
+     * the stream can be consumed only as long as {@link ResultSet} is open.
+     */
+    @Override
+    public Reader getCharacterStream(ResultSet rs, int column) throws SQLException {
+        Clob clob = rs.getClob(column);
+        if (clob == null) {
+            return null;
+        }
+        return clob.getCharacterStream();
+    }
+
+    
 }

Modified: openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_mapping.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_mapping.xml?rev=895453&r1=895452&r2=895453&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_mapping.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/ref_guide_mapping.xml Sun Jan  3 17:55:35
2010
@@ -2501,7 +2501,7 @@
                   </listitem>
                   <listitem>
                       <para>
-SQLServer 2005
+SQL Server 2005
                       </para>
                   </listitem>
               </itemizedlist>
@@ -2825,6 +2825,11 @@
 PostgreSQL
                     </para>
                 </listitem>
+                <listitem>
+                    <para>
+SQL Server
+                    </para>
+                </listitem>
             </itemizedlist>
             <para>
 See <xref linkend="supported_databases"/> for possible database-specific

Modified: openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml?rev=895453&r1=895452&r2=895453&view=diff
==============================================================================
--- openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml (original)
+++ openjpa/trunk/openjpa-project/src/doc/manual/supported_databases.xml Sun Jan  3 17:55:35
2010
@@ -863,7 +863,7 @@
         </title>
         <example id="example_props_sqlserver">
             <title>
-                Example properties for Microsoft SQLServer
+                Example properties for Microsoft SQL Server
             </title>
 <programlisting>
 openjpa.ConnectionDriverName: com.microsoft.sqlserver.jdbc.SQLServerDriver
@@ -937,6 +937,13 @@
 GenerationType.TABLE, or GenerationType.AUTO.
                     </para> 
                 </listitem>
+                <listitem>
+                    <para>
+The use of <link linkend="ref_guide_streamsupport">LOB streaming</link> is limited.
+When reading LOB data from the database, the Microsoft SQL Server driver will
+actually load all the data into memory at the same time.
+                    </para>
+                </listitem>
             </itemizedlist>
         </section>
     </section>
@@ -1062,7 +1069,7 @@
                     <para>
 The use of <link linkend="ref_guide_streamsupport">LOB streaming</link> is limited.
 When reading LOB data from the database, the MySQL JDBC driver will actually
-load all the data in memory at the same time.
+load all the data into memory at the same time.
                     </para>
                 </listitem>
             </itemizedlist>



Mime
View raw message