Skip to content

Commit

Permalink
Fix automatic conversion of types in IN condition
Browse files Browse the repository at this point in the history
Resolves: #8428
  • Loading branch information
luigidellaquila committed Aug 2, 2018
1 parent 55633ba commit abaa81a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@
import com.orientechnologies.common.log.OLogManager;
import com.orientechnologies.common.types.OBinary;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
import com.orientechnologies.orient.core.db.record.ORecordLazyList;
import com.orientechnologies.orient.core.db.record.ORecordLazyMap;
import com.orientechnologies.orient.core.db.record.ORecordLazySet;
import com.orientechnologies.orient.core.db.record.OTrackedList;
import com.orientechnologies.orient.core.db.record.OTrackedMap;
import com.orientechnologies.orient.core.db.record.OTrackedSet;
import com.orientechnologies.orient.core.db.record.*;
import com.orientechnologies.orient.core.db.record.ridbag.ORidBag;
import com.orientechnologies.orient.core.id.ORID;
import com.orientechnologies.orient.core.id.ORecordId;
Expand All @@ -44,20 +38,11 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;

/**
* Generic representation of a type.<br>
* allowAssignmentFrom accepts any class, but Array.class means that the type accepts generic Arrays.
* Generic representation of a type.<br> allowAssignmentFrom accepts any class, but Array.class means that the type accepts generic
* Arrays.
*
* @author Luca Garulli (l.garulli--(at)--orientdb.com)
*/
Expand Down Expand Up @@ -457,6 +442,10 @@ else if (((String) iValue).equalsIgnoreCase("false"))
}
}
} else if (iTargetClass.equals(String.class)) {
if (iValue instanceof Collection && ((Collection) iValue).size() == 1 && ((Collection) iValue).iterator()
.next() instanceof String) {
return ((Collection) iValue).iterator().next();
}
return iValue.toString();
} else if (iTargetClass.equals(OIdentifiable.class)) {
if (OMultiValue.isMultiValue(iValue)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ protected static Object executeQuery(OSelectStatement rightStatement, OCommandCo

protected static boolean evaluateExpression(final Object iLeft, final Object iRight) {
if (OMultiValue.isMultiValue(iRight)) {
if (iRight instanceof Set<?>)
return ((Set) iRight).contains(iLeft);
if (iRight instanceof Set && ((Set) iRight).contains(iLeft)) {
return true;
}

for (final Object o : OMultiValue.getMultiValueIterable(iRight, false)) {
if (OQueryOperatorEquals.equals(iLeft, o))
Expand Down

0 comments on commit abaa81a

Please sign in to comment.