下面列出了java.sql.ResultSet#FETCH_REVERSE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void setFetchDirection(int direction) throws SQLException {
checkOpen();
switch (direction) {
case ResultSet.FETCH_UNKNOWN:
case ResultSet.FETCH_REVERSE:
case ResultSet.FETCH_FORWARD:
fetchDirection = direction;
break;
default:
throw new SQLException(
Messages.get("error.generic.badoption",
Integer.toString(direction),
"direction"),
"24000");
}
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
/**
* {@inheritDoc}
*/
@Override
public void setFetchDirection(int direction) throws SQLException {
checkClosed();
if (direction == ResultSet.FETCH_REVERSE) {
this.attrs.setFetchReverse(true);
}
else if (direction == ResultSet.FETCH_FORWARD) {
this.attrs.setFetchReverse(false);
}
else if (this.attrs.isSetFetchReverse()) {
this.attrs.setFetchReverseIsSet(false);
this.attrs.setFetchReverse(false);
}
}
/**
* {@inheritDoc}
*/
@Override
public int getFetchDirection() throws SQLException {
if (this.attrs.isSetFetchReverse()) {
return this.attrs.isFetchReverse() ? ResultSet.FETCH_REVERSE
: ResultSet.FETCH_FORWARD;
}
else {
return ResultSet.FETCH_UNKNOWN;
}
}
@DataProvider(name = "rowSetFetchDirection")
protected Object[][] rowSetFetchDirection() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.FETCH_FORWARD},
{rs, ResultSet.FETCH_REVERSE},
{rs, ResultSet.FETCH_UNKNOWN}
};
}
@Override
public void setFetchDirection(int direction) throws SQLException {
checkOpen();
if (direction == ResultSet.FETCH_FORWARD ||
direction == ResultSet.FETCH_REVERSE ||
direction == ResultSet.FETCH_UNKNOWN) {
this.fetchDirection = direction;
} else {
throw new SQLFeatureNotSupportedException(CsvResources.getString("unsupportedDirection") + ": " + direction);
}
}
@Override
public void setFetchDirection(int direction) throws SQLException {
checkOpen();
if (direction == ResultSet.FETCH_FORWARD ||
direction == ResultSet.FETCH_REVERSE ||
direction == ResultSet.FETCH_UNKNOWN) {
this.fetchDirection = direction;
} else {
throw new SQLException(CsvResources.getString("unsupportedDirection") + ": " + direction);
}
}
/**
* {@inheritDoc}
*/
@Override
public void setFetchDirection(int direction) throws SQLException {
checkClosed();
if (direction == ResultSet.FETCH_REVERSE) {
this.attrs.setFetchReverse(true);
}
else if (direction == ResultSet.FETCH_FORWARD) {
this.attrs.setFetchReverse(false);
}
else if (this.attrs.isSetFetchReverse()) {
this.attrs.setFetchReverseIsSet(false);
this.attrs.setFetchReverse(false);
}
}
/**
* {@inheritDoc}
*/
@Override
public int getFetchDirection() throws SQLException {
if (this.attrs.isSetFetchReverse()) {
return this.attrs.isFetchReverse() ? ResultSet.FETCH_REVERSE
: ResultSet.FETCH_FORWARD;
}
else {
return ResultSet.FETCH_UNKNOWN;
}
}
@SuppressWarnings("boxing")
public void setFetchDirection(int direction) throws SQLException
{
checkNotClosed();
if (direction == ResultSet.FETCH_FORWARD || direction == ResultSet.FETCH_REVERSE || direction == ResultSet.FETCH_UNKNOWN)
{
if ((getResultSetType() == ResultSet.TYPE_FORWARD_ONLY) && (direction != ResultSet.FETCH_FORWARD))
throw new SQLSyntaxErrorException(String.format(BAD_FETCH_DIR, direction));
fetchDirection = direction;
}
else throw new SQLSyntaxErrorException(String.format(BAD_FETCH_DIR, direction));
}
private static boolean validFetchDirection(int direction)
{
return (direction == ResultSet.FETCH_FORWARD) ||
(direction == ResultSet.FETCH_REVERSE) ||
(direction == ResultSet.FETCH_UNKNOWN);
}