db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krist...@apache.org
Subject svn commit: r678724 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/jdbc/ testing/org/apache/derby/impl/jdbc/
Date Tue, 22 Jul 2008 11:58:22 GMT
Author: kristwaa
Date: Tue Jul 22 04:58:21 2008
New Revision: 678724

URL: http://svn.apache.org/viewvc?rev=678724&view=rev
Log:
DERBY-3793: Remove unnecessary methods from InternalClob interface.
Removed InternalClob.getBytePosition.
Patch file: derby-3793-1a-remove_getBytePosition.diff

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/InternalClob.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/StoreStreamClob.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TemporaryClob.java
    db/derby/code/trunk/java/testing/org/apache/derby/impl/jdbc/InternalClobTest.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/InternalClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/InternalClob.java?rev=678724&r1=678723&r2=678724&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/InternalClob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/InternalClob.java Tue Jul 22
04:58:21 2008
@@ -49,22 +49,6 @@
     long getByteLength() throws IOException, SQLException;
 
     /**
-     * Obtains the byte position for the given character position.
-     * <p>
-     * The range of valid character positions is 
-     *  <code>1 - Clob.getCharLength() +1</code>, inclusive. The upper bound
is
-     * used when appending to the Clob. Note that specifying a character
-     * position that is more than one longer than the Clob raises an exception.
-     *
-     * @param charPos character position. The first position is <code>1</code>.
-     * @return A 0-based byte position.
-     * @throws EOFException if the position is bigger than the Clob
-     * @throws IOException if accessing the underlying I/O resources fail
-     * @throws SQLException if the specified character position is invalid
-     */
-    long getBytePosition(long charPos) throws IOException, SQLException;
-
-    /**
      * Gets the number of characters in the Clob.
      *
      * @return Number of characters in the Clob.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/StoreStreamClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/StoreStreamClob.java?rev=678724&r1=678723&r2=678724&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/StoreStreamClob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/StoreStreamClob.java Tue Jul
22 04:58:21 2008
@@ -234,20 +234,6 @@
     }
 
     /**
-     * Returns the byte position for the specified character position.
-     *
-     * @param charPos character position. First character is at position 1.
-     * @return Corresponding byte position. First byte is at position 0.
-     * @throws EOFException if the position is bigger then the Clob
-     * @throws IOException if accessing the underlying I/O resources fail
-     * @throws SQLException if accessing the underlying store resources fail
-     */
-    public long getBytePosition(long charPos)
-            throws IOException, SQLException {
-        return UTF8Util.skipFully(getRawByteStream(), charPos -1);
-    }
-
-    /**
      * Not supported.
      *
      * @see InternalClob#getWriter

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TemporaryClob.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TemporaryClob.java?rev=678724&r1=678723&r2=678724&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TemporaryClob.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/TemporaryClob.java Tue Jul
22 04:58:21 2008
@@ -173,9 +173,9 @@
      *      the Clob length +1
      * @throws IOException if accessing underlying I/O resources fail
      */
-    public synchronized long getBytePosition (final long charPos)
+    //@GuardedBy(this)
+    private long getBytePosition (final long charPos)
             throws IOException {
-        checkIfValid();
         long bytePos;
         if (charPos == this.posCache.getCharPos()) {
             // We already know the position.

Modified: db/derby/code/trunk/java/testing/org/apache/derby/impl/jdbc/InternalClobTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derby/impl/jdbc/InternalClobTest.java?rev=678724&r1=678723&r2=678724&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derby/impl/jdbc/InternalClobTest.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derby/impl/jdbc/InternalClobTest.java Tue
Jul 22 04:58:21 2008
@@ -136,16 +136,6 @@
         }
     }
 
-    public void testGetBytePositionAfterRelease()
-            throws IOException, SQLException {
-        iClob.release();
-        try {
-            iClob.getBytePosition(1L);
-            fail("Exception should have been raised, but was not");
-        } catch (IllegalStateException ise) {
-            // This is as expected.
-        }
-    }
     public void testGetCharLengthAfterRelease()
             throws IOException, SQLException {
         iClob.release();
@@ -235,48 +225,6 @@
         assertEquals(this.initialByteLength, iClob.getByteLength());
     }
 
-    public void testGetBytePosition_first()
-            throws IOException, SQLException {
-        assertEquals(0L, iClob.getBytePosition(1L));
-    }
-
-    public void testGetBytePosition_second()
-            throws IOException, SQLException {
-        assertEquals(bytesPerChar, iClob.getBytePosition(2L));
-    }
-
-    public void testGetBytePosition_last()
-            throws IOException, SQLException {
-        assertEquals(initialByteLength - bytesPerChar,
-                     iClob.getBytePosition(this.initialCharLength));
-    }
-
-    public void testGetBytePosition_lastPlussOne()
-            throws IOException, SQLException {
-        assertEquals(initialByteLength,
-                     iClob.getBytePosition(this.initialCharLength +1));
-    }
-
-    public void testGetBytePosition_lastPlussTwo()
-            throws IOException, SQLException {
-        try {
-            long pos = iClob.getBytePosition(this.initialCharLength +2);
-            fail("Length +2 should have no valid byte position, got " + pos);
-        } catch (EOFException ioe) {
-            // As expected for Derby.
-        }
-    }
-
-    public void testGetBytePosition_lastPlussThousand()
-            throws IOException, SQLException {
-        try {
-            long pos = iClob.getBytePosition(this.initialCharLength +1000);
-            fail("Length +1000 should have no valid byte position, got " + pos);
-        } catch (EOFException ioe) {
-            // As expected for Derby.
-        }
-    }
-
     public void testGetCharLength()
             throws IOException, SQLException {
         assertEquals(this.initialCharLength, iClob.getCharLength());



Mime
View raw message