When using SQL prepared statements, passing an empty List or Set will cause 
an OStorageException to be raised (caused by a inner 
NoSuchElementException).

This will crash:
OrientGraph db = ...
String sql = "SELECT FROM MyUsers WHERE username NOT IN :usernames";
Map<String, Object> queryParams= new HashMap<>();            
queryParams.put("usernames", new HashSet<String>());

Iterable<Vertex> results = ((Iterable<Vertex>)                     
    db.command(new OSQLSynchQuery<>(sql))
        .execute(queryParams));

Instead of crashing, I would've expected the output SQL command to be:
SELECT FROM MyUsers WHERE username NOT IN []

As soon as there is a value, the crash does not occur.
OrientGraph db = ...
String sql = "SELECT FROM MyUsers WHERE username NOT IN :usernames";
Map<String, Object> queryParams= new HashMap<>();            
queryParams.put("usernames", new HashSet<String>() {{ add("test"); }});

Iterable<Vertex> results = ((Iterable<Vertex>)                     
    db.command(new OSQLSynchQuery<>(sql))
        .execute(queryParams));
(the above works fine)

Can this be fixed?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to