Package oracle.sql

Examples of oracle.sql.CLOB


                            int bufSize = 1024;

                            index++;

                            if (type.equals("ascii")) {
                                CLOB ascii = set.getCLOB(index);

                                if (attr instanceof File) {
                                    File asciiFile = (File) attr;
                                    stream = new BufferedInputStream(new FileInputStream(asciiFile));
                                } else {
                                    String asciiText = (String) attr;
                                    stream = new BufferedInputStream(new ByteArrayInputStream(asciiText.getBytes()));
                                }

                                output = new BufferedOutputStream(ascii.getAsciiOutputStream());
                                bufSize = ascii.getBufferSize();
                            } else {
                                BLOB binary = set.getBLOB(index);
                                File binaryFile = (File) attr;
                                stream = new BufferedInputStream(new FileInputStream(binaryFile));
                                length = (int) binaryFile.length();
View Full Code Here


                            int bufSize = 1024;

                            index++;

                            if (type.equals("ascii")) {
                                CLOB ascii = set.getCLOB(index);

                                if (attr instanceof File) {
                                    File asciiFile = (File) attr;
                                    stream = new BufferedInputStream(new FileInputStream(asciiFile));
                                } else {
                                    String asciiText = (String) attr;
                                    stream = new BufferedInputStream(new ByteArrayInputStream(asciiText.getBytes()));
                                }

                                output = new BufferedOutputStream(ascii.getAsciiOutputStream());
                                bufSize = ascii.getBufferSize();
                            } else {
                                BLOB binary = set.getBLOB(index);
                                File binaryFile = (File) attr;
                                stream = new BufferedInputStream(new FileInputStream(binaryFile));
                                length = (int) binaryFile.length();
View Full Code Here

                            int bufSize = 1024;

                            index++;

                            if (type.equals("ascii")) {
                                CLOB ascii = set.getCLOB(index);

                                if (attr instanceof File) {
                                    File asciiFile = (File) attr;
                                    stream = new BufferedInputStream(new FileInputStream(asciiFile));
                                } else {
                                    String asciiText = (String) attr;
                                    stream = new BufferedInputStream(new ByteArrayInputStream(asciiText.getBytes()));
                                }

                                output = new BufferedOutputStream(ascii.getAsciiOutputStream());
                                bufSize = ascii.getBufferSize();
                            } else {
                                BLOB binary = set.getBLOB(index);
                                File binaryFile = (File) attr;
                                stream = new BufferedInputStream(new FileInputStream(binaryFile));
                                length = (int) binaryFile.length();
View Full Code Here

                            int bufSize = 1024;

                            index++;

                            if (type.equals("ascii")) {
                                CLOB ascii = set.getCLOB(index);

                                if (attr instanceof File) {
                                    File asciiFile = (File) attr;
                                    stream = new BufferedInputStream(new FileInputStream(asciiFile));
                                } else {
                                    String asciiText = (String) attr;
                                    stream = new BufferedInputStream(new ByteArrayInputStream(asciiText.getBytes()));
                                }

                                output = new BufferedOutputStream(ascii.getAsciiOutputStream());
                                bufSize = ascii.getBufferSize();
                            } else {
                                BLOB binary = set.getBLOB(index);
                                File binaryFile = (File) attr;
                                stream = new BufferedInputStream(new FileInputStream(binaryFile));
                                length = (int) binaryFile.length();
View Full Code Here

            int type = types[i];
            if(isNull(obj)) {
                pstmt.setNull(i + mediateLoc, types[i]);
            } else if(isClobType(type)) {
                String str = (String)obj;
                CLOB clob = CLOB.createTemporary(conn, true, CLOB.DURATION_CALL);
                pstmt.setClob(i + mediateLoc, clob);
                Writer writer = clob.getCharacterOutputStream();
                writer.write(str);
                writer.flush();
                writer.close();
            } else if(isBlobType(type)) {
                InputStream is = (InputStream)obj;
View Full Code Here

    private void writeLobType(Connection conn, OracleCallableStatement ostmt, Object[] params, int[] types) throws IOException, SQLException {

        for ( int i = 0; i < params.length; i++ ) {
            if (! isClobType(types[i])) continue ;
            CLOB clob = ostmt.getCLOB( i + 2 );
            Writer writer = ( ( CLOB )clob ).getCharacterOutputStream();
            writer.write( ( ( String )params[i]).toCharArray() );
            writer.flush();
            writer.close();
        }
View Full Code Here

            ps.setBlob(index, bl);
          }
          else
         
            CLOB cl = CLOB.createTemporary(conn, true, CLOB.DURATION_CALL);
            cl.putString(1,value);
            ps.setClob(index, cl);
          }
        }
        else if(value.indexOf("date:") > -1)
        {
View Full Code Here

        new OracleClobNormaliser().normalise("Any Old Object");
    }

    @Test
    public void shouldThrowCorrectExceptionIfClobIsLargerThanMaximum() throws SQLException {
        CLOB clob = mock(CLOB.class);
       
        when(clob.length()).thenReturn(10001l);
        expectedEx.expect(UnsupportedOperationException.class);
        expectedEx.expectMessage("Clobs larger than 10000 bytes are not supported by DBFIT");
       
        new OracleClobNormaliser().normalise(clob);
    }
View Full Code Here

        new OracleClobNormaliser().normalise(clob);
    }

    @Test
    public void shouldReturnContentsOfClobIFAllOkay() throws SQLException {
        CLOB clob = mock(CLOB.class);
       
        when(clob.length()).thenReturn(Long.valueOf("CLOB contents".length()));
        when(clob.getChars(eq(1l), eq(10000), any(char[].class))).thenReturn("CLOB contents".length());

        // can't do this as we don't fill up the passed buffer
        //assertEquals("CLOB contents", new OracleClobNormaliser().normalise(clob));
        new OracleClobNormaliser().normalise(clob);
    }
View Full Code Here

TOP

Related Classes of oracle.sql.CLOB

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.