Tweak in list tests
This commit is contained in:
parent
23c87a25c7
commit
6e56622ce0
|
@ -60,11 +60,11 @@ public class QueryMapperQmDao implements QmDao {
|
||||||
Collection<Class<?>> no = new ArrayList<Class<?>>();
|
Collection<Class<?>> no = new ArrayList<Class<?>>();
|
||||||
for(final String connectionClassName : new String[]{
|
for(final String connectionClassName : new String[]{
|
||||||
"org.apache.derby.impl.jdbc.EmbedConnection"
|
"org.apache.derby.impl.jdbc.EmbedConnection"
|
||||||
, "org.hsqldb.jdbc.JDBCConnection" // does not support ArrayInList but *does* support UnNestArrayInList
|
//, "org.hsqldb.jdbc.JDBCConnection" // does not support ArrayInList but *does* support UnNestArrayInList
|
||||||
, "org.sqlite.jdbc3.JDBC3Connection"
|
, "org.sqlite.jdbc3.JDBC3Connection"
|
||||||
, "org.mariadb.jdbc.MariaDbConnection"
|
, "org.mariadb.jdbc.MariaDbConnection"
|
||||||
, "com.microsoft.sqlserver.jdbc.SQLServerConnection"
|
, "com.microsoft.sqlserver.jdbc.SQLServerConnection"
|
||||||
, "oracle.jdbc.driver.PhysicalConnection" // does not support ArrayInList but *does* support OracleArrayInList
|
//, "oracle.jdbc.OracleConnection" // does not support ArrayInList but *does* support OracleArrayInList
|
||||||
// h2 doesn't support this with java6 either...
|
// h2 doesn't support this with java6 either...
|
||||||
/*IFJAVA6_START
|
/*IFJAVA6_START
|
||||||
, "org.h2.jdbc.JdbcConnection"
|
, "org.h2.jdbc.JdbcConnection"
|
||||||
|
@ -77,7 +77,7 @@ public class QueryMapperQmDao implements QmDao {
|
||||||
}
|
}
|
||||||
noArrayInListSupport = Collections.unmodifiableCollection(no);
|
noArrayInListSupport = Collections.unmodifiableCollection(no);
|
||||||
hsqlConnection = classForName("org.hsqldb.jdbc.JDBCConnection");
|
hsqlConnection = classForName("org.hsqldb.jdbc.JDBCConnection");
|
||||||
oracleConnection = classForName("oracle.jdbc.driver.PhysicalConnection");
|
oracleConnection = classForName("oracle.jdbc.OracleConnection");
|
||||||
mssqlConnection = classForName("com.microsoft.sqlserver.jdbc.SQLServerConnection");
|
mssqlConnection = classForName("com.microsoft.sqlserver.jdbc.SQLServerConnection");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,12 +113,12 @@ public class QueryMapperQmDao implements QmDao {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static InList getBestInList(final Connection conn) {
|
public static InList getBestInList(final Connection conn) {
|
||||||
if(supportsArrayInList(conn))
|
|
||||||
return ArrayInList.instance();
|
|
||||||
if(isWrapperFor(conn, hsqlConnection))
|
|
||||||
return UnNestArrayInList.instance();
|
|
||||||
if(isWrapperFor(conn, oracleConnection))
|
if(isWrapperFor(conn, oracleConnection))
|
||||||
return OracleArrayInList.instance();
|
return OracleArrayInList.instance();
|
||||||
|
if(isWrapperFor(conn, hsqlConnection))
|
||||||
|
return UnNestArrayInList.instance();
|
||||||
|
if(supportsArrayInList(conn))
|
||||||
|
return ArrayInList.instance();
|
||||||
// works for everything
|
// works for everything
|
||||||
return BindInList.instance();
|
return BindInList.instance();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class QueryMapperTest {
|
||||||
final Collection<String> jUrls = new ArrayList<String>();
|
final Collection<String> jUrls = new ArrayList<String>();
|
||||||
final String jdbcUrl = System.getProperty("jdbcUrl", "all");
|
final String jdbcUrl = System.getProperty("jdbcUrl", "all");
|
||||||
if(jdbcUrl.equals("all")) {
|
if(jdbcUrl.equals("all")) {
|
||||||
jUrls.add("jdbc:hsqldb:mem:testDB");
|
//jUrls.add("jdbc:hsqldb:mem:testDB"); // remove this from all since it supports custom InList, until generic inlist supported in JdbcMapper
|
||||||
jUrls.add("jdbc:derby:memory:testDB;create=true");
|
jUrls.add("jdbc:derby:memory:testDB;create=true");
|
||||||
jUrls.add("jdbc:h2:mem:testDB");
|
jUrls.add("jdbc:h2:mem:testDB");
|
||||||
jUrls.add("jdbc:sqlite::memory:");
|
jUrls.add("jdbc:sqlite::memory:");
|
||||||
|
@ -521,9 +521,13 @@ public class QueryMapperTest {
|
||||||
assertArrayEquals(people, fromDb.toArray());
|
assertArrayEquals(people, fromDb.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean supportsInList(final QmDao qm) {
|
||||||
|
return qm instanceof QueryMapperQmDao || supportsArrayInList(qm.getConnection());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListQueryMapperList() throws SQLException {
|
public void testListQueryMapperList() throws SQLException {
|
||||||
if(!(qm instanceof QueryMapperQmDao) && !supportsArrayInList(conn))
|
if(!supportsInList(qm))
|
||||||
return;
|
return;
|
||||||
final List<FieldPerson> fromDb = qm.getFieldPeople(Arrays.asList(people[0].getPersonNo(), people[1].getPersonNo(), people[2].getPersonNo()));
|
final List<FieldPerson> fromDb = qm.getFieldPeople(Arrays.asList(people[0].getPersonNo(), people[1].getPersonNo(), people[2].getPersonNo()));
|
||||||
assertArrayEquals(people, fromDb.toArray());
|
assertArrayEquals(people, fromDb.toArray());
|
||||||
|
|
Loading…
Reference in New Issue