line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
17
|
|
|
17
|
|
309
|
use 5.010; |
|
17
|
|
|
|
|
50
|
|
2
|
17
|
|
|
17
|
|
101
|
use strict; |
|
17
|
|
|
|
|
30
|
|
|
17
|
|
|
|
|
406
|
|
3
|
17
|
|
|
17
|
|
88
|
use warnings; |
|
17
|
|
|
|
|
27
|
|
|
17
|
|
|
|
|
550
|
|
4
|
17
|
|
|
17
|
|
100
|
use utf8; |
|
17
|
|
|
|
|
29
|
|
|
17
|
|
|
|
|
128
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Neo4j::Driver::ServerInfo; |
7
|
|
|
|
|
|
|
# ABSTRACT: Provides Neo4j server address and version |
8
|
|
|
|
|
|
|
$Neo4j::Driver::ServerInfo::VERSION = '0.39'; |
9
|
|
|
|
|
|
|
|
10
|
17
|
|
|
17
|
|
1039
|
use Carp qw(croak); |
|
17
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
1326
|
|
11
|
|
|
|
|
|
|
our @CARP_NOT = qw(Neo4j::Driver::Session); |
12
|
17
|
|
|
17
|
|
147
|
use URI 1.25; |
|
17
|
|
|
|
|
252
|
|
|
17
|
|
|
|
|
7561
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
|
|
|
|
|
|
# uncoverable pod (private method) |
17
|
84
|
|
|
84
|
0
|
19904
|
my ($class, $server_info) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# don't store the full URI here - it may contain auth credentials |
20
|
84
|
|
|
|
|
351
|
$server_info->{uri} = URI->new( $server_info->{uri} )->host_port; |
21
|
|
|
|
|
|
|
|
22
|
84
|
|
|
|
|
9409
|
return bless $server_info, $class; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
1
|
847
|
sub address { shift->{uri} } |
27
|
169
|
|
|
169
|
1
|
2410
|
sub agent { shift->{version} } |
28
|
4
|
|
|
4
|
1
|
1343
|
sub version { shift->{version} } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub protocol_version { |
32
|
|
|
|
|
|
|
shift->{protocol} |
33
|
3
|
|
|
3
|
1
|
2168
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub protocol { |
37
|
|
|
|
|
|
|
# uncoverable pod (see Deprecations.pod) |
38
|
4
|
|
|
4
|
0
|
2293
|
my ($self) = @_; |
39
|
4
|
|
|
|
|
62
|
warnings::warnif deprecated => __PACKAGE__ . "->protocol() is deprecated; use protocol_version() instead"; |
40
|
4
|
|
|
|
|
1050
|
my $bolt_version = $self->{protocol}; |
41
|
4
|
100
|
|
|
|
16
|
return "Bolt/$bolt_version" if $bolt_version; |
42
|
3
|
100
|
|
|
|
16
|
return defined $bolt_version ? "Bolt" : "HTTP"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# discover default database on Neo4j >= 4 using the given driver config |
47
|
|
|
|
|
|
|
sub _default_database { |
48
|
83
|
|
|
83
|
|
2670
|
my ($self, $driver) = @_; |
49
|
|
|
|
|
|
|
|
50
|
83
|
|
|
|
|
157
|
my $database = $self->{default_database}; |
51
|
83
|
100
|
|
|
|
317
|
return $database if defined $database; |
52
|
|
|
|
|
|
|
|
53
|
51
|
100
|
|
|
|
224
|
return if $self->{version} =~ m{^Neo4j/[123]\.}; |
54
|
47
|
|
|
|
|
99
|
eval { |
55
|
47
|
|
|
|
|
206
|
my $sys = $driver->session(database => 'system'); |
56
|
47
|
|
|
|
|
228
|
$database = $sys->run('SHOW DEFAULT DATABASE')->single->get('name'); |
57
|
|
|
|
|
|
|
}; |
58
|
47
|
100
|
|
|
|
6252
|
croak $@ . "Session creation failed because the default " |
59
|
|
|
|
|
|
|
. "database of $self->{version} at $self->{uri} " |
60
|
|
|
|
|
|
|
. "could not be determined" unless defined $database; |
61
|
44
|
|
|
|
|
176
|
return $self->{default_database} = $database; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |