JdbcMapper/querymapper/src/main/java/com/moparisthebest/jdbc/UnNestArrayInList.java

33 lines
953 B
Java
Raw Normal View History

2018-05-15 23:32:00 -04:00
package com.moparisthebest.jdbc;
import com.moparisthebest.jdbc.codegen.JdbcMapper;
2018-05-15 23:32:00 -04:00
/**
* HSQLDB requires array in lists to be implemented this way:
* https://stackoverflow.com/questions/35939489/createarrayof-string-in-hsqldb-jdbc-returns-abstractmethoderror/35964424#35964424
*/
public class UnNestArrayInList extends ArrayInList {
private static final InList instance = new UnNestArrayInList();
public static InList instance() {
return instance;
}
public UnNestArrayInList(final String numberType, final String otherType) {
super(numberType, otherType);
}
public UnNestArrayInList() {
this(JdbcMapper.DatabaseType.UNNEST.arrayNumberTypeName, JdbcMapper.DatabaseType.UNNEST.arrayStringTypeName);
2018-05-15 23:32:00 -04:00
}
protected String columnAppendIn(final String columnName) {
2018-05-15 23:32:00 -04:00
return "(" + columnName + " IN(UNNEST(?)))";
}
protected String columnAppendNotIn(final String columnName) {
return "(" + columnName + " NOT IN(UNNEST(?)))";
}
2018-05-15 23:32:00 -04:00
}