NAME

Neo4j::Driver::StatementResult - Result of running a Cypher statement (a list of records)

VERSION

version 0.09

SYNOPSIS

use Neo4j::Driver;
my $session = Neo4j::Driver->new->basic_auth(...)->session;

my $result = $session->run('MATCH (m:Movie) RETURN m.name, m.year');
my $record_count = $result->size;
my @records = @{ $result->list };

my $query = 'MATCH (m:Movie) WHERE id(m) = {id} RETURN m.name';
my $name = $session->run($query, id => 12)->single->get('m.name');

DESCRIPTION

The result of running a Cypher statement, conceptually a list of records. The standard way of navigating through the result returned by the database is to iterate over the list it provides. Results are valid indefinitely.

METHODS

Neo4j::Driver::StatementResult implements the following methods.

keys

my @keys = @{ $result->keys };

Retrieve the column names of the records this result contains.

list

my @records = @{ $result->list };

Return the entire list of all Records in the result.

single

my $name = $session->run('... LIMIT 1')->single->get('name');

Return the single Record in the result, failing if there is not exactly one record in the result.

size

my $record_count = $result->size;

Return the count of records in the result.

summary

my $result_summary = $result->summary;

Return a Neo4j::Driver::ResultSummary object.

The summary method will fail unless the transaction has been modified to request statistics before the statement was run.

my $transaction = $session->begin_transaction;
$transaction->{return_stats} = 1;
my $result = $transaction->run('...');

As a special case, Records returned by the single method also have a summary method that works the same way.

my $record = $transaction->run('...')->single;
my $result_summary = $record->summary;

EXPERIMENTAL FEATURES

Neo4j::Driver::StatementResult implements the following experimental features. These are subject to unannounced modification or removal in future versions. Expect your code to break if you depend upon these features.

Calling in list context

my @keys = $result->keys;
my @records = $result->list;

The keys and list methods try to Do What You Mean if called in list context.

SEE ALSO

Neo4j::Driver, Neo4j::Driver::Record, Neo4j::Driver::ResultSummary, Neo4j Java Driver, Neo4j JavaScript Driver, Neo4j .NET Driver

AUTHOR

Arne Johannessen <ajnn@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016-2018 by Arne Johannessen.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)