⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jdbcresultset.java

📁 非常棒的java数据库
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     */
    public Ref getRef(int columnIndex) throws SQLException {
        try {
            debugCodeCall("getRef", columnIndex);
            throw Message.getUnsupportedException();
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * [Not supported] Gets a column as a reference.
     */
    public Ref getRef(String columnName) throws SQLException {
        try {
            debugCodeCall("getRef", columnName);
            throw Message.getUnsupportedException();
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a java.sql.Date using a
     * specified timezone.
     * 
     * @param columnIndex (1,2,...)
     * @param calendar the calendar
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Date getDate(int columnIndex, Calendar calendar) throws SQLException {
        try {
            if (debug()) {
                debugCode("getDate(" + columnIndex + ", calendar)");
            }
            Date x = get(columnIndex).getDate();
            return DateTimeUtils.convertDateToCalendar(x, calendar);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a java.sql.Date using a
     * specified timezone.
     * 
     * @param columnName the name of the column label
     * @param calendar the calendar
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Date getDate(String columnName, Calendar calendar) throws SQLException {
        try {
            if (debug()) {
                debugCode("getDate(" + StringUtils.quoteJavaString(columnName) + ", calendar)");
            }
            Date x = get(columnName).getDate();
            return DateTimeUtils.convertDateToCalendar(x, calendar);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a java.sql.Time using a
     * specified timezone.
     * 
     * @param columnIndex (1,2,...)
     * @param calendar the calendar
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Time getTime(int columnIndex, Calendar calendar) throws SQLException {
        try {
            if (debug()) {
                debugCode("getTime(" + columnIndex + ", calendar)");
            }
            Time x = get(columnIndex).getTime();
            return DateTimeUtils.convertTimeToCalendar(x, calendar);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a java.sql.Time using a
     * specified timezone.
     * 
     * @param columnName the name of the column label
     * @param calendar the calendar
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Time getTime(String columnName, Calendar calendar) throws SQLException {
        try {
            if (debug()) {
                debugCode("getTime(" + StringUtils.quoteJavaString(columnName) + ", calendar)");
            }
            Time x = get(columnName).getTime();
            return DateTimeUtils.convertTimeToCalendar(x, calendar);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a java.sql.Timestamp using a
     * specified timezone.
     * 
     * @param columnIndex (1,2,...)
     * @param calendar the calendar
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Timestamp getTimestamp(int columnIndex, Calendar calendar) throws SQLException {
        try {
            if (debug()) {
                debugCode("getTimestamp(" + columnIndex + ", calendar)");
            }
            Timestamp x = get(columnIndex).getTimestamp();
            return DateTimeUtils.convertTimestampToCalendar(x, calendar);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a java.sql.Timestamp.
     * 
     * @param columnName the name of the column label
     * @param calendar the calendar
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Timestamp getTimestamp(String columnName, Calendar calendar) throws SQLException {
        try {
            if (debug()) {
                debugCode("getTimestamp(" + StringUtils.quoteJavaString(columnName) + ", calendar)");
            }
            Timestamp x = get(columnName).getTimestamp();
            return DateTimeUtils.convertTimestampToCalendar(x, calendar);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a Blob.
     * 
     * @param columnIndex (1,2,...)
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Blob getBlob(int columnIndex) throws SQLException {
        try {
            int id = getNextId(TraceObject.BLOB);
            debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob(" + columnIndex + ")");
            Value v = get(columnIndex);
            return v == ValueNull.INSTANCE ? null : new JdbcBlob(session, conn, v, id);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a Blob.
     * 
     * @param columnName the name of the column label
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Blob getBlob(String columnName) throws SQLException {
        try {
            int id = getNextId(TraceObject.BLOB);
            debugCodeAssign("Blob", TraceObject.BLOB, id, "getBlob(" + quote(columnName) + ")");
            Value v = get(columnName);
            return v == ValueNull.INSTANCE ? null : new JdbcBlob(session, conn, v, id);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a byte array.
     * 
     * @param columnIndex (1,2,...)
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public byte[] getBytes(int columnIndex) throws SQLException {
        try {
            debugCodeCall("getBytes", columnIndex);
            return get(columnIndex).getBytes();
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a byte array.
     * 
     * @param columnName the name of the column label
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public byte[] getBytes(String columnName) throws SQLException {
        try {
            debugCodeCall("getBytes", columnName);
            return get(columnName).getBytes();
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as input stream.
     * 
     * @param columnIndex (1,2,...)
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public InputStream getBinaryStream(int columnIndex) throws SQLException {
        try {
            debugCodeCall("getBinaryStream", columnIndex);
            return get(columnIndex).getInputStream();
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as input stream.
     * 
     * @param columnName the name of the column label
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public InputStream getBinaryStream(String columnName) throws SQLException {
        try {
            debugCodeCall("getBinaryStream", columnName);
            return get(columnName).getInputStream();
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }


    /**
     * Returns the value of the specified column as a Clob.
     * 
     * @param columnIndex (1,2,...)
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Clob getClob(int columnIndex) throws SQLException {
        try {
            int id = getNextId(TraceObject.CLOB);
            debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob(" + columnIndex + ")");
            Value v = get(columnIndex);
            return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as a Clob.
     * 
     * @param columnName the name of the column label
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Clob getClob(String columnName) throws SQLException {
        try {
            int id = getNextId(TraceObject.CLOB);
            debugCodeAssign("Clob", TraceObject.CLOB, id, "getClob(" + quote(columnName) + ")");
            Value v = get(columnName);
            return v == ValueNull.INSTANCE ? null : new JdbcClob(session, conn, v, id);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as an Array.
     * 
     * @param columnIndex (1,2,...)
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Array getArray(int columnIndex) throws SQLException {
        try {
            int id = getNextId(TraceObject.ARRAY);
            debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray(" + columnIndex + ")");
            Value v = get(columnIndex);
            return v == ValueNull.INSTANCE ? null : new JdbcArray(session, conn, v, id);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as an Array.
     * 
     * @param columnName the name of the column label
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Array getArray(String columnName) throws SQLException {
        try {
            int id = getNextId(TraceObject.ARRAY);
            debugCodeAssign("Clob", TraceObject.ARRAY, id, "getArray(" + quote(columnName) + ")");
            Value v = get(columnName);
            return v == ValueNull.INSTANCE ? null : new JdbcArray(session, conn, v, id);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as input stream.
     * 
     * @param columnIndex (1,2,...)
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public InputStream getAsciiStream(int columnIndex) throws SQLException {
        try {
            debugCodeCall("getAsciiStream", columnIndex);
            String s = get(columnIndex).getString();
            // TODO ascii stream: convert the reader to a ascii stream
            return s == null ? null : IOUtils.getInputStream(s);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as input stream.
     * 
     * @param columnName the name of the column label
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public InputStream getAsciiStream(String columnName) throws SQLException {
        try {
            debugCodeCall("getAsciiStream", columnName);
            String s = get(columnName).getString();
            // TODO ascii stream: convert the reader to a ascii stream
            return IOUtils.getInputStream(s);
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as input stream.
     * 
     * @param columnIndex (1,2,...)
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed
     */
    public Reader getCharacterStream(int columnIndex) throws SQLException {
        try {
            debugCodeCall("getCharacterStream", columnIndex);
            return get(columnIndex).getReader();
        } catch (Throwable e) {
            throw logAndConvert(e);
        }
    }

    /**
     * Returns the value of the specified column as input stream.
     * 
     * @param columnName the name of the column label
     * @return the value
     * @throws SQLException if the column is not found or if the result set is
     *             closed

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -