提交 adcec352 authored 作者: Thomas Mueller's avatar Thomas Mueller

An optimization for IN(..) and IN(SELECT...) using the system property h2.optimizeInList

上级 f66da544
......@@ -61,6 +61,21 @@ public class TestOptimizations extends TestBase {
private void testNestedInSelectAndLike() throws SQLException {
deleteDb("optimizations");
Connection conn = getConnection("optimizations");
Statement stat = conn.createStatement();
stat.execute("create table test(id int primary key)");
stat.execute("insert into test values(2)");
ResultSet rs = stat.executeQuery("select * from test where id in(1, 2)");
assertTrue(rs.next());
assertEquals(2, rs.getInt(1));
assertFalse(rs.next());
stat.execute("create table test2(id int primary key hash)");
stat.execute("insert into test2 values(2)");
rs = stat.executeQuery("select * from test where id in(1, 2)");
assertTrue(rs.next());
assertEquals(2, rs.getInt(1));
assertFalse(rs.next());
PreparedStatement prep;
prep = conn.prepareStatement("SELECT * FROM DUAL A WHERE A.X IN (SELECT B.X FROM DUAL B WHERE B.X LIKE ?)");
prep.setString(1, "1");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论