You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by be...@apache.org on 2005/12/19 11:09:05 UTC
svn commit: r357678 - in /db/derby/code/trunk/java:
client/org/apache/derby/client/am/
testing/org/apache/derbyTesting/functionTests/master/
testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/
testing/org/apache/derbyTesting/functionTe...
Author: bernt
Date: Mon Dec 19 02:08:36 2005
New Revision: 357678
URL: http://svn.apache.org/viewcvs?rev=357678&view=rev
Log:
DERBY-611 Network client: updateRow() causes a commit when autoCommit = true. Submitted by Dag.Wanvik@Sun.COM
Modified:
db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java?rev=357678&r1=357677&r2=357678&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ResultSet.java Mon Dec 19 02:08:36 2005
@@ -2817,11 +2817,7 @@
preparedStatementForUpdate_.section_);
}
- boolean chainAutoCommit = connection_.willAutoCommitGenerateFlow();
- writeUpdateRow(chainAutoCommit);
- if (chainAutoCommit) {
- connection_.writeCommit();
- }
+ writeUpdateRow(false);
agent_.flow(statement_);
@@ -2842,9 +2838,6 @@
}
readUpdateRow();
- if (chainAutoCommit) {
- connection_.readCommit();
- }
agent_.endReadChain();
}
@@ -2905,9 +2898,6 @@
}
writeDeleteRow();
- if (connection_.autoCommit_) {
- connection_.writeAutoCommit();
- }
agent_.flow(statement_);
@@ -2927,9 +2917,7 @@
preparedStatementForDelete_.materialPreparedStatement_.readPrepare_();
}
readDeleteRow();
- if (connection_.autoCommit_) {
- connection_.readAutoCommit();
- }
+
agent_.endReadChain();
}
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out?rev=357678&r1=357677&r2=357678&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/jdk14/updatableResultSet.out Mon Dec 19 02:08:36 2005
@@ -127,8 +127,8 @@
SQL State : null
Got expected exception Invalid operation to read at current cursor position.
calling deleteRow again w/o first positioning the ResultSet on the next row will fail
-SQL State : 24000
-Got expected exception Invalid cursor state - no current row.
+SQL State : XCL08
+Got expected exception Cursor '<xxx-cursor-name-xxx>' is not on a row.
Position the ResultSet with next()
Should be able to deletRow() on the current row now
Positive Test1b - request updatable resultset for forward only type resultset
@@ -192,8 +192,8 @@
SQL State : null
Got expected exception Invalid operation to read at current cursor position.
calling deleteRow again w/o first positioning the ResultSet on the next row will fail
-SQL State : 24000
-Got expected exception Invalid cursor state - no current row.
+SQL State : XCL08
+Got expected exception Cursor '<xxx-cursor-name-xxx>' is not on a row.
Position the ResultSet with next()
Should be able to deletRow() on the current row now
Positive Test3b - use prepared statement with concur updatable status to test updateXXX
@@ -223,8 +223,8 @@
SQL State : null
Got expected exception Invalid operation to read at current cursor position.
calling deleteRow again w/o first positioning the ResultSet on the next row will fail
-SQL State : 24000
-Got expected exception Invalid cursor state - no current row.
+SQL State : XCL08
+Got expected exception Cursor '<xxx-cursor-name-xxx>' is not on a row.
Position the ResultSet with next()
Should be able to deletRow() on the current row now
Positive Test5 - donot have to select primary key to get an updatable resultset
@@ -3164,4 +3164,41 @@
------ ------ ------
{1,1,2.2}
{1,1,3.3}
+Positive Test34 - in autocommit mode, check that updateRow and deleteRow does not commit
+ Contents before changes to first row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Contents before changes to last row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
Finished testing updateable resultsets
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out?rev=357678&r1=357677&r2=357678&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/DerbyNetClient/updatableResultSet.out Mon Dec 19 02:08:36 2005
@@ -127,8 +127,8 @@
SQL State : null
Got expected exception Invalid operation to read at current cursor position.
calling deleteRow again w/o first positioning the ResultSet on the next row will fail
-SQL State : 24000
-Got expected exception Invalid cursor state - no current row.
+SQL State : XCL08
+Got expected exception Cursor '<xxx-cursor-name-xxx>' is not on a row.
Position the ResultSet with next()
Should be able to deletRow() on the current row now
Positive Test1b - request updatable resultset for forward only type resultset
@@ -192,8 +192,8 @@
SQL State : null
Got expected exception Invalid operation to read at current cursor position.
calling deleteRow again w/o first positioning the ResultSet on the next row will fail
-SQL State : 24000
-Got expected exception Invalid cursor state - no current row.
+SQL State : XCL08
+Got expected exception Cursor '<xxx-cursor-name-xxx>' is not on a row.
Position the ResultSet with next()
Should be able to deletRow() on the current row now
Positive Test3b - use prepared statement with concur updatable status to test updateXXX
@@ -223,8 +223,8 @@
SQL State : null
Got expected exception Invalid operation to read at current cursor position.
calling deleteRow again w/o first positioning the ResultSet on the next row will fail
-SQL State : 24000
-Got expected exception Invalid cursor state - no current row.
+SQL State : XCL08
+Got expected exception Cursor '<xxx-cursor-name-xxx>' is not on a row.
Position the ResultSet with next()
Should be able to deletRow() on the current row now
Positive Test5 - donot have to select primary key to get an updatable resultset
@@ -2896,4 +2896,41 @@
------ ------ ------
{1,1,2.2}
{1,1,3.3}
+Positive Test34 - in autocommit mode, check that updateRow and deleteRow does not commit
+ Contents before changes to first row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Contents before changes to last row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
Finished testing updateable resultsets
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/updatableResultSet.out?rev=357678&r1=357677&r2=357678&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_13/updatableResultSet.out Mon Dec 19 02:08:36 2005
@@ -2806,4 +2806,41 @@
------ ------ ------
{1,1,2.2}
{1,1,3.3}
+Positive Test34 - in autocommit mode, check that updateRow and deleteRow does not commit
+ Contents before changes to first row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Contents before changes to last row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
Finished testing updateable resultsets
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out?rev=357678&r1=357677&r2=357678&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/jdk14/updatableResultSet.out Mon Dec 19 02:08:36 2005
@@ -3102,4 +3102,41 @@
------ ------ ------
{1,1,2.2}
{1,1,3.3}
+Positive Test34 - in autocommit mode, check that updateRow and deleteRow does not commit
+ Contents before changes to first row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Contents before changes to last row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
Finished testing updateable resultsets
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out?rev=357678&r1=357677&r2=357678&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/updatableResultSet.out Mon Dec 19 02:08:36 2005
@@ -2828,4 +2828,41 @@
------ ------ ------
{1,1,2.2}
{1,1,3.3}
+Positive Test34 - in autocommit mode, check that updateRow and deleteRow does not commit
+ Contents before changes to first row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Contents before changes to last row in RS:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
+ Make sure the contents of table are unchanged:
+ C1,C2
+ -- --
+ {1,aa }
+ {2,bb }
+ {3,cc }
Finished testing updateable resultsets
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java?rev=357678&r1=357677&r2=357678&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/updatableResultSet.java Mon Dec 19 02:08:36 2005
@@ -2377,6 +2377,70 @@
System.out.println(" contents of table t1 from schema s2 should have changed");
dumpRS(stmt.executeQuery("select * from s2.t1"));
+ System.out.println("Positive Test34 - in autocommit mode, check that updateRow and deleteRow does not commit");
+ conn.setAutoCommit(true);
+
+ // First try deleteRow and updateRow on *first* row of result set
+ reloadData();
+ System.out.println(" Contents before changes to first row in RS:");
+ dumpRS(stmt.executeQuery("select * from t1"));
+ stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
+ rs.next();
+ rs.deleteRow();
+ conn.rollback();
+ rs.close();
+ System.out.println(" Make sure the contents of table are unchanged:");
+ dumpRS(stmt.executeQuery("select * from t1"));
+ stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
+ rs.next();
+ rs.updateInt(1,-rs.getInt(1));
+ rs.updateRow();
+ conn.rollback();
+ rs.close();
+ System.out.println(" Make sure the contents of table are unchanged:");
+ dumpRS(stmt.executeQuery("select * from t1"));
+
+ // Now try the same on the *last* row in the result set
+ reloadData();
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery("SELECT COUNT(*) FROM t1");
+ rs.next();
+ int count = rs.getInt(1);
+ rs.close();
+
+ System.out.println(" Contents before changes to last row in RS:");
+ dumpRS(stmt.executeQuery("select * from t1"));
+ stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
+ for (int j = 0; j < count; j++) {
+ rs.next();
+ }
+ rs.deleteRow();
+ conn.rollback();
+ rs.close();
+ System.out.println(" Make sure the contents of table are unchanged:");
+ dumpRS(stmt.executeQuery("select * from t1"));
+
+ stmt = conn.createStatement();
+ rs = stmt.executeQuery("SELECT COUNT(*) FROM t1");
+ rs.next();
+ count = rs.getInt(1);
+ rs.close();
+
+ stmt = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
+ rs = stmt.executeQuery("SELECT * FROM t1 FOR UPDATE");
+ for (int j = 0; j < count; j++) {
+ rs.next();
+ }
+ rs.updateInt(1,-rs.getInt(1));
+ rs.updateRow();
+ conn.rollback();
+ rs.close();
+ System.out.println(" Make sure the contents of table are unchanged:");
+ dumpRS(stmt.executeQuery("select * from t1"));
+
teardown();
conn.close();