Have InList sql always be wrapped by parens

This commit is contained in:
Travis Burtrum 2015-05-01 09:45:51 -04:00
parent 430b4eab76
commit 95dcf6722c
2 changed files with 5 additions and 5 deletions

View File

@ -19,8 +19,8 @@ public class ArrayInList implements InList {
protected ArrayInList() { protected ArrayInList() {
} }
protected String columnAppend() { protected String columnAppend(final String columnName) {
return " = ANY(?)"; return "(" + columnName + " = ANY(?))";
} }
protected <T> Array toArray(final Connection conn, final Collection<T> values) throws SQLException { protected <T> Array toArray(final Connection conn, final Collection<T> values) throws SQLException {
@ -32,7 +32,7 @@ public class ArrayInList implements InList {
public <T> InListObject inList(final Connection conn, final String columnName, final Collection<T> values) throws SQLException { public <T> InListObject inList(final Connection conn, final String columnName, final Collection<T> values) throws SQLException {
return values == null || values.isEmpty() ? InListObject.empty : new ArrayListObject( return values == null || values.isEmpty() ? InListObject.empty : new ArrayListObject(
columnName + columnAppend(), columnAppend(columnName),
toArray(conn, values) toArray(conn, values)
); );
} }

View File

@ -37,8 +37,8 @@ public class OracleArrayInList extends ArrayInList {
protected OracleArrayInList() { protected OracleArrayInList() {
} }
protected String columnAppend() { protected String columnAppend(final String columnName) {
return " IN(select column_value from table(?))"; return "(" + columnName + " IN(select column_value from table(?)))";
} }
protected <T> Array toArray(final Connection conn, final Collection<T> values) throws SQLException { protected <T> Array toArray(final Connection conn, final Collection<T> values) throws SQLException {