本文整理汇总了Java中java.sql.ResultSet.absolute方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.absolute方法的具体用法?Java ResultSet.absolute怎么用?Java ResultSet.absolute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.sql.ResultSet
的用法示例。
在下文中一共展示了ResultSet.absolute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertResultSetLength
import java.sql.ResultSet; //导入方法依赖的package包/类
protected void assertResultSetLength(ResultSet rset, int len) throws Exception {
int oldRowPos = rset.getRow();
rset.last();
assertEquals("Result set length", len, rset.getRow());
if (oldRowPos > 0) {
rset.absolute(oldRowPos);
} else {
rset.beforeFirst();
}
}
示例2: advance
import java.sql.ResultSet; //导入方法依赖的package包/类
/**
* Advance the cursor to the first required row of the <tt>ResultSet</tt>
*/
private void advance(final ResultSet rs, final RowSelection selection)
throws SQLException {
final int firstRow = LimitHelper.getFirstRow( selection );
if ( firstRow != 0 ) {
if ( getFactory().getSettings().isScrollableResultSetsEnabled() ) {
// we can go straight to the first required row
rs.absolute( firstRow );
}
else {
// we need to step through the rows one row at a time (slow)
for ( int m = 0; m < firstRow; m++ ) rs.next();
}
}
}
示例3: advance
import java.sql.ResultSet; //导入方法依赖的package包/类
/**
* Advance the cursor to the first required row of the <tt>ResultSet</tt>
*/
protected void advance(final ResultSet rs, final RowSelection selection) throws SQLException {
final int firstRow = LimitHelper.getFirstRow( selection );
if ( firstRow != 0 ) {
if ( getFactory().getSettings().isScrollableResultSetsEnabled() ) {
// we can go straight to the first required row
rs.absolute( firstRow );
}
else {
// we need to step through the rows one row at a time (slow)
for ( int m = 0; m < firstRow; m++ ) {
rs.next();
}
}
}
}
示例4: advance
import java.sql.ResultSet; //导入方法依赖的package包/类
/**
* Advance the cursor to the first required row of the <tt>ResultSet</tt>
*/
private void advance(
final ResultSet rs,
final RowSelection selection,
final SessionImplementor session)
throws SQLException {
int firstRow = getFirstRow(selection);
if ( firstRow!=0 ) {
if ( session.getFactory().isScrollableResultSetsEnabled() ) {
// we can go straight to the first required row
rs.absolute(firstRow);
}
else {
// we need to step through the rows one row at a time (slow)
for ( int m=0; m<firstRow; m++ ) rs.next();
}
}
}
示例5: BBSThreadList
import java.sql.ResultSet; //导入方法依赖的package包/类
public static byte[] BBSThreadList(ResultSet rs, int start) throws SQLException {
final MaplePacketLittleEndianWriter mplew = new MaplePacketLittleEndianWriter();
mplew.writeShort(SendOpcode.GUILD_BBS_PACKET.getValue());
mplew.write(0x06);
if (!rs.last()) {
mplew.write(0);
mplew.writeInt(0);
mplew.writeInt(0);
return mplew.getPacket();
}
int threadCount = rs.getRow();
if (rs.getInt("localthreadid") == 0) { //has a notice
mplew.write(1);
addThread(mplew, rs);
threadCount--; //one thread didn't count (because it's a notice)
} else {
mplew.write(0);
}
if (!rs.absolute(start + 1)) { //seek to the thread before where we start
rs.first(); //uh, we're trying to start at a place past possible
start = 0;
}
mplew.writeInt(threadCount);
mplew.writeInt(Math.min(10, threadCount - start));
for (int i = 0; i < Math.min(10, threadCount - start); i++) {
addThread(mplew, rs);
rs.next();
}
return mplew.getPacket();
}
示例6: testQuery
import java.sql.ResultSet; //导入方法依赖的package包/类
public void testQuery() {
try {
Connection c = newConnection();
Statement st = c.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String s =
"CREATE TABLE T (I INTEGER, C CHARACTER(10), B BIT(4) DEFAULT B'')";
st.execute(s);
s = "INSERT INTO T VALUES(?,?, DEFAULT)";
PreparedStatement ps = c.prepareStatement(s);
for (int i = 1; i <= 20; i++) {
ps.setInt(1, i);
ps.setString(2, "TEST " + i);
ps.execute();
}
c.setAutoCommit(false);
s = "SELECT * FROM T";
ResultSet rs = st.executeQuery(s);
rs.absolute(10);
rs.updateString(2, "UPDATE10");
rs.updateRow();
rs.absolute(11);
rs.deleteRow();
rs.moveToInsertRow();
rs.updateInt(1, 1011);
rs.updateString(2, "INSERT1011");
rs.updateString(3, "0101");
rs.insertRow();
rs.close();
rs = st.executeQuery(s);
while (rs.next()) {
System.out.println("" + rs.getInt(1) + " "
+ rs.getString(2) + " "
+ rs.getString(3));
}
st.execute("SHUTDOWN");
if (!isNetwork) {
c.close();
}
} catch (Exception e) {
System.out.print(e);
}
}