postgresql.updateable.emptydelete:Can't deleteRow() on empty result set
postgresql.updateable.beforestartdelete:Before start of result set. Can not call deleteRow().
postgresql.updateable.afterlastdelete:After end of result set. Can not call deleteRow().
+postgresql.updateable.badupdateposition:Cannot update the result set because it is either before the start or after the end of the results.
postgresql.updateable.notoninsertrow:Not on insert row.
postgresql.updateable.ioerror:Input Stream Error - {0}
postgresql.call.noreturntype:A CallableStatement Function was declared but no call to 'registerOutParameter (1, <some_type>)' was made.
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.22.2.3 2004/03/29 17:47:47 barry Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.22.2.4 2004/06/21 03:11:37 jurka Exp $
*
*-------------------------------------------------------------------------
*/
String cursorName = statement.getFetchingCursorName();
if (cursorName == null || lastFetchSize == 0 || rows.size() < lastFetchSize) {
current_row = rows.size();
+ this_row = null;
+ rowBuffer = null;
return false; // Not doing a cursor-based fetch or the last fetch was the end of the query
}
// Test the new rows array.
lastFetchSize = fetchSize;
- if (rows.size() == 0)
+ if (rows.size() == 0) {
+ this_row = null;
+ rowBuffer = null;
return false;
+ }
// Otherwise reset the counter and let it go on...
current_row = 0;
* Copyright (c) 2003, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.25.2.7 2004/06/21 02:01:11 jurka Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.25.2.8 2004/06/21 03:11:49 jurka Exp $
*
*-------------------------------------------------------------------------
*/
current_row = rows_size;
onInsertRow = false;
+ this_row = null;
+ rowBuffer = null;
}
current_row = -1;
onInsertRow = false;
+ this_row = null;
+ rowBuffer = null;
}
{
if (current_row-1 < 0) {
current_row = -1;
+ this_row = null;
+ rowBuffer = null;
return false;
} else {
current_row--;
{
throw new PSQLException( "postgresql.updateable.notupdateable" );
}
+ if (isBeforeFirst() || isAfterLast())
+ {
+ throw new PSQLException("postgresql.updateable.badupdateposition");
+ }
if (doingUpdates)
{
{
throw new PSQLException( "postgresql.updateable.notupdateable" );
}
+ if (!onInsertRow && (isBeforeFirst() || isAfterLast()))
+ {
+ throw new PSQLException("postgresql.updateable.badupdateposition");
+ }
doingUpdates = !onInsertRow;
if (value == null)
updateNull(columnIndex);
st.close();
}
+ private void checkPositioning(ResultSet rs) throws SQLException
+ {
+ try {
+ rs.getInt(1);
+ fail("Can't use an incorrectly positioned result set.");
+ } catch (SQLException sqle) { }
+
+ try {
+ rs.updateInt(1,2);
+ fail("Can't use an incorrectly positioned result set.");
+ } catch (SQLException sqle) { }
+
+ try {
+ rs.updateRow();
+ fail("Can't use an incorrectly positioned result set.");
+ } catch (SQLException sqle) { }
+
+ try {
+ rs.deleteRow();
+ fail("Can't use an incorrectly positioned result set.");
+ } catch (SQLException sqle) { }
+ }
+
+ public void testPositioning() throws SQLException
+ {
+ Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
+ ResultSet rs = stmt.executeQuery("SELECT id1,name1 FROM second");
+
+ checkPositioning(rs);
+
+ assertTrue(rs.next());
+ rs.beforeFirst();
+ checkPositioning(rs);
+
+ rs.afterLast();
+ checkPositioning(rs);
+
+ rs.beforeFirst();
+ assertTrue(rs.next());
+ assertFalse(rs.next());
+ checkPositioning(rs);
+
+ rs.afterLast();
+ assertTrue(rs.previous());
+ assertFalse(rs.previous());
+ checkPositioning(rs);
+
+ rs.close();
+ stmt.close();
+ }
+
public void testUpdateStreams() throws SQLException, UnsupportedEncodingException
{
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);