当前位置: 首页>>代码示例>>Java>>正文


Java ResultSet.previous方法代码示例

本文整理汇总了Java中java.sql.ResultSet.previous方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.previous方法的具体用法?Java ResultSet.previous怎么用?Java ResultSet.previous使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.sql.ResultSet的用法示例。


在下文中一共展示了ResultSet.previous方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import java.sql.ResultSet; //导入方法依赖的package包/类
@Override
public void initialize(URL arg0, ResourceBundle arg1) {
	try {
		myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/gui_assignment?autoReconnect=true&useSSL=false", "root", "root");
		stmt = myConn.createStatement();
		
		ResultSet rs = stmt.executeQuery("select Temperature_Reading from temp_values");
		values = new int[rs.last() ? rs.getRow() : 0];
		
		int[] temp = {10000,100000,500000};
		noOfTempReadings = temp;
		
		rs.setFetchDirection(ResultSet.FETCH_REVERSE);
		rs.next();
		int i = values.length-1;
		while (rs.previous()) {
			values[i--] = rs.getInt("Temperature_Reading");
		}
	} catch (SQLException e) {
		e.printStackTrace();
		System.err.println("DATABASE CONNECT ERROR");
		System.exit(1);
	}
	
	System.out.println("No. of entries in database = "+values.length);
	
	ObservableList<String> pivotValues = FXCollections.observableArrayList("n/2","n/4","n/6");
	pivotSelect.setItems(pivotValues);
	pivotSelect.setValue("n/2");
	pivotSelect.setDisable(true);
	
	ObservableList<Integer> baseValues = FXCollections.observableArrayList(2,10,16);
	base.setItems(baseValues);
	base.setValue(10);
	base.setDisable(true);
	
	btnViewGraph.setDisable(true);
}
 
开发者ID:kevalmorabia97,项目名称:GUI-Sorting-Time-Comparison-using-JavaFx,代码行数:39,代码来源:MainController.java

示例2: ensureTableColumns

import java.sql.ResultSet; //导入方法依赖的package包/类
/**
 *  ensures that a given table has columns with a given name
 */
private void ensureTableColumns(String tableName,
                                String[] columnNames) throws SQLException {

    ResultSet res = m_connection.getMetaData().getColumns(null, null,
        tableName, "%");

    while (res.next()) {
        assertEquals(
            "unexpected column name in table \"" + tableName
            + "\" at position "
            + (res.getRow() - 1), res.getString(
                "COLUMN_NAME"), columnNames[res.getRow() - 1]);
    }

    res.previous();
    assertEquals("not enough columns in table \"" + tableName + "\"",
                 columnNames.length, res.getRow());
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:22,代码来源:TestViewAsterisks.java

示例3: testSecretResultSet03

import java.sql.ResultSet; //导入方法依赖的package包/类
@Test
public void testSecretResultSet03() throws Exception {
	cleanInsert(Paths.get("src/test/resources/data/setup", "testExecuteQuery.ltsv"));

	try (SqlAgent agent = config.agent()) {
		SqlContext ctx = agent.contextFrom("example/select_product").param("product_id", new BigDecimal(0));
		ctx.setResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);

		ResultSet result = agent.query(ctx);
		while (result.next()) {
			result.first();
			assertThat(result.isFirst(), is(true));
			result.previous();
			assertThat(result.isBeforeFirst(), is(true));
			result.next();
			assertThat(result.isBeforeFirst(), is(false));
			result.last();
			assertThat(result.isLast(), is(true));
			result.next();
			assertThat(result.isAfterLast(), is(true));
			result.previous();
			assertThat(result.isAfterLast(), is(false));
			result.beforeFirst();
			assertThat(result.isBeforeFirst(), is(true));
			result.afterLast();
			assertThat(result.isAfterLast(), is(true));
			result.next();

			assertThat(result.isWrapperFor(SecretResultSet.class), is(true));
			assertThat(result.unwrap(SecretResultSet.class).getCipher(), is(not(nullValue())));
			assertThat(result.unwrap(SecretResultSet.class).getCharset(), is(Charset.forName("UTF-8")));
			assertThat(result.unwrap(SecretResultSet.class).getCryptColumnNames(),
					is(Arrays.asList("PRODUCT_NAME")));
		}
		result.close();
	}
}
 
开发者ID:future-architect,项目名称:uroborosql,代码行数:38,代码来源:SecretColumnSqlFilterTest.java


注:本文中的java.sql.ResultSet.previous方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。