提交 4ec5fe64 authored 作者: Niklas Mehner's avatar Niklas Mehner

Add test for update statement on synonym.

上级 4a560bf8
......@@ -53,6 +53,11 @@ public class TableSynonym extends Table {
return getSynonymFor().getColumn(index);
}
@Override
public Row getTemplateRow() {
return getSynonymFor().getTemplateRow();
}
@Override
public boolean lock(Session session, boolean exclusive, boolean forceLockEvenInMvcc) {
return getSynonymFor().lock(session, exclusive, forceLockEvenInMvcc);
......
......@@ -34,6 +34,7 @@ public class TestSynonymForTable extends TestBase {
testSelectFromSynonym();
testInsertIntoSynonym();
testInsertWithColumnNameIntoSynonym();
testUpdate();
testDeleteFromSynonym();
testTruncateSynonym();
testExistingTableName();
......@@ -48,6 +49,19 @@ public class TestSynonymForTable extends TestBase {
testDropSchema();
}
private void testUpdate() throws SQLException {
Connection conn = getConnection("synonym");
createTableWithSynonym(conn);
insertIntoSynonym(conn, 25);
Statement stmnt = conn.createStatement();
assertEquals(1, stmnt.executeUpdate("UPDATE testsynonym set id = 30 WHERE id = 25"));
assertSynonymContains(conn, 30);
conn.close();
}
private void testDropSchema() throws SQLException {
Connection conn = getConnection("synonym");
Statement stat = conn.createStatement();
......@@ -58,6 +72,7 @@ public class TestSynonymForTable extends TestBase {
stat.execute("DROP SCHEMA s1");
assertThrows(JdbcSQLException.class, stat).execute("SELECT id FROM testsynonym");
conn.close();
}
private void testDropTable() throws SQLException {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论