Package java.sql

Examples of java.sql.Blob.free()


      Blob blob = rs.getBlob("content");
      int length = (int) blob.length();
      InputStream in = blob.getBinaryStream();
      ba = blob.getBytes(1, length);
      in.close();
      blob.free();
    }
    rs.close();
    s.close();
    return ba;
  }
View Full Code Here


    ResultSet rs = stmt.executeQuery("SELECT data FROM blobtest");
    assertTrue(rs.next());

    Blob blob = rs.getBlob(1);
    blob.free();
    try {
      blob.length();
      fail("Should have thrown an Exception because it was freed.");
    }
    catch (SQLException sqle) {
View Full Code Here

        while (rs.next())
        {
            Blob blob = rs.getBlob(3);
            verifyBlob(blob.getBinaryStream(), rs.getInt(2), rs.getInt(1));
            if (freelob)
                blob.free();
            if (commitAfterLobVerify)
                commit();
        }
        rs.close();
        rollback();
View Full Code Here

                            in.close();
                        }
                    }
                }
            } finally {
                blob.free();
            }
        }
    }

    /**
 
View Full Code Here

      final Throwable throwable) throws SQLException {
    byte[] content = CONTENT.getBytes(Charsets.UTF_8);
    Blob blob = createMock(Blob.class);
    expect(blob.length()).andReturn(CONTENT_LENGTH).anyTimes();
    expect(blob.getBytes(anyInt(), anyInt())).andReturn(content).anyTimes();
    blob.free();
    expectLastCall().andThrow(throwable).atLeastOnce();
    replay(blob);

    ResultSet rs = createMock(ResultSet.class);
    expect(rs.getBlob(anyInt())).andReturn(blob).anyTimes();
View Full Code Here

            while (rs.next()) {
                Blob readBlob = rs.getBlob(2);
                readBlob.length();
                readBlob.getBinaryStream(1, 10).close();
                readBlob.getBinaryStream().close();
                readBlob.free();
            }
            JdbcUtils.close(rs);

            rs = stmt.executeQuery("SELECT ID, DATA FROM T_BLOB");
            while (rs.next()) {
View Full Code Here

            while (rs.next()) {
                Blob readBlob = rs.getBlob(2);
                readBlob.length();
                readBlob.getBinaryStream(1, 100).close();
                readBlob.getBinaryStream().close();
                readBlob.free();
                try {
                    rs.getUnicodeStream(1).close();
                } catch (SQLFeatureNotSupportedException ex) {
                }
                try {
View Full Code Here

                        } catch (Throwable ignore){
                            // ignore stream.close errors
                        }
                    }
                    try {
                        b.free();
                    } catch (Throwable ignore){
                        // ignore blob.free errors
                    }
                }
            } catch (SQLException e) {
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.