Examples of LoopingAlphabetStream


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

        stmt.close();

        PreparedStatement ps = prepareStatement("insert into " + TBL +
                " values (?)");
        int length = 65*1024*1024; // 65K
        ps.setBinaryStream(1, new LoopingAlphabetStream(length), length);
        ps.executeUpdate();
        ps.close();

        stmt = createStatement();
        ResultSet rs = stmt.executeQuery("select B from " + TBL);
View Full Code Here

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

    //load data in table1
    PreparedStatement ps = prepareStatement(
    "insert into table1 values (?, 0, ?)");
    ps.setInt(1, 1);
        ps.setBinaryStream(2, new LoopingAlphabetStream(lobsize), lobsize);
        ps.executeUpdate();

    //load data in table2
    ps = prepareStatement(
      "insert into table2 (id) values (?)");
View Full Code Here

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

    s.execute("create table table1 (id int, status smallint, bl blob(2G), bl_null blob(2G))");

    PreparedStatement ps = prepareStatement(
      "insert into table1 values (?, 0, ?, null)");
    ps.setInt(1, 1);
        ps.setBinaryStream(2, new LoopingAlphabetStream(lobsize), lobsize);
        ps.executeUpdate();

        s.execute("create trigger trigger1 after INSERT on table1 referencing " +
        "new as n_row for each row " +
        "update table1 set bl_null=n_row.bl where bl_null is null");
View Full Code Here

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

          "update table1 set bl_null=n_row.bl where bl_null is null");

    PreparedStatement ps = prepareStatement(
      "insert into table1 values (?, 0, ?, null)");
    ps.setInt(1, 1);
        ps.setBinaryStream(2, new LoopingAlphabetStream(lobsize), lobsize);
        ps.executeUpdate();
    commit();
       runtest1UpdateTrigger();
  }
View Full Code Here

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

    PreparedStatement ps = prepareStatement(
      "insert into table1 values (?, 0, ?, ?)");

    ps.setInt(1, 1);
        ps.setBinaryStream(2, new LoopingAlphabetStream(lobsize), lobsize);
        ps.setBinaryStream(3, new LoopingAlphabetStream(lobsize), lobsize);
        ps.executeUpdate();
    commit();
       runtest3UpdateTrigger();
  }
View Full Code Here

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

   * @throws SQLException
   */
  public void runtest2InsertTriggerTest() throws SQLException{
    PreparedStatement ps = prepareStatement(
        "insert into table1(id, status, bl) values(101, 0, ?)");
        ps.setBinaryStream(1, new LoopingAlphabetStream(lobsize), lobsize);
        ps.executeUpdate();
        commit();
  }
View Full Code Here

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

   * @throws SQLException
   */
  public void runtest2UpdateTrigger() throws SQLException{
    PreparedStatement ps = prepareStatement(
        "update table1 set bl = ? where id = 1");
        ps.setBinaryStream(1, new LoopingAlphabetStream(lobsize), lobsize);
        ps.executeUpdate();
        commit();
  }
