當前位置: 首頁>>代碼示例>>Java>>正文


Java ResultSet.absolute方法代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:bragex,項目名稱:the-vigilantes,代碼行數:11,代碼來源:BaseTestCase.java

示例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();
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:19,代碼來源:Loader.java

示例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();
			}
		}
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:19,代碼來源:AbstractLoadPlanBasedLoader.java

示例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();
		}
	}
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:22,代碼來源:Loader.java

示例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();
}
 
開發者ID:NovaStory,項目名稱:AeroStory,代碼行數:31,代碼來源:MaplePacketCreator.java

示例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);
        }
    }
 
開發者ID:Julien35,項目名稱:dev-courses,代碼行數:57,代碼來源:TestUpdatableResults.java


注:本文中的java.sql.ResultSet.absolute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。