db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r544424 - in /db/derby/code/trunk/java/client/org/apache/derby/client/am: Clob.java ClobOutputStream.java Cursor.java PreparedStatement.java ResultSet.java
Date Tue, 05 Jun 2007 08:59:03 GMT
Author: kristwaa
Date: Tue Jun  5 01:59:01 2007
New Revision: 544424

URL: http://svn.apache.org/viewvc?view=rev&rev=544424
Log:
DERBY-1519: 'setAsciiStream' uses different encodings for embedded and client. Client changed
to use ISO-8859-1 to comply with JDBC and the embedded driver. This change can cause incompatibilities
for certain applications (see release notes).
Patch file: derby-1519-1a.diff

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java?view=diff&rev=544424&r1=544423&r2=544424
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Clob.java Tue Jun  5 01:59:01
2007
@@ -100,7 +100,7 @@
     }
 
     // CTOR for ascii/unicode stream input
-    //"US-ASCII", "UTF-8", or "UnicodeBigUnmarked"
+    //"ISO-8859-1", "UTF-8", or "UnicodeBigUnmarked"
     public Clob(Agent agent,
                 java.io.InputStream inputStream,
                 String encoding,
@@ -111,7 +111,7 @@
 
         setSqlLength(length);
 
-        if (encoding.equals("US-ASCII")) {
+        if (encoding.equals("ISO-8859-1")) {
             asciiStream_ = inputStream;
             dataType_ |= ASCII_STREAM;
         } else if (encoding.equals("UTF-8")) { // "UTF-8"
@@ -141,7 +141,7 @@
      *
      * @param agent
      * @param inputStream the data to insert
-     * @param encoding encoding to use for characters. Only "US-ASCII" is
+     * @param encoding encoding to use for characters. Only "ISO-8859-1" is
      *      allowed.
      */
     public Clob(Agent agent, java.io.InputStream inputStream, String encoding)
@@ -150,7 +150,7 @@
         this(agent,
              isLayerBStreamingPossible( agent ));
         
-        if (encoding.equals("US-ASCII")) {
+        if (encoding.equals("ISO-8859-1")) {
             asciiStream_ = inputStream;
             dataType_ |= ASCII_STREAM;
         } else {
@@ -1004,12 +1004,12 @@
     public void convertFromAsciiToCharacterStream() throws SqlException {
         try {
             characterStream_ =
-                    new java.io.InputStreamReader(asciiStream_, "US-ASCII");
+                    new java.io.InputStreamReader(asciiStream_, "ISO-8859-1");
             dataType_ = CHARACTER_STREAM;
         } catch (java.io.UnsupportedEncodingException e) {
             throw new SqlException(agent_.logWriter_, 
                 new ClientMessageId(SQLState.UNSUPPORTED_ENCODING), 
-                "US-ASCII", "CharacterStream", e);
+                "ISO-8859-1", "CharacterStream", e);
         }
     }
 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java?view=diff&rev=544424&r1=544423&r2=544424
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ClobOutputStream.java Tue Jun
 5 01:59:01 2007
@@ -67,7 +67,7 @@
     {
         // Since this is an OutputStream returned by Clob.setAsciiStream 
         // use Ascii encoding when creating the String from bytes
-        String str = new String(b, "US-ASCII");
+        String str = new String(b, "ISO-8859-1");
         clob_.string_ = clob_.string_.substring(0, (int) offset_ - 1);
         clob_.string_ = clob_.string_.concat(str);
         clob_.asciiStream_ = new java.io.StringBufferInputStream(clob_.string_);

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java?view=diff&rev=544424&r1=544423&r2=544424
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/Cursor.java Tue Jun  5 01:59:01
2007
@@ -1041,7 +1041,7 @@
                 return c.getAsciiStream();
             case java.sql.Types.CHAR:
                 try {
-                    return new java.io.ByteArrayInputStream(getCHAR(column).getBytes("US-ASCII"));
+                    return new java.io.ByteArrayInputStream(getCHAR(column).getBytes("ISO-8859-1"));
                 } catch (java.io.UnsupportedEncodingException e) {
                     throw new SqlException(agent_.logWriter_, 
                     		new ClientMessageId (SQLState.UNSUPPORTED_ENCODING), 
@@ -1050,7 +1050,7 @@
             case java.sql.Types.VARCHAR:
             case java.sql.Types.LONGVARCHAR:
                 try {
-                    return new java.io.ByteArrayInputStream(getVARCHAR(column).getBytes("US-ASCII"));
+                    return new java.io.ByteArrayInputStream(getVARCHAR(column).getBytes("ISO-8859-1"));
                 } catch (java.io.UnsupportedEncodingException e) {
                     throw new SqlException(agent_.logWriter_, 
                     		new ClientMessageId (SQLState.UNSUPPORTED_ENCODING), 

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java?view=diff&rev=544424&r1=544423&r2=544424
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/PreparedStatement.java Tue
Jun  5 01:59:01 2007
@@ -1095,7 +1095,7 @@
                         new ClientMessageId(SQLState.CLIENT_LENGTH_OUTSIDE_RANGE_FOR_DATATYPE),
                         new Long(length), new Integer(Integer.MAX_VALUE)).getSQLException();
                 }
-                setInput(parameterIndex, new Clob(agent_, x, "US-ASCII", (int)length));
+                setInput(parameterIndex, new Clob(agent_, x, "ISO-8859-1", (int)length));
             }
         }
         catch ( SqlException se )
@@ -2570,7 +2570,7 @@
                     setNull(parameterIndex, java.sql.Types.LONGVARCHAR);
                     return;
                 }
-                setInput(parameterIndex, new Clob(agent_, x, "US-ASCII"));
+                setInput(parameterIndex, new Clob(agent_, x, "ISO-8859-1"));
             } catch (SqlException se) {
                 throw se.getSQLException();
             }

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?view=diff&rev=544424&r1=544423&r2=544424
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Tue Jun  5 01:59:01
2007
@@ -3040,7 +3040,7 @@
                     agent_.logWriter_.traceEntry(this, "updateAsciiStream", column, x, length);
                 }
                 checkUpdatePreconditions(column, "updateAsciiStream");
-                updateColumn(column, agent_.crossConverters_.setObjectFromCharacterStream(resultSetMetaData_.types_[column
- 1], x, "US-ASCII", length));
+                updateColumn(column, agent_.crossConverters_.setObjectFromCharacterStream(resultSetMetaData_.types_[column
- 1], x, "ISO-8859-1", length));
             }
         }
         catch ( SqlException se )
@@ -5563,7 +5563,7 @@
                         agent_.crossConverters_.setObjectFromCharacterStream(
                             resultSetMetaData_.types_[columnIndex -1],
                             x,
-                            "US-ASCII",
+                            "ISO-8859-1",
                             CrossConverters.UNKNOWN_LENGTH));
             } catch (SqlException se) {
                 throw se.getSQLException();



Mime
View raw message