db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chaa...@apache.org
Subject svn commit: r689842 - in /db/derby/docs/trunk/src/ref: rrefjavsqlprst.dita rrefjavsqlrssc.dita
Date Thu, 28 Aug 2008 14:46:17 GMT
Author: chaase3
Date: Thu Aug 28 07:46:17 2008
New Revision: 689842

URL: http://svn.apache.org/viewvc?rev=689842&view=rev
Log:
DERBY-1932:  Reference Manual updates - JDBC Reference section

Modified 2 Reference Manual topics in accordance with review suggestions.

Patch: DERBY-1932-2.diff

Modified:
    db/derby/docs/trunk/src/ref/rrefjavsqlprst.dita
    db/derby/docs/trunk/src/ref/rrefjavsqlrssc.dita

Modified: db/derby/docs/trunk/src/ref/rrefjavsqlprst.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefjavsqlprst.dita?rev=689842&r1=689841&r2=689842&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefjavsqlprst.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefjavsqlprst.dita Thu Aug 28 07:46:17 2008
@@ -142,7 +142,8 @@
 columns of user-defined data types.   </li>
 </ul></note></section>
 <example><title>Example</title><p>The following code fragment shows
how a user can
-store a streamed <i>java.io.File</i> in a LONG VARCHAR column:   <codeblock>
   Statement s = conn.createStatement();
+store a streamed, ASCII-encoded <i>java.io.File</i> in a LONG VARCHAR column:</p>
+<codeblock>    Statement s = conn.createStatement();
     s.executeUpdate("CREATE TABLE atable (a INT, b LONG VARCHAR)");
     conn.commit();
 
@@ -158,6 +159,6 @@
     <b>// set the value of the input parameter to the input stream</b>
     ps.setAsciiStream(2, fin, fileLength);
     ps.execute();
-    conn.commit();</codeblock></p></example>
+    conn.commit();</codeblock></example>
 </refbody>
 </reference>

Modified: db/derby/docs/trunk/src/ref/rrefjavsqlrssc.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefjavsqlrssc.dita?rev=689842&r1=689841&r2=689842&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefjavsqlrssc.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefjavsqlrssc.dita Thu Aug 28 07:46:17 2008
@@ -38,18 +38,14 @@
 column as a stream:   <codeblock>    <b>// retrieve data as a stream</b>
     ResultSet rs = s.executeQuery("SELECT b FROM atable");
     while (rs.next()) {
-        <b>// use a java.io.InputStream to get the data</b>
-        java.io.InputStream ip = rs.getAsciiStream(1);
+        <b>// use a java.io.Reader to get the data</b>
+        java.io.Reader ip = rs.getCharacterStream(1);
 
         <b>// process the stream--this is just a generic way to
         // print the data</b>
-        int columnSize = 0;
-        byte[] buff = new byte[128];
-        for (;;) {
-            int size = ip.read(buff);
-            if (size == -1)
-                break;
-            columnSize += size;
+        char[] buff = new char[128];
+        int size;
+        while ((size = ip.read(buff)) != -1) {
             String chunk = new String(buff, 0, size);
             System.out.print(chunk);
         }



Mime
View raw message