⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 resultsetreader.java

📁 j2ee源码
💻 JAVA
字号:
/*
 * Created on 2005/11/14
 */
package com.leeman.common.data;

import java.sql.ResultSet;
/**
 * @author Dennis
 */
public class ResultSetReader {
	
	private int startRecord;
	private ResultSet rs;
	private int maxRecords;
	
	private int currentRecord;
	
	//startRecord: The zero-based record number to start with.
	//maxRecords: The maximum number of records to retrieve.
	public ResultSetReader(ResultSet rs, int startRecord, int maxRecords)
	{
		this.startRecord = startRecord;
		this.rs = rs;
		this.maxRecords = maxRecords; 
		currentRecord = 0;
	}
		
	public boolean next() throws java.sql.SQLException
	{
		currentRecord ++;
		if (currentRecord == 1){
			if (startRecord == 0){
				return rs.next();
			}
			else{
				return rs.absolute(startRecord+1);
			}
		}
		else
		{
			if (currentRecord <= maxRecords || maxRecords == 0){
				return rs.next();
			}
			else{
				return false;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -