📄 picoresultset.java
字号:
{ j = getColAttribute(i, OdbcDef.SQL_COLUMN_LENGTH); if(i > 0 && i <= numberOfCols) boundCols[i - 1].setLength(j); } return j; } public int getColumnType(int i) throws SQLException { int j = 9999; if(i > 0 && i <= numberOfCols) j = boundCols[i - 1].getType(); if(j == 9999) { j = getColAttribute(i, OdbcDef.SQL_COLUMN_TYPE); if(i > 0 && i <= numberOfCols) boundCols[i - 1].setType(j); } return j; } public int getConcurrency() { throw new UnsupportedOperationException(); } public String getCursorName() throws SQLException { String s = ""; clearWarnings(); try { s = odbcApi.SQLGetCursorName(getHSTMT()); } catch(PicoSQLWarning jdbcodbcsqlwarning) { s = (String)jdbcodbcsqlwarning.value; setWarning(PicoDbApi.convertWarning(jdbcodbcsqlwarning)); } return s.trim(); } public Double getDataDouble(int i) throws SQLException { lastColumnNull = false; Double double1; try { // double1 = odbcApi.SQLGetDataDouble(getHSTMT(), i); double1 = (Double) getData(i, Double.class); } catch(PicoSQLWarning jdbcodbcsqlwarning) { double1 = (Double)jdbcodbcsqlwarning.value; setWarning(PicoDbApi.convertWarning(jdbcodbcsqlwarning)); } if(double1 == null) lastColumnNull = true; return double1; } public Float getDataFloat(int i) throws SQLException { lastColumnNull = false; Float float1; try { // float1 = odbcApi.SQLGetDataFloat(getHSTMT(), i); float1 = (Float) getData(i, Float.class); } catch(PicoSQLWarning jdbcodbcsqlwarning) { float1 = (Float)jdbcodbcsqlwarning.value; setWarning(PicoDbApi.convertWarning(jdbcodbcsqlwarning)); } if(float1 == null) lastColumnNull = true; return float1; } public Integer getDataInteger(int i) throws SQLException { lastColumnNull = false; Integer integer; try { // integer = odbcApi.SQLGetDataInteger(getHSTMT(), i); integer = (Integer) getData(i, Integer.class); } catch(PicoSQLWarning jdbcodbcsqlwarning) { integer = (Integer)jdbcodbcsqlwarning.value; setWarning(PicoDbApi.convertWarning(jdbcodbcsqlwarning)); } if(integer == null) lastColumnNull = true; else if(i == sqlTypeColumn) integer = new Integer(OdbcDef.odbcTypeToJdbc(integer.intValue())); return integer; } public Long getDataLong(int i) throws SQLException { Long long1 = null; Double double1 = getDataDouble(i); if(double1 != null) long1 = new Long(double1.longValue()); return long1; } public String getDataString(int i, int j, boolean flag) throws SQLException { lastColumnNull = false; String s; try { // s = odbcApi.SQLGetDataString(getHSTMT(), i, j, flag); s = (String) getData(i, String.class); } catch(PicoSQLWarning jdbcodbcsqlwarning) { s = (String)jdbcodbcsqlwarning.value; setWarning(PicoDbApi.convertWarning(jdbcodbcsqlwarning)); } if(s == null) lastColumnNull = true; else if(i == sqlTypeColumn) try { int k = OdbcDef.odbcTypeToJdbc(Integer.valueOf(s).intValue()); s = String.valueOf(k); } catch(Exception _ex) { } return s; } public java.sql.Date getDate(int i) throws SQLException { return new java.sql.Date (getTimestamp(i).getTime()); } public java.sql.Date getDate(int i, Calendar calendar) throws SQLException { return new java.sql.Date (getTimestamp(i, calendar).getTime()); } public java.sql.Date getDate(String s) throws SQLException { return getDate(findColumn(s)); } public java.sql.Date getDate(String s, Calendar calendar) throws SQLException { return getDate(findColumn(s), calendar); } public double getDouble(int i) throws SQLException { double d = 0.0D; clearWarnings(); lastColumnNull = false; i = mapColumn(i); if(getPseudoCol(i) == null) { Double double1 = getDataDouble(i); if(double1 != null) d = double1.doubleValue(); } else { lastColumnNull = true; } return d; } public double getDouble(String s) throws SQLException { return getDouble(findColumn(s)); } public int getFetchDirection() { throw new UnsupportedOperationException(); } public int getFetchSize() { throw new UnsupportedOperationException(); } public float getFloat(int i) throws SQLException { float f = 0.0F; clearWarnings(); lastColumnNull = false; i = mapColumn(i); if(getPseudoCol(i) == null) { Float float1 = getDataFloat(i); if(float1 != null) f = float1.floatValue(); } else { lastColumnNull = true; } return f; } public float getFloat(String s) throws SQLException { return getFloat(findColumn(s)); } public int getInt(int i) throws SQLException { int j = 0; clearWarnings(); lastColumnNull = false; i = mapColumn(i); if(getPseudoCol(i) == null) { Integer integer = getDataInteger(i); if(integer != null) j = integer.intValue(); } else { lastColumnNull = true; } return j; } public int getInt(String s) throws SQLException { return getInt(findColumn(s)); } public long getLong(int i) throws SQLException { long l = 0L; clearWarnings(); lastColumnNull = false; i = mapColumn(i); if(getPseudoCol(i) == null) { Double double1 = getDataDouble(i); if(double1 != null) l = double1.longValue(); } else { lastColumnNull = true; } return l; } public long getLong(String s) throws SQLException { return getLong(findColumn(s)); } protected int getMaxBinaryLen(int i) throws SQLException { int j = getColumnLength(i); if(j != -1 && (j <= 0 || j > PicoLimits.MAX_GET_DATA_LENGTH)) j = PicoLimits.MAX_GET_DATA_LENGTH; return j; } protected int getMaxCharLen(int i) throws SQLException { int j = getColumnType(i); int k = getColumnLength(i); if(k != -1) { switch(j) { case -4: case -3: case -2: k *= 2; break; case 91: // '[' k = 10; break; case 92: // '\\' k = 8; break; case 93: // ']' k = 29; break; case 2: // '\002' case 3: // '\003' k += 2; break; case -7: k = 1; break; case -6: k = 4; break; case 5: // '\005' k = 6; break; case 4: // '\004' k = 11; break; case -5: k = 20; break; case 7: // '\007' k = 13; break; case 6: // '\006' case 8: // '\b' k = 22; break; } if(k <= 0 || k > PicoLimits.MAX_GET_DATA_LENGTH) k = PicoLimits.MAX_GET_DATA_LENGTH; } return k; } public ResultSetMetaData getMetaData() throws SQLException { if(DriverManager.getLogWriter() != null) DriverManager.println("*ResultSet.getMetaData"); if(closed) throw new SQLException("ResultSet is closed"); else return new PicoResultSetMetaData(odbcApi, this); } public Object getObject(int i) throws SQLException { Object obj = null; int j = getColumnType(i); int k = i; clearWarnings(); lastColumnNull = false; i = mapColumn(i); if(getPseudoCol(i) != null) { lastColumnNull = true; return null; } switch(j) { case -1: case 1: // '\001' case 12: // '\f' obj = getString(i); break; case 2: // '\002' case 3: // '\003' obj = getBigDecimal(i, getScale(k)); break; case -7: obj = new Boolean(getBoolean(i)); break; case -6: case 4: // '\004' case 5: // '\005' obj = new Integer(getInt(i)); break; case -5: obj = new Long(getLong(i)); break; case 7: // '\007' obj = new Float(getFloat(i)); break; case 6: // '\006' case 8: // '\b' obj = new Double(getDouble(i)); break; case -4: case -3: case -2: obj = getBytes(i); break; case 91: // '[' obj = getDate(i); break; case 92: // '\\' obj = getTime(i); break; case 93: // ']' obj = getTimestamp(i); break; } if(wasNull()) obj = null; return obj; } public Object getObject(int i, Map map) { throw new UnsupportedOperationException(); } public Object getObject(String s) throws SQLException { return getObject(findColumn(s)); } public Object getObject(String s, Map map) { throw new UnsupportedOperationException(); } public PicoPseudoCol getPseudoCol(int i) { PicoPseudoCol jdbcodbcpseudocol = null; if(i > 0 && i >= firstPseudoCol && i <= lastPseudoCol) jdbcodbcpseudocol = pseudoCols[i - firstPseudoCol]; return jdbcodbcpseudocol; } public Ref getRef(int i) { throw new UnsupportedOperationException(); } public Ref getRef(String s) { throw new UnsupportedOperationException(); } public void updateRef(int columnIndex, Ref x) { throw new UnsupportedOperationException(); } public void updateRef(String columnName, Ref x) { throw new UnsupportedOperationException(); } public int getRow() { throw new UnsupportedOperationException(); } public int getRowCount() throws SQLException { int i = 0; clearWarnings(); try { i = odbcApi.SQLRowCount(getHSTMT()); } catch(PicoSQLWarning jdbcodbcsqlwarning) { BigDecimal bigdecimal = (BigDecimal)jdbcodbcsqlwarning.value; i = bigdecimal.intValue(); setWarning(PicoDbApi.convertWarning(jdbcodbcsqlwarning)); } return i; } public int getRowNumber() throws SQLException { int i = 0; clearWarnings(); try { i = odbcApi.SQLGetStmtOption(getHSTMT(), (short)14); } catch(PicoSQLWarning jdbcodbcsqlwarning) { BigDecimal bigdecimal = (BigDecimal)jdbcodbcsqlwarning.value; i = bigdecimal.intValue();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -