List of usage examples for java.sql ResultSet rowInserted
boolean rowInserted() throws SQLException;
From source file:com.github.woonsan.jdbc.jcr.impl.JcrJdbcResultSetTest.java
@SuppressWarnings("deprecation") @Test/*from ww w.j a va 2 s . c om*/ public void testResultSetWhenClosed() throws Exception { Statement statement = getConnection().createStatement(); ResultSet rs = statement.executeQuery(SQL_EMPS); rs.close(); try { rs.isBeforeFirst(); fail(); } catch (SQLException ignore) { } try { rs.isAfterLast(); fail(); } catch (SQLException ignore) { } try { rs.isFirst(); fail(); } catch (SQLException ignore) { } try { rs.isLast(); fail(); } catch (SQLException ignore) { } try { rs.beforeFirst(); fail(); } catch (SQLException ignore) { } try { rs.afterLast(); fail(); } catch (SQLException ignore) { } try { rs.first(); fail(); } catch (SQLException ignore) { } try { rs.last(); fail(); } catch (SQLException ignore) { } try { rs.next(); fail(); } catch (SQLException ignore) { } try { rs.getRow(); fail(); } catch (SQLException ignore) { } try { rs.getType(); fail(); } catch (SQLException ignore) { } try { rs.getConcurrency(); fail(); } catch (SQLException ignore) { } try { rs.rowUpdated(); fail(); } catch (SQLException ignore) { } try { rs.rowDeleted(); fail(); } catch (SQLException ignore) { } try { rs.rowInserted(); fail(); } catch (SQLException ignore) { } try { rs.getStatement(); fail(); } catch (SQLException ignore) { } try { rs.wasNull(); fail(); } catch (SQLException ignore) { } try { rs.getString(1); fail(); } catch (SQLException ignore) { } try { rs.getString("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBoolean(1); fail(); } catch (SQLException ignore) { } try { rs.getBoolean("col1"); fail(); } catch (SQLException ignore) { } try { rs.getByte(1); fail(); } catch (SQLException ignore) { } try { rs.getByte("col1"); fail(); } catch (SQLException ignore) { } try { rs.getShort(1); fail(); } catch (SQLException ignore) { } try { rs.getShort("col1"); fail(); } catch (SQLException ignore) { } try { rs.getInt(1); fail(); } catch (SQLException ignore) { } try { rs.getInt("col1"); fail(); } catch (SQLException ignore) { } try { rs.getLong(1); fail(); } catch (SQLException ignore) { } try { rs.getLong("col1"); fail(); } catch (SQLException ignore) { } try { rs.getFloat(1); fail(); } catch (SQLException ignore) { } try { rs.getFloat("col1"); fail(); } catch (SQLException ignore) { } try { rs.getDouble(1); fail(); } catch (SQLException ignore) { } try { rs.getDouble("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBigDecimal(1); fail(); } catch (SQLException ignore) { } try { rs.getBigDecimal("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBytes(1); fail(); } catch (SQLException ignore) { } try { rs.getBytes("col1"); fail(); } catch (SQLException ignore) { } try { rs.getDate(1); fail(); } catch (SQLException ignore) { } try { rs.getDate(1, null); fail(); } catch (SQLException ignore) { } try { rs.getDate("col1"); fail(); } catch (SQLException ignore) { } try { rs.getDate("col1", null); fail(); } catch (SQLException ignore) { } try { rs.getTime(1); fail(); } catch (SQLException ignore) { } try { rs.getTime(1, null); fail(); } catch (SQLException ignore) { } try { rs.getTime("col1"); fail(); } catch (SQLException ignore) { } try { rs.getTime("col1", null); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp(1); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp(1, null); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp("col1"); fail(); } catch (SQLException ignore) { } try { rs.getTimestamp("col1", null); fail(); } catch (SQLException ignore) { } try { rs.getAsciiStream(1); fail(); } catch (SQLException ignore) { } try { rs.getAsciiStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getUnicodeStream(1); fail(); } catch (SQLException ignore) { } try { rs.getUnicodeStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getBinaryStream(1); fail(); } catch (SQLException ignore) { } try { rs.getBinaryStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getCharacterStream(1); fail(); } catch (SQLException ignore) { } try { rs.getCharacterStream("col1"); fail(); } catch (SQLException ignore) { } try { rs.getMetaData(); fail(); } catch (SQLException ignore) { } try { rs.setFetchDirection(1); fail(); } catch (SQLException ignore) { } try { rs.getFetchDirection(); fail(); } catch (SQLException ignore) { } try { rs.setFetchSize(100); fail(); } catch (SQLException ignore) { } try { rs.getFetchSize(); fail(); } catch (SQLException ignore) { } try { rs.getHoldability(); fail(); } catch (SQLException ignore) { } statement.close(); }
From source file:com.github.woonsan.jdbc.jcr.impl.JcrJdbcResultSetTest.java
private int printResultSet(final ResultSet rs) throws Exception { int count = 0; long empno, empno2; String ename, ename2;//from w w w.j a v a 2 s . co m String[] nicknames; String[] nicknames2; double salary, salary2; Date hireDate, hireDate2; System.out.println(); System.out.println("==================================================================="); System.out.println(" empno ename salary hire_date nicknames"); System.out.println("==================================================================="); while (rs.next()) { ++count; if (count == 1) { assertTrue(rs.isFirst()); } else { assertFalse(rs.isFirst()); } assertEquals(count, rs.getRow()); empno = rs.getLong(1); assertFalse(rs.wasNull()); empno2 = rs.getLong("empno"); assertEquals(empno, empno2); ename = rs.getString(2); ename2 = rs.getString("ename"); assertEquals(ename, ename2); salary = rs.getDouble(3); salary2 = rs.getDouble("salary"); assertEquals(salary, salary2, 0.001); hireDate = rs.getDate(4); hireDate2 = rs.getDate("hiredate"); assertEquals(hireDate, hireDate2); nicknames = (String[]) rs.getArray(5).getArray(); nicknames2 = (String[]) rs.getArray("nicknames").getArray(); assertArrayEquals(nicknames, nicknames2); String nodeName = rs.getString(Constants.COLUMN_JCR_NAME); assertEquals("testdata-" + count, nodeName); assertEquals("/testdatafolder/" + nodeName, rs.getString(Constants.COLUMN_JCR_PATH)); String nodeId = rs.getString(Constants.COLUMN_JCR_UUID); assertTrue(nodeId != null && !nodeId.isEmpty()); assertTrue(rs.getDouble(Constants.COLUMN_JCR_SCORE) > 0.0); assertWrongValueFormatColumn(rs); assertNonExistingColumn(rs); System.out.println(String.format(REC_OUT_FORMAT, empno, ename, salary, new SimpleDateFormat("yyyy-MM-dd").format(hireDate), join(nicknames, ","))); System.out.println(String.format(NODE_INFO_OUT_FORMAT, rs.getString("jcr:uuid"), rs.getString("jcr:name"), rs.getString("jcr:path"), rs.getDouble("jcr:score"))); assertEquals(count, empno); assertEquals("Name' " + count, ename); assertEquals(100000.0 + count, salary, .1); assertEquals(getEmpHireDate().getTimeInMillis(), hireDate.getTime()); assertFalse(rs.rowUpdated()); assertFalse(rs.rowInserted()); assertFalse(rs.rowDeleted()); } System.out.println("=================================================="); System.out.println(); return count; }