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?