Package javax.sql.rowset.serial

Examples of javax.sql.rowset.serial.SerialClob


        assertTrue(Arrays.equals(mockClob.buf, data));
        assertFalse(reader.ready());
    }

    public void testGetSubString() throws Exception {
        SerialClob serialClob = new SerialClob("hello".toCharArray());

        String sub = serialClob.getSubString(1, 5);
        assertEquals("hello", sub);

        sub = serialClob.getSubString(2, 3);
        assertEquals("ell", sub);

        try {
            sub = serialClob.getSubString(0, 6);
            fail("should throw SerialException");
        } catch (SerialException e) {
            // expected
        }

        try {
            sub = serialClob.getSubString(7, 1);
            fail("should throw SerialException");
        } catch (SerialException e) {
            // expected
        }

        try {
            sub = serialClob.getSubString(1, 7);
            fail("should throw SerialException");
        } catch (SerialException e) {
            // expected
        }

        try {
            sub = serialClob.getSubString(1, -2);
            fail("should throw SerialException");
        } catch (SerialException e) {
            // expected
        }
        try {
            sub = serialClob.getSubString(3, 4);
            fail("should throw SerialException");
        } catch (SerialException e) {
            // expected
        }

        LongLengthClob longClob = new LongLengthClob();
        serialClob = new SerialClob(longClob);

        try {
            serialClob.getSubString(1, 3);
            fail("should throw SerialException");
        } catch (SerialException e) {
            // expected
        }
View Full Code Here


        }

    }

    public void testPositionLClobJ() throws Exception {
        SerialClob serialClob = new SerialClob("helloo".toCharArray());
        SerialClob searchClob = new SerialClob("llo".toCharArray());
        long pos = serialClob.position(searchClob, 1);
        assertEquals(3, pos);

        pos = serialClob.position(searchClob, 3);
        assertEquals(3, pos);

        searchClob = new SerialClob("o".toCharArray());
        pos = serialClob.position(searchClob, 6);
        assertEquals(6, pos);

        searchClob = new SerialClob("ooooooo".toCharArray());
        pos = serialClob.position(searchClob, 1);
        assertEquals(-1, pos);

        searchClob = new SerialClob("llo".toCharArray());
        pos = serialClob.position(searchClob, 4);
        assertEquals(-1, pos);

        pos = serialClob.position(searchClob, 0);
        assertEquals(-1, pos);
View Full Code Here

        pos = serialClob.position(searchClob, 10);
        assertEquals(-1, pos);
    }

    public void testPositionLStringJ() throws Exception {
        SerialClob serialClob = new SerialClob("helloo".toCharArray());

        long pos = serialClob.position("llo", 1);
        assertEquals(3, pos);

        pos = serialClob.position("llo", 3);
        assertEquals(3, pos);

        pos = serialClob.position("o", 6);
        assertEquals(6, pos);

        pos = serialClob.position("ooooooo", 1);
        assertEquals(-1, pos);

        pos = serialClob.position("llo", 4);
        assertEquals(-1, pos);

        pos = serialClob.position("llo", 0);
        assertEquals(-1, pos);

        pos = serialClob.position("llo", -1);
        assertEquals(-1, pos);

        pos = serialClob.position("llo", 10);
        assertEquals(-1, pos);
    }
View Full Code Here

   * so I don't have to, namely javax.sql.rowset.serial.SerialClob.
   */
  public void testLobFieldFiltered() throws Exception {
    Object docid = 2;
    String expectedDocid = "B/" + docid;
    Object clobContent = new SerialClob("hello, world".toCharArray()) {
        @Override
        public String toString() { throw new IllegalStateException(); } };
    String originalName = dbContext.getLobField();
    Map<String, Object> row =
        ImmutableMap.of(primaryKeyColumn, docid, originalName, clobContent);
View Full Code Here

    // ResultSet object as a Clob object in the Java programming language.
    @Override
    public Clob getClob(int columnIndex) throws SQLException {
        checkColumnBounds(columnIndex);
        try {
            return new SerialClob(table.getString(columnIndex - 1)
                    .toCharArray());
        } catch (Exception x) {
            throw SQLError.get(x);
        }
    }
View Full Code Here

                } else if (rsval instanceof SQLData) {
                    rsval = new SerialStruct((SQLData)rsval, map);
                } else if (rsval instanceof Blob) {
                    rsval = new SerialBlob((Blob)rsval);
                } else if (rsval instanceof Clob) {
                    rsval = new SerialClob((Clob)rsval);
                } else if (rsval instanceof java.sql.Array) {
                    rsval = new SerialArray((java.sql.Array)rsval, map);
                }

                // reset boolNull if it had been set
View Full Code Here

  // ********************************************************************************

  public Clob clob(String s) throws Exception
  {
    return new SerialClob(s.toCharArray());
  }
View Full Code Here

TOP

Related Classes of javax.sql.rowset.serial.SerialClob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.