poolmanresultset.java

来自「Java Database connection pool」· Java 代码 · 共 1,658 行 · 第 1/4 页

JAVA
1,658
字号
        } catch (NullPointerException ne) {        }        return false;    }    public boolean getBoolean(String colName) throws SQLException {        try {            Boolean b = (Boolean) getObject(colName);            return b.booleanValue();        } catch (NullPointerException ne) {        }        return false;    }    public byte getByte(int colIndex) throws SQLException {        try {            Byte b = (Byte) getObject(colIndex);            return b.byteValue();        } catch (NullPointerException ne) {        }        return 0;    }    public byte getByte(String colName) throws SQLException {        try {            Byte b = (Byte) getObject(colName);            return b.byteValue();        } catch (NullPointerException ne) {        }        return 0;    }    public byte[] getBytes(int colIndex) throws SQLException {        try {            try {                return ((byte[]) getObject(colIndex));            } catch (java.lang.ClassCastException cce) {                return ((String) getObject(colIndex)).getBytes();            }        } catch (NullPointerException ne) {        }        return new byte[]{-1};    }    public byte[] getBytes(String colName) throws SQLException {        try {            try {                return ((byte[]) getObject(colName));            } catch (java.lang.ClassCastException cce) {                return ((String) getObject(colName)).getBytes();            }        } catch (NullPointerException ne) {        }        return new byte[]{-1};    }    public Reader getCharacterStream(int colIndex) throws SQLException {        try {            return (Reader) getObject(colIndex);        } catch (NullPointerException ne) {        }        return null;    }    public Reader getCharacterStream(String colName) throws SQLException {        try {            return (Reader) getObject(colName);        } catch (NullPointerException ne) {        }        return null;    }    public Clob getClob(int colIndex) throws SQLException {        try {            return (Clob) getObject(colIndex);        } catch (NullPointerException ne) {        }        return null;    }    public Clob getClob(String colName) throws SQLException {        try {            return (Clob) getObject(colName);        } catch (NullPointerException ne) {        }        return null;    }    public int getConcurrency() throws SQLException {        return this.concurType;    }    /**     * This implementation does not support named cursors.     * ResultSets can be easily updated without them now,     * so they are not necessary.     */    public String getCursorName() throws SQLException {        throw new UnsupportedOperationException("The PoolMan Library Does Not Support Named Cursors");    }    /* CHECK TYPE CONVERSION */    public java.sql.Date getDate(int colIndex) throws SQLException {        try {            if (getObject(colIndex) instanceof java.sql.Timestamp) {                java.sql.Timestamp timestamp = (java.sql.Timestamp) getObject(colIndex);                return new java.sql.Date(timestamp.getTime() + timestamp.getNanos() / 1000000);            }            else {                return (java.sql.Date) getObject(colIndex);            }        } catch (NullPointerException ne) {        }        return null;    }    /* CHECK TYPE CONVERSION */    public java.sql.Date getDate(int colIndex, Calendar cal) throws SQLException {        try {            java.sql.Date d = getDate(colIndex);            DateFormat df = DateFormat.getInstance();            df.setCalendar(cal);            java.util.Date newDate = df.parse(d.toString());            return new java.sql.Date(newDate.getTime());        } catch (NullPointerException ne) {        } catch (java.text.ParseException pe) {            pe.printStackTrace();        }        return null;    }    public java.sql.Date getDate(String colName) throws SQLException {        try {            if (getObject(colName) instanceof java.sql.Timestamp) {                java.sql.Timestamp timestamp = (java.sql.Timestamp) getObject(colName);                return new java.sql.Date(timestamp.getTime() + timestamp.getNanos() / 1000000);            }            else {                return (java.sql.Date) getObject(colName);            }        } catch (NullPointerException ne) {        }        return null;    }    public java.sql.Date getDate(String colName, Calendar cal) throws SQLException {        try {            java.sql.Date d = getDate(colName);            DateFormat df = DateFormat.getInstance();            df.setCalendar(cal);            java.util.Date newDate = df.parse(d.toString());            return new java.sql.Date(newDate.getTime());        } catch (NullPointerException ne) {        } catch (java.text.ParseException pe) {            pe.printStackTrace();        }        return null;    }    public double getDouble(int colIndex) throws SQLException {        try {            Number i = (Number) getObject(colIndex);            return i.doubleValue();        } catch (NullPointerException ne) {        }        return 0;    }    public double getDouble(String colName) throws SQLException {        try {            Number i = (Number) getObject(colName);            return i.doubleValue();        } catch (NullPointerException ne) {        }        return 0;    }    public int getFetchDirection() throws SQLException {        return this.fetchDirection;    }    public int getFetchSize() throws SQLException {        return this.fetchSize;    }    public float getFloat(int colIndex) throws SQLException {        try {            Number i = (Number) getObject(colIndex);            return i.floatValue();        } catch (NullPointerException ne) {        }        return 0;    }    public float getFloat(String colName) throws SQLException {        try {            Number i = (Number) getObject(colName);            return i.floatValue();        } catch (NullPointerException ne) {        }        return 0;    }    public int getInt(int colIndex) throws SQLException {        try {            Number i = (Number) getObject(colIndex);            return i.intValue();        } catch (NullPointerException ne) {        }        return 0;    }    public int getInt(String colName) throws SQLException {        try {            Number i = (Number) getObject(colName);            return i.intValue();        } catch (NullPointerException ne) {        }        return 0;    }    public long getLong(int colIndex) throws SQLException {        try {            Number i = (Number) getObject(colIndex);            return i.longValue();        } catch (NullPointerException ne) {        }        return 0;    }    public long getLong(String colName) throws SQLException {        try {            Number i = (Number) getObject(colName);            return i.longValue();        } catch (NullPointerException ne) {        }        return 0;    }    public ResultSetMetaData getMetaData() throws SQLException {        return PoolManResultSetMetaData.getCopy(this.metaData);    }    public Object getObject(int colIndex) throws SQLException {        lastColIndex = colIndex;        ArrayList row = (ArrayList) rowlist.get(pos - 1);        try {            Result result = (Result) row.get(colIndex - 1);            return result.colValue;        } catch (NullPointerException ne) {        }        return null;    }    /** Custom UDT mapping is not supported, default Map is always used. */    public Object getObject(int i, Map map) throws SQLException {        throw new UnsupportedOperationException("PoolMan does not support custom UDT mapping");    }    public Object getObject(String colName) throws SQLException {        ArrayList row = (ArrayList) rowlist.get(pos - 1);        try {            for (int n = 0; n < row.size(); n++) {                Result result = (Result) row.get(n);                if (result.colName.equalsIgnoreCase(colName)) {                    lastColIndex = n + 1;                    return result.colValue;                }            }        } catch (NullPointerException ne) {        }        return null;    }    /** Custom UDT mapping is not supported. */    public Object getObject(String colName, Map map) throws SQLException {        return getObject(colName);    }    public Ref getRef(int i) throws SQLException {        try {            return (Ref) getObject(i);        } catch (NullPointerException ne) {        }        return null;    }    public Ref getRef(String colName) throws SQLException {        try {            return (Ref) getObject(colName);        } catch (NullPointerException ne) {        }        return null;    }    public int getRow() throws SQLException {        if (this.pos > rowlist.size())            return 0;        return this.pos;    }    public short getShort(int colIndex) throws SQLException {        try {            Number i = (Number) getObject(colIndex);            return i.shortValue();        } catch (NullPointerException ne) {        }        return 0;    }    public short getShort(String colName) throws SQLException {        try {            Number i = (Number) getObject(colName);            return i.shortValue();        } catch (NullPointerException ne) {        }        return 0;    }    public Statement getStatement() throws SQLException {        return this.statement;    }    public String getString(int colIndex) throws SQLException {        try {            return getObject(colIndex).toString();        } catch (NullPointerException ne) {        }        return null;    }    public String getString(String colName) throws SQLException {        try {            return getObject(colName).toString();        } catch (NullPointerException ne) {        }        return null;    }    public Time getTime(int colIndex) throws SQLException {        try {            return (Time) getObject(colIndex);        } catch (NullPointerException ne) {        }        return null;    }    public java.sql.Time getTime(int colIndex, Calendar cal) throws SQLException {        try {            java.sql.Time t = (java.sql.Time) getObject(colIndex);            DateFormat df = DateFormat.getInstance();            df.setCalendar(cal);            java.util.Date newDate = df.parse(t.toString());            return new java.sql.Time(newDate.getTime());        } catch (NullPointerException ne) {        } catch (java.text.ParseException pe) {            pe.printStackTrace();        }        return null;    }    public Time getTime(String colName) throws SQLException {        try {            return (Time) getObject(colName);        } catch (NullPointerException ne) {        }        return null;    }    public Time getTime(String colName, Calendar cal) throws SQLException {        try {            java.sql.Time t = (java.sql.Time) getObject(colName);            DateFormat df = DateFormat.getInstance();            df.setCalendar(cal);            java.util.Date newDate = df.parse(t.toString());            return new java.sql.Time(newDate.getTime());        } catch (NullPointerException ne) {        } catch (java.text.ParseException pe) {            pe.printStackTrace();        }        return null;    }    public Timestamp getTimestamp(int colIndex) throws SQLException {        try {            return (Timestamp) getObject(colIndex);        } catch (NullPointerException ne) {        }        return null;    }    public Timestamp getTimestamp(int colIndex, Calendar cal) throws SQLException {        try {            java.sql.Timestamp t = (java.sql.Timestamp) getObject(colIndex);            DateFormat df = DateFormat.getInstance();            df.setCalendar(cal);            java.util.Date newDate = df.parse(t.toString());            return (Timestamp) getObject(colIndex);        } catch (NullPointerException ne) {        } catch (java.text.ParseException pe) {            pe.printStackTrace();        }        return null;    }    public Timestamp getTimestamp(String colName) throws SQLException {        try {            return (Timestamp) getObject(colName);        } catch (NullPointerException ne) {        }        return null;    }    public Timestamp getTimestamp(String colName, Calendar cal) throws SQLException {        try {

⌨️ 快捷键说明

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