diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py index 42bb4b4e734c08c19e847c56f4a787425004ca9b..eaf63d6ffa598d1746961433c8733bebe452fa2e 100644 --- a/product/ZSQLCatalog/SQLCatalog.py +++ b/product/ZSQLCatalog/SQLCatalog.py @@ -336,7 +336,7 @@ class Query(QueryMixin): elif range_value == 'nlt' : where_expression.append("%s > %s" % (key, query_max)) elif isSimpleType(value) or isinstance(value, DateTime) \ - or isinstance(value, (list, tuple)): + or (isinstance(value, (list, tuple)) and self.operator.upper() != 'IN'): # Convert into lists any value which contain a ; # Refer to _listGlobalActions DCWorkflow patch # for example of use @@ -398,6 +398,10 @@ class Query(QueryMixin): elif value is None: where_expression.append("%s is NULL" % (key)) + elif isinstance(value, (tuple, list)) and self.operator.upper() == 'IN': + escaped_value_list = [self._quoteSQLString(x) for x in value] + escaped_value_string = ', '.join(escaped_value_list) + where_expression.append("%s IN (%s)" % (key, escaped_value_string)) else: where_expression.append("%s = %s" % (self._quoteSQLKey(key), self._quoteSQLString(value)))