Package org.hsqldb.lib

Examples of org.hsqldb.lib.CharArrayWriter


            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            java.io.Reader  reader = x.getCharacterStream();
            CharArrayWriter writer = new CharArrayWriter(reader, (int) length);

            setParameter(parameterIndex, writer.toString());
        } catch (IOException e) {
            throw Util.sqlException(ErrorCode.SERVER_TRANSFER_CORRUPTED,
                                    e.toString());
        }
    }
View Full Code Here


        checkSetParameterIndex(parameterIndex, true);

        if (parameterTypes[parameterIndex - 1].typeCode == Types.SQL_CLOB) {
            try {
                if (length < 0) {
                    CharArrayWriter output;

                    output = new CharArrayWriter(reader);

                    JDBCClob clob = new JDBCClob(output.toString());

                    setClobParameter(parameterIndex, clob);

                    return;
                }
            } catch (IOException e) {
                throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                        e.toString());
            }
            streamLengths[parameterIndex - 1] = length;

            setParameter(parameterIndex, reader);

            return;
        }

        try {
            if (length > Integer.MAX_VALUE) {
                String msg = "Maximum Clob input length exceeded: " + length;

                throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
            }

            CharArrayWriter writer;

            if (length < 0) {
                writer = new CharArrayWriter(reader);
            } else {
                writer = new CharArrayWriter(reader, (int) length);
            }
            setParameter(parameterIndex, writer.toString());
        } catch (IOException e) {
            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString());
        }
    }
View Full Code Here

            throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            java.io.Reader  reader = x.getCharacterStream();
            CharArrayWriter writer = new CharArrayWriter(reader, (int) length);

            setParameter(parameterIndex, writer.toString());
        } catch (Throwable e) {
            throw JDBCUtil.sqlException(ErrorCode.SERVER_TRANSFER_CORRUPTED,
                                    e.toString(), e);
        }
    }
View Full Code Here

            throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            CharArrayWriter writer;

            if (length < 0) {
                writer = new CharArrayWriter(reader);
            } else {
                writer = new CharArrayWriter(reader, (int) length);
            }
            setParameter(parameterIndex, writer.toString());
        } catch (Throwable e) {
            throw JDBCUtil.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString(), e);
        }
    }
View Full Code Here

            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            java.io.Reader  reader = x.getCharacterStream();
            CharArrayWriter writer = new CharArrayWriter(reader, (int) length);

            setParameter(parameterIndex, writer.toString());
        } catch (Throwable e) {
            throw Util.sqlException(ErrorCode.SERVER_TRANSFER_CORRUPTED,
                                    e.toString());
        }
    }
View Full Code Here

            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            CharArrayWriter writer;

            if (length < 0) {
                writer = new CharArrayWriter(reader);
            } else {
                writer = new CharArrayWriter(reader, (int) length);
            }
            setParameter(parameterIndex, writer.toString());
        } catch (Throwable e) {
            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString());
        }
    }
View Full Code Here

    private void allocateClobSegments(ResultLob result,
                                      Reader reader) throws IOException {

        long            currentOffset = result.getOffset();
        int             bufferLength  = session.getStreamBlockSize();
        CharArrayWriter charWriter    = new CharArrayWriter(bufferLength);

        while (true) {
            charWriter.reset();
            charWriter.write(reader, bufferLength);

            char[] charArray = charWriter.getBuffer();

            if (charWriter.size() < bufferLength) {
                charArray = charWriter.toCharArray();
            }

            Result actionResult =
                database.lobManager.setChars(result.getLobID(), currentOffset,
                                             charArray);

            currentOffset += charWriter.size();

            if (charWriter.size() < bufferLength) {
                return;
            }
        }
    }
View Full Code Here

    private void allocateClobSegments(long lobID, long offset,
                                      Reader reader) throws IOException {

        int             bufferLength  = session.getStreamBlockSize();
        CharArrayWriter charWriter    = new CharArrayWriter(bufferLength);
        long            currentOffset = offset;

        while (true) {
            charWriter.reset();
            charWriter.write(reader, bufferLength);

            char[] charArray = charWriter.getBuffer();

            if (charWriter.size() == 0) {
                return;
            }

            Result actionResult = database.lobManager.setChars(lobID,
                currentOffset, charArray, charWriter.size());

            currentOffset += charWriter.size();

            if (charWriter.size() < bufferLength) {
                return;
            }
        }
    }
View Full Code Here

            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
        }

        try {
            java.io.Reader  reader = x.getCharacterStream();
            CharArrayWriter writer = new CharArrayWriter(reader, (int) length);

            setParameter(parameterIndex, writer.toString());
        } catch (IOException e) {
            throw Util.sqlException(ErrorCode.SERVER_TRANSFER_CORRUPTED,
                                    e.toString());
        }
    }
View Full Code Here

                String msg = "Maximum Clob input length exceeded: " + length;

                throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR, msg);
            }

            CharArrayWriter writer = new CharArrayWriter(reader, (int) length);

            setParameter(parameterIndex, writer.toString());
        } catch (IOException e) {
            throw Util.sqlException(ErrorCode.JDBC_INPUTSTREAM_ERROR,
                                    e.toString());
        }
    }
View Full Code Here

TOP

Related Classes of org.hsqldb.lib.CharArrayWriter

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.