View Full Code Here

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

                charIn = new LoopingAlphabetReader(post);
                total += transferData(charIn, TRANSFER_BUFFER_SIZE);
                break;
            } case SET_ASCII_STREAM: {
                OutputStream asciiOut = this.clob.setAsciiStream(1L);
                InputStream asciiIn = new LoopingAlphabetStream(pre);
                total += transferData(asciiIn, asciiOut, TRANSFER_BUFFER_SIZE);
                byte[] tokenBytes = token.getBytes("ISO-8859-1");
                asciiOut.write(tokenBytes, 0, tokenBytes.length);
                total += tokenBytes.length;
                asciiIn = new LoopingAlphabetStream(post);
                total += transferData(asciiIn, asciiOut, TRANSFER_BUFFER_SIZE);
                break;
            } case SET_CHARACTER_STREAM: {
                Writer charOut = this.clob.setCharacterStream(1L);
                Reader charIn = new LoopingAlphabetReader(pre);
View Full Code Here

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

        ps.setString(1, blobSize +"");

        // - set the value of the input parameter to the input stream
        // use a couple blobs so we are sure it works with multiple lobs
        ps.setBinaryStream(2,
                new LoopingAlphabetStream(blobSize, a1), blobSize);
        ps.setBinaryStream(3,
                new LoopingAlphabetStream(blobSize, a1), blobSize);
        ps.execute();
        closeStatement(ps);
       
        commit();
        // Now executing update to fire trigger
        s.executeUpdate("update LOB1 set str1 = str1 || ' '");
        s.executeUpdate("drop table lob1");
        s.executeUpdate("drop table t_lob1_log");
  
        // now referencing the lob column
        trig = " create trigger t_lob1 after update of b_lob on lob1 ";
        trig = trig + " REFERENCING OLD AS old NEW AS new FOR EACH ROW MODE DB2SQL ";
        trig = trig + " insert into t_lob1_log(oldvalue, newvalue) values (old.b_lob, new.b_lob)";

        s.executeUpdate("create table LOB1 (str1 Varchar(80), b_lob BLOB(50M))");
        s.executeUpdate("create table t_lob1_log(oldvalue BLOB(50M), newvalue  BLOB(50M), chng_time timestamp default current_timestamp)");
        s.executeUpdate(trig);
        commit();     

        ps = prepareStatement("INSERT INTO LOB1 VALUES (?, ?)");
       
        ps.setString(1, blobSize +"");


        // - set the value of the input parameter to the input stream
        ps.setBinaryStream(2,
                new LoopingAlphabetStream(blobSize, a1), blobSize);
        ps.execute();
        closeStatement(ps);
        commit();

        // Now executing update to fire trigger
        ps = prepareStatement("update LOB1 set b_lob = ?");
        ps.setBinaryStream(1,
                new LoopingAlphabetStream(blobSize, a2), blobSize);
        ps.execute();
        closeStatement(ps);
        commit();       

        s.executeUpdate("drop table lob1");
        s.executeUpdate("drop table t_lob1_log");
       
        //      now referencing the lob column twice
        trig = " create trigger t_lob1 after update of b_lob on lob1 ";
        trig = trig + " REFERENCING OLD AS old NEW AS new FOR EACH ROW MODE DB2SQL ";
        trig = trig + " insert into t_lob1_log(oldvalue, newvalue, oldvalue_again, newvalue_again) values (old.b_lob, new.b_lob, old.b_lob, new.b_lob)";

        s.executeUpdate("create table LOB1 (str1 Varchar(80), b_lob BLOB(50M))");
        s.executeUpdate("create table t_lob1_log(oldvalue BLOB(50M), newvalue  BLOB(50M), oldvalue_again BLOB(50M), newvalue_again BLOB(50M), chng_time timestamp default current_timestamp)");
        s.executeUpdate(trig);
        commit();     

        ps = prepareStatement("INSERT INTO LOB1 VALUES (?, ?)");
       
        ps.setString(1, blobSize +"");


        // - set the value of the input parameter to the input stream
        ps.setBinaryStream(2,
                new LoopingAlphabetStream(blobSize, a1), blobSize);
        ps.execute();
        closeStatement(ps);
        commit();

        // Now executing update to fire trigger
        ps = prepareStatement("update LOB1 set b_lob = ?");
        ps.setBinaryStream(1,
                new LoopingAlphabetStream(blobSize, a2), blobSize);
        ps.execute();
        closeStatement(ps);
        commit();
       
        // check log table.
        ResultSet rs = s.executeQuery("SELECT * from t_lob1_log");
        rs.next();

        assertEquals(new LoopingAlphabetStream(blobSize, a1),
                     rs.getBinaryStream(1));

        assertEquals(new LoopingAlphabetStream(blobSize, a2),
                     rs.getBinaryStream(2));

        assertEquals(new LoopingAlphabetStream(blobSize, a1),
                     rs.getBinaryStream(3));

        assertEquals(new LoopingAlphabetStream(blobSize, a2),
                     rs.getBinaryStream(4));
       
        rs.close();

        s.executeUpdate("drop table lob1");
View Full Code Here

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

        case PH_CREATE: // create with old version
        s.execute("create table table1LOBtest (id int, status smallint, bl blob(2G))");
        PreparedStatement ps = prepareStatement(
        "insert into table1LOBtest values (?, 0, ?)");
        ps.setInt(1, 1);
            ps.setBinaryStream(2, new LoopingAlphabetStream(lobsize), lobsize);
            ps.executeUpdate();
           
        s.execute("create table table2LOBtest (id int, updates int default 0)");
        ps = prepareStatement(
            "insert into table2LOBtest (id) values (?)");
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.