Trying to do case insensitive matching using the IN operator leads to 
inconsistent behaviour. The code below shows a unit test that should pass 
but actually fails on the final check.

I am using the latest version of h2 and have set MODE=MSSQLServer and 
IGNORECASE=TRUE

    @Test
    public void testIn() throws Exception {
        Class.forName("org.h2.Driver");
        final JdbcDataSource dataSource = new JdbcDataSource();
        dataSource.setURL("jdbc:h2:mem:;MODE=MSSQLServer;IGNORECASE=TRUE");
        dataSource.setUser("sa");
        dataSource.setPassword("sa");
        Connection connection = dataSource.getConnection();
        //connection.createStatement().executeUpdate("set collation ENGLISH 
STRENGTH SECONDARY;");
        connection.createStatement().executeUpdate("CREATE TABLE testValues 
(x VARCHAR(50))");
        connection.createStatement().executeUpdate("INSERT INTO testValues 
(x) SELECT 'foo' x");
        ResultSet resultSet;
        resultSet = connection.createStatement().executeQuery("SELECT x 
FROM testValues WHERE x IN ('foo')");
        assertTrue(resultSet.next());
        resultSet = connection.createStatement().executeQuery("SELECT x 
FROM testValues WHERE x IN ('FOO')");
        assertTrue(resultSet.next());
        resultSet = connection.createStatement().executeQuery("SELECT x 
FROM testValues WHERE x IN ('foo','bar')");
        assertTrue(resultSet.next());
*        resultSet = connection.createStatement().executeQuery("SELECT x 
FROM testValues WHERE x IN ('FOO','bar')");*
*        assertTrue(resultSet.next());*
   }

Any ideas why this is failing?

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to