changeset 129:f9ba2b04db7b

Changed ExecuteUpdate test to not work on sys.keywords table (which became readonly in Jul2017 branch) but use its own created table t3350. Also added tests where multiple rows are inserted, updated and deleted per SQL command.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 18 May 2017 13:04:07 +0200 (2017-05-18)
parents a6a2f4ee2d42
children 0112d8496636
files tests/BugExecuteUpdate_Bug_3350.java
diffstat 1 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/tests/BugExecuteUpdate_Bug_3350.java
+++ b/tests/BugExecuteUpdate_Bug_3350.java
@@ -16,15 +16,23 @@ public class BugExecuteUpdate_Bug_3350 {
 
 		final Statement stmt = con.createStatement();
 		try {
-			executeDML(stmt, "INSERT INTO sys.keywords VALUES ('Bug_3350')"); // should insert 1 row
-			executeDML(stmt, "INSERT INTO sys.keywords VALUES ('Bug_3350')"); // this will result in an SQLException due to PK uniqueness violation
+			stmt.execute("CREATE TABLE t3350 (keyword VARCHAR(30) PRIMARY KEY)");
+			con.commit();
+
+			executeDML(stmt, "INSERT INTO t3350 VALUES ('Bug_3350')"); // should insert 1 row
+			executeDML(stmt, "INSERT INTO t3350 VALUES ('Bug_3350')"); // this will result in an SQLException due to PK uniqueness violation
 			con.rollback();
 
-			executeDML(stmt, "INSERT INTO sys.keywords VALUES ('Bug_3350')"); // should insert 1 row
-			executeDML(stmt, "DELETE FROM sys.keywords WHERE \"keyword\" = 'Bug_3350'"); // should delete 1 row
-			executeDML(stmt, "DELETE FROM sys.keywords WHERE \"keyword\" = 'Bug_3350'"); // should delete 0 rows
+			executeDML(stmt, "INSERT INTO t3350 VALUES ('Bug_3350')"); // should insert 1 row
+			executeDML(stmt, "INSERT INTO t3350 VALUES ('1'), ('x'), ('3'), ('y')"); // should insert 4 rows
+			executeDML(stmt, "DELETE FROM t3350 WHERE \"keyword\" = 'Bug_3350'"); // should delete 1 row
+			executeDML(stmt, "DELETE FROM t3350 WHERE \"keyword\" = 'Bug_3350'"); // should delete 0 rows
+			executeDML(stmt, "UPDATE t3350 set \"keyword\" = keyword||'_ext'"); // should update 4 rows
+			executeDML(stmt, "DELETE FROM t3350"); // should delete 4 rows
+			con.commit();
 
-			con.rollback();
+			stmt.execute("DROP TABLE t3350");
+			con.commit();
 		} catch (SQLException se) {
 			System.out.println(se.getMessage());
 		} finally {