提交 658da47a authored 作者: Thomas Mueller's avatar Thomas Mueller

Test and document rollback triggers.

上级 f17573bf
......@@ -608,13 +608,18 @@ null and length constraint checks have been made;
but before other constraints have been checked.
If there are multiple triggers, the order in which they are called is undefined.
Only row based AFTER trigger can be called on rollback.
Only row based AFTER trigger can be called on ROLLBACK.
Exceptions that occur within such triggers are ignored.
As the operations that occur within a trigger are part of the transaction,
ROLLBACK triggers are only required if an operation communicates outside of the database.
INSTEAD OF triggers are implicitly row based and behave like BEFORE triggers.
Only the first such trigger is called. Such triggers on views are supported.
They can be used to make views updatable.
A BEFORE SELECT trigger can be used to update a table on demand.
The trigger is called with both 'old' and 'new' set to null.
The MERGE statement will call both INSERT and UPDATE triggers.
Not supported are SELECT triggers with the option FOR EACH ROW,
and AFTER SELECT triggers.
......
......@@ -131,8 +131,19 @@ public class TestFullText extends TestBase {
assertEquals("TEST", rs.getString(2));
assertEquals("(ID)", rs.getString(3));
assertEquals("(1)", rs.getString(4));
rs = stat.executeQuery("SELECT * FROM FT_SEARCH('this', 0, 0)");
assertFalse(rs.next());
conn.setAutoCommit(false);
stat.execute("delete from test");
rs = stat.executeQuery("SELECT * FROM FT_SEARCH_DATA('Welcome', 0, 0)");
assertFalse(rs.next());
conn.rollback();
rs = stat.executeQuery("SELECT * FROM FT_SEARCH_DATA('Welcome', 0, 0)");
assertTrue(rs.next());
conn.setAutoCommit(true);
conn.close();
}
......
......@@ -256,6 +256,9 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
}
public void fire(Connection conn, Object[] oldRow, Object[] newRow) throws SQLException {
if (oldRow != null || newRow != null) {
throw new SQLException("old and new must be null");
}
conn.createStatement().execute("delete from meta_tables");
prepMeta.execute();
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论