Java Code Examples for java.sql.ResultSet.afterLast()

The following are Jave code examples for showing how to use afterLast() of the java.sql.ResultSet class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: uroborosql   File: SecretColumnSqlFilterTest.java   View Source Code Vote up 5 votes
@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();
	}
}