09 Jan 2021 11:35:03 UTC
- Development release
- Distribution: Neo4j-Driver
- Module version: 0.19
- Source (raw)
- Browse (raw)
- How to Contribute
- KwaliteeBus factor: 2
- License: artistic_2
- Perl: v5.10.0
- Download (70.3KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version++ed by:1 non-PAUSE user
- EXPERIMENTAL FEATURES
- SECURITY CONSIDERATIONS
- SEE ALSO
- COPYRIGHT AND LICENSE
Neo4j::Driver::Session - Context of work for database interactions
use Neo4j::Driver; $session = Neo4j::Driver->new->basic_auth(...)->session; # explicit transaction $transaction = $session->begin_transaction; # autocommit transaction $result = $session->run('MATCH (m:Movie) RETURN m.name, m.year');
Provides a context of work for database interactions.
A Session hosts a series of transactions carried out against a database. Within the database, all statements are carried out within a transaction. Within application code, however, it is not always necessary to explicitly begin a transaction. If a statement is run directly against a Session, the server will automatically
COMMITthat statement within its own transaction. This type of transaction is known as an autocommit transaction.
Explicit transactions allow multiple statements to be committed as part of a single atomic operation and can be rolled back if necessary.
Only one open transaction per session at a time is supported. To work with multiple concurrent transactions (also known as "nested transactions"), simply use more than one session.
Neo4j::Driver::Session implements the following methods.
$transaction = $session->begin_transaction;
Begin a new explicit Transaction.
$result = $session->run('...');
Run and commit a statement using an autocommit transaction and return the Result.
This method is semantically exactly equivalent to the following code, but is faster because it doesn't require an extra server roundtrip to commit the transaction.
$transaction = $session->begin_transaction; $result = $transaction->run('...'); $transaction->commit;
$address = $summary->server->address; $version = $summary->server->version;
Obtain the ServerInfo, consisting of the host, port and Neo4j version.
Neo4j::Driver::Session 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.
@records = $session->run('...'); @results = $session->run([...]);
runmethod tries to Do What You Mean if called in list context.
$session = Neo4j::Driver->new('http://...')->basic_auth(...)->session; $tx1 = $session->begin_transaction; $tx2 = $session->begin_transaction; $tx3 = $session->run(...);
Since HTTP is a stateless protocol, the Neo4j HTTP API effectively allows multiple concurrently open transactions without special client-side considerations. This driver exposes this feature to the client and will continue to do so, but the interface is not yet finalised.
The Bolt protocol does not support concurrent transactions within the same session.
Both Session as well as Transaction objects internally hold references to the authentication credentials used to contact the Neo4j server. Objects of these classes should therefore not be passed to untrusted modules. However, objects of the ServerInfo class and the Result class do not contain a reference to these credentials and are safe in this regard.
Arne Johannessen <email@example.com>
This software is Copyright (c) 2016-2021 by Arne Johannessen.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
Module Install Instructions
To install Neo4j::Driver, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell install Neo4j::Driver
For more information on module installation, please visit the detailed CPAN module installation guide.
|s||Focus search bar|
|?||Bring up this help dialog|
|g p||Go to pull requests|
|g i||go to github issues (only if github is preferred repository)|
|g a||Go to author|
|g c||Go to changes|
|g i||Go to issues|
|g d||Go to dist|
|g r||Go to repository/SCM|
|g s||Go to source|
|g b||Go to file browse|