Examples of LoopingAlphabetReader


Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

        name = new_name;
        l_name = new_lname;
        try {
          // to create a stream of random length between 200 bytes and 3MB
          int clobLength = Rn.nextInt(3078000 - 200 + 1) + 200;
          streamReader = new LoopingAlphabetReader(clobLength,
              CharAlphabet.modernLatinLowercase());
          insertFirst.setCharacterStream(4, streamReader, clobLength);
        } catch (Exception e) {
          MailJdbc.logAct.logMsg(LogFile.ERROR + thread_name + " : "
              + "File not found Exception : " + e.getMessage());
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

        int clobLength = 5009;

        // insert a streaming column
        PreparedStatement ps = prepareStatement(
                "insert into testClob (a) values(?)");
        Reader streamReader = new LoopingAlphabetReader(
                clobLength, CharAlphabet.tamil());
        ps.setCharacterStream(1, streamReader, clobLength);
        //DERBY-4312 make sure commit() doesn't interfere
        commit();
        ps.executeUpdate();
        streamReader.close();
        ps.close();
        commit();

        Statement stmt = createStatement();
        ResultSet rs = stmt.executeQuery("SELECT a FROM testClob");
        while (rs.next()) {
            Clob clob = rs.getClob(1);
            assertEquals("FAIL - wrong clob length", clobLength, clob.length());
            Reader clobValue = clob.getCharacterStream();
            Reader origValue = new LoopingAlphabetReader(
                    clobLength, CharAlphabet.tamil());

            assertTrue("New clob value did not match",
                    compareReaders(origValue, clobValue));
            origValue.close();
            clobValue.close();
        }
        rs.close();
        stmt.close();
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

                            unicodeStrings[arrayIndex],
                            new String(buff));
                    assertEquals("Expected end of stream",
                            -1, clobValue.read());
                } else {
                    Reader origValue = new LoopingAlphabetReader(
                            clobLength, CharAlphabet.tamil());
                    compareReaders(origValue, clobValue);
                }
            } else {
                assertTrue("Clob was null but length was not 0",
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

        getConnection().setAutoCommit(false);

        PreparedStatement ps = prepareStatement(
                "insert into testClob(b, a) values(?,?)");
        for (int i = 0; i < 3; i++) {
            Reader fis = new LoopingAlphabetReader(300000);
            ps.setInt(1, i);
            ps.setCharacterStream(2, fis, 300000);
            ps.executeUpdate();
            fis.close();
        }
        commit();

        getConnection().setAutoCommit(true);
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

            PreparedStatement ps,
            CharAlphabet alphabet,
            int lobLength)
        throws Exception
    {
        ps.setCharacterStream(1, new LoopingAlphabetReader(lobLength, alphabet),
                lobLength);
        ps.setInt(2, lobLength);
        ps.setLong(3, -1);
        ps.executeUpdate();
    }
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

     * @return A string.
     * @throws IOException if reading from the source stream fails
     */
    public static String getString(int length, CharAlphabet alphabet)
            throws IOException {
        LoopingAlphabetReader reader =
                new LoopingAlphabetReader(length, alphabet);
        char[] strChar = new char[length];
        int read = 0;
        while (read < length) {
            int readNow = reader.read(strChar, read, length - read);
            if (readNow < 1) {
                fail("Creating string failed, stream returned " + readNow);
            }
            read += readNow;
        }
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

        name = new_name;
        l_name = new_lname;
        try {
          // to create a stream of random length between 200 bytes and 3MB
          int clobLength = Rn.nextInt(3078000 - 200 + 1) + 200;
          streamReader = new LoopingAlphabetReader(clobLength,
              CharAlphabet.modernLatinLowercase());
          insertFirst.setCharacterStream(4, streamReader, clobLength);
        } catch (Exception e) {
          MailJdbc.logAct.logMsg(LogFile.ERROR + thread_name + " : "
              + "File not found Exception : " + e.getMessage());
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

        s.executeUpdate("CREATE TABLE CLOBTABLE (K INT CONSTRAINT PK PRIMARY KEY, C CLOB(" + LONG_CLOB_LENGTH + "))");

        PreparedStatement ps = prepareStatement("INSERT INTO CLOBTABLE VALUES(?,?)");
        // We allocate 16MB for the test so use something bigger than that.
        ps.setInt(1,1);
        LoopingAlphabetReader reader = new LoopingAlphabetReader(LONG_CLOB_LENGTH);
        if (lengthless) {
            Method m = null;
            try {
                Class c = ps.getClass();
                m = c.getMethod("setCharacterStream",new Class[] {Integer.TYPE,
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

        PreparedStatement ps = prepareStatement(
            "insert into BLOBCLOB(ID, CLOBDATA) values(?,?)");
        int id = BlobClobTestSetup.getID();
        ps.setInt(1, id);
        ps.setCharacterStream(2,
                new LoopingAlphabetReader(length, alphabet), length);
        ps.execute();
        ps.close();
        // Perform the actual test.
        getCharacterStreamLongLastChar(id, length, alphabet);
    }
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader

        PreparedStatement ps = prepareStatement(
            "insert into BLOBCLOB(ID, CLOBDATA) values(?,?)");
        int id = BlobClobTestSetup.getID();
        ps.setInt(1, id);
        ps.setCharacterStream(2,
                new LoopingAlphabetReader(length, alphabet), length);
        ps.execute();
        ps.close();
        // Perform the actual test.
        getCharacterStreamLongLastChar(id, length, alphabet);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.