📄 csvresultset.java
字号:
* @param columnName the name of the column
* @return the column index of the given column name
* @exception SQLException if the <code>ResultSet</code> object does
* not contain <code>columnName</code> or a database access error occurs
*/
public int findColumn(String columnName) throws SQLException {
throw new UnsupportedOperationException(
"ResultSet.findColumn(String) unsupported");
}
//--------------------------JDBC 2.0-----------------------------------
//---------------------------------------------------------------------
// Getters and Setters
//---------------------------------------------------------------------
/**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a
* <code>java.io.Reader</code> object.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return a <code>java.io.Reader</code> object that contains the column
* value; if the value is SQL <code>NULL</code>, the value returned is
* <code>null</code> in the Java programming language.
* @exception SQLException if a database access error occurs
*/
public Reader getCharacterStream(int columnIndex) throws SQLException {
String str = getString(columnIndex);
return (str == null) ? null : new StringReader(str);
}
/**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a
* <code>java.io.Reader</code> object.
*
* @param columnName the name of the column
* @return a <code>java.io.Reader</code> object that contains the column
* value; if the value is SQL <code>NULL</code>, the value returned is
* <code>null</code> in the Java programming language
* @exception SQLException if a database access error occurs
*/
public Reader getCharacterStream(String columnName) throws SQLException {
String str = getString(columnName);
return (str == null) ? null : new StringReader(str);
}
/**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a
* <code>java.math.BigDecimal</code> with full precision.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @return the column value (full precision);
* if the value is SQL <code>NULL</code>, the value returned is
* <code>null</code> in the Java programming language.
* @exception SQLException if a database access error occurs
*/
public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
BigDecimal retval = null;
String str = getString(columnIndex);
if(str != null) {
try {
retval = new BigDecimal(str);
}
catch (NumberFormatException e) {
throw new SQLException("Could not convert '" + str + "' to " +
"a java.math.BigDecimal object");
}
}
return retval;
}
/**
* Retrieves the value of the designated column in the current row
* of this <code>ResultSet</code> object as a
* <code>java.math.BigDecimal</code> with full precision.
*
* @param columnName the column name
* @return the column value (full precision);
* if the value is SQL <code>NULL</code>, the value returned is
* <code>null</code> in the Java programming language.
* @exception SQLException if a database access error occurs
*/
public BigDecimal getBigDecimal(String columnName) throws SQLException {
BigDecimal retval = null;
String str = getString(columnName);
if(str != null) {
try {
retval = new BigDecimal(str);
}
catch (NumberFormatException e) {
throw new SQLException("Could not convert '" + str + "' to " +
"a java.math.BigDecimal object");
}
}
return retval;
}
//---------------------------------------------------------------------
// Traversal/Positioning
//---------------------------------------------------------------------
/**
* Retrieves whether the cursor is before the first row in
* this <code>ResultSet</code> object.
*
* @return <code>true</code> if the cursor is before the first row;
* <code>false</code> if the cursor is at any other position or the
* result set contains no rows
* @exception SQLException if a database access error occurs
*/
public boolean isBeforeFirst() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.isBeforeFirst();
} else {
throw new UnsupportedOperationException(
"ResultSet.isBeforeFirst() unsupported");
}
}
/**
* Retrieves whether the cursor is after the last row in
* this <code>ResultSet</code> object.
*
* @return <code>true</code> if the cursor is after the last row;
* <code>false</code> if the cursor is at any other position or the
* result set contains no rows
* @exception SQLException if a database access error occurs
*/
public boolean isAfterLast() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.isAfterLast();
} else {
throw new UnsupportedOperationException(
"ResultSet.isAfterLast() unsupported");
}
}
/**
* Retrieves whether the cursor is on the first row of
* this <code>ResultSet</code> object.
*
* @return <code>true</code> if the cursor is on the first row;
* <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
public boolean isFirst() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.isFirst();
} else {
throw new UnsupportedOperationException(
"ResultSet.isFirst() unsupported");
}
}
/**
* Retrieves whether the cursor is on the last row of
* this <code>ResultSet</code> object.
* Note: Calling the method <code>isLast</code> may be expensive
* because the JDBC driver
* might need to fetch ahead one row in order to determine
* whether the current row is the last row in the result set.
*
* @return <code>true</code> if the cursor is on the last row;
* <code>false</code> otherwise
* @exception SQLException if a database access error occurs
*/
public boolean isLast() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.isLast();
} else {
throw new UnsupportedOperationException(
"ResultSet.isLast() unsupported");
}
}
/**
* Moves the cursor to the front of
* this <code>ResultSet</code> object, just before the
* first row. This method has no effect if the result set contains no rows.
*
* @exception SQLException if a database access error
* occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
*/
public void beforeFirst() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
reader.beforeFirst();
} else {
throw new UnsupportedOperationException(
"ResultSet.beforeFirst() unsupported");
}
}
/**
* Moves the cursor to the end of
* this <code>ResultSet</code> object, just after the
* last row. This method has no effect if the result set contains no rows.
* @exception SQLException if a database access error
* occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
*/
public void afterLast() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
reader.afterLast();
} else {
throw new UnsupportedOperationException(
"ResultSet.afterLast() unsupported");
}
}
/**
* Moves the cursor to the first row in
* this <code>ResultSet</code> object.
*
* @return <code>true</code> if the cursor is on a valid row;
* <code>false</code> if there are no rows in the result set
* @exception SQLException if a database access error
* occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
*/
public boolean first() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.first();
} else {
throw new UnsupportedOperationException(
"ResultSet.first() unsupported");
}
}
/**
* Moves the cursor to the last row in
* this <code>ResultSet</code> object.
*
* @return <code>true</code> if the cursor is on a valid row;
* <code>false</code> if there are no rows in the result set
* @exception SQLException if a database access error
* occurs or the result set type is <code>TYPE_FORWARD_ONLY</code>
*/
public boolean last() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.last();
} else {
throw new UnsupportedOperationException("ResultSet.last() unsupported");
}
}
/**
* Retrieves the current row number. The first row is number 1, the
* second number 2, and so on.
*
* @return the current row number; <code>0</code> if there is no current row
* @exception SQLException if a database access error occurs
*/
public int getRow() throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.getRow();
} else {
throw new UnsupportedOperationException(
"ResultSet.getRow() unsupported");
}
}
/**
* Moves the cursor to the given row number in
* this <code>ResultSet</code> object.
*
* <p>If the row number is positive, the cursor moves to
* the given row number with respect to the
* beginning of the result set. The first row is row 1, the second
* is row 2, and so on.
*
* <p>If the given row number is negative, the cursor moves to
* an absolute row position with respect to
* the end of the result set. For example, calling the method
* <code>absolute(-1)</code> positions the
* cursor on the last row; calling the method <code>absolute(-2)</code>
* moves the cursor to the next-to-last row, and so on.
*
* <p>An attempt to position the cursor beyond the first/last row in
* the result set leaves the cursor before the first row or after
* the last row.
*
* <p><B>Note:</B> Calling <code>absolute(1)</code> is the same
* as calling <code>first()</code>. Calling <code>absolute(-1)</code>
* is the same as calling <code>last()</code>.
*
* @param row the number of the row to which the cursor should move.
* A positive number indicates the row number counting from the
* beginning of the result set; a negative number indicates the
* row number counting from the end of the result set
* @return <code>true</code> if the cursor is on the result set;
* <code>false</code> otherwise
* @exception SQLException if a database access error
* occurs, or the result set type is <code>TYPE_FORWARD_ONLY</code>
*/
public boolean absolute(int row) throws SQLException {
if (this.isScrollable == ResultSet.TYPE_SCROLL_SENSITIVE) {
return reader.absolute(row);
} else {
throw new UnsupportedOperationException(
"ResultSet.absolute() unsupported");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -