| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBD::Cassandra::db; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TVDW'; |
|
3
|
|
|
|
|
|
|
$DBD::Cassandra::db::VERSION = '0.57'; |
|
4
|
|
|
|
|
|
|
# ABSTRACT: DBD::Cassandra database handle |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
13
|
use 5.010; |
|
|
1
|
|
|
|
|
2
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
3
|
use Devel::GlobalDestruction; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# This cargocult comes straight from DBI::DBD docs. No idea what it does. |
|
13
|
|
|
|
|
|
|
$DBD::Cassandra::db::imp_data_size = 0; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub prepare { |
|
16
|
0
|
|
|
0
|
0
|
|
my ($dbh, $statement, $attribs)= @_; |
|
17
|
|
|
|
|
|
|
|
|
18
|
0
|
0
|
|
|
|
|
if ($attribs->{server_side_prepare}) { |
|
19
|
0
|
|
|
|
|
|
my $client= $dbh->{cass_client}; |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my ($error)= $client->call_prepare($statement); |
|
22
|
0
|
0
|
|
|
|
|
if ($error) { |
|
23
|
0
|
|
|
|
|
|
return $dbh->set_err($DBI::stderr, $error); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my ($outer, $sth)= DBI::_new_sth($dbh, { Statement => $statement }); |
|
28
|
0
|
|
0
|
|
|
|
$sth->{cass_consistency}= $attribs->{consistency} || $attribs->{Consistency}; |
|
29
|
0
|
|
0
|
|
|
|
$sth->{cass_page_size}= $attribs->{perpage} || $attribs->{PerPage} || $attribs->{per_page}; |
|
30
|
0
|
|
|
|
|
|
$sth->{cass_async}= $attribs->{async}; |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
return $outer; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub commit { |
|
36
|
0
|
|
|
0
|
0
|
|
my ($dbh)= @_; |
|
37
|
0
|
0
|
|
|
|
|
if ($dbh->FETCH('Warn')) { |
|
38
|
0
|
|
|
|
|
|
warn "Commit ineffective while AutoCommit is on"; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
0
|
|
|
|
|
|
0; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub rollback { |
|
44
|
0
|
|
|
0
|
0
|
|
my ($dbh)= @_; |
|
45
|
0
|
0
|
|
|
|
|
if ($dbh->FETCH('Warn')) { |
|
46
|
0
|
|
|
|
|
|
warn "Rollback ineffective while AutoCommit is on"; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
0
|
|
|
|
|
|
0; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub STORE { |
|
52
|
0
|
|
|
0
|
|
|
my ($dbh, $attr, $val)= @_; |
|
53
|
0
|
0
|
|
|
|
|
if ($attr eq 'AutoCommit') { |
|
54
|
0
|
0
|
|
|
|
|
if (!$val) { die "DBD::Cassandra does not support transactions"; } |
|
|
0
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return 1; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
0
|
0
|
|
|
|
|
if ($attr =~ m/\Acass_/) { |
|
58
|
0
|
|
|
|
|
|
$dbh->{$attr}= $val; |
|
59
|
0
|
|
|
|
|
|
return 1; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
0
|
|
|
|
|
|
return $dbh->SUPER::STORE($attr, $val); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub FETCH { |
|
65
|
0
|
|
|
0
|
|
|
my ($dbh, $attr)= @_; |
|
66
|
0
|
0
|
|
|
|
|
return 1 if $attr eq 'AutoCommit'; |
|
67
|
0
|
0
|
|
|
|
|
return $dbh->{$attr} if $attr =~ m/\Acass_/; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Sort of a workaround for unrecoverable errors in st.pm |
|
70
|
0
|
0
|
|
|
|
|
if ($attr eq 'Active') { |
|
71
|
0
|
|
|
|
|
|
return $dbh->{cass_client}->is_active; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
0
|
|
|
|
|
|
return $dbh->SUPER::FETCH($attr); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub disconnect { |
|
77
|
0
|
|
|
0
|
0
|
|
my ($dbh)= @_; |
|
78
|
0
|
|
|
|
|
|
$dbh->STORE('Active', 0); |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
return if in_global_destruction; |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$dbh->{cass_client}->shutdown; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub ping { |
|
86
|
0
|
|
|
0
|
0
|
|
my ($dbh)= @_; |
|
87
|
0
|
|
|
|
|
|
return $dbh->FETCH('Active'); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub x_wait_for_schema_agreement { |
|
91
|
0
|
|
|
0
|
0
|
|
my ($dbh)= @_; |
|
92
|
0
|
|
|
|
|
|
my ($error)= $dbh->{cass_client}->call_wait_for_schema_agreement; |
|
93
|
0
|
0
|
|
|
|
|
if ($error) { |
|
94
|
0
|
|
|
|
|
|
return $dbh->set_err($DBI::stderr, $error); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
0
|
|
|
|
|
|
return 1; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |