Hermios
Hermios

Reputation: 634

neo4j : cypher queries in java give no feedback

I want to send cypher queries in Java. Problem, I have no feedback if I send an action. If I ask for all nodes (for example), eveything works.

But if I want to delete a node, I have no feedback that this was deleted (or not, if for instance I forgot to delete its relationships)

My code :

ExecutionResult result;
        StringBuffer sb=new StringBuffer();
        try ( Transaction tx=graphDB.beginTx())
        {
            try
            {
            result = getInstance()._engine.execute( command );          
                for ( Map<String, Object> row : result )
                {
                    for ( Entry<String, Object> column : row.entrySet() )
                        sb.append(column.getKey() + ": " + column.getValue() + "; ");
                    sb.append(System.lineSeparator());
                }
            }
            catch(SyntaxException se)
            {
                sb.append(se.getLocalizedMessage());
            }
            catch(CypherException ce)
            {
                sb.append(ce.getLocalizedMessage());
            }
        }
        return sb.toString();

Thanks for your help

Upvotes: 0

Views: 61

Answers (1)

Luanne
Luanne

Reputation: 19373

result.getQueryStatistics()

will help. See http://docs.neo4j.org/chunked/stable/javadocs/org/neo4j/cypher/javacompat/QueryStatistics.html

Upvotes: 1

Related Questions