| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Gnats::Command::CHDB; |
|
2
|
40
|
|
|
40
|
|
193
|
use parent 'Net::Gnats::Command'; |
|
|
40
|
|
|
|
|
70
|
|
|
|
40
|
|
|
|
|
209
|
|
|
3
|
40
|
|
|
40
|
|
2101
|
use strictures; |
|
|
40
|
|
|
|
|
79
|
|
|
|
40
|
|
|
|
|
202
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
|
5
|
40
|
|
|
40
|
|
8722
|
$Net::Gnats::Command::CHDB::VERSION = '0.22'; |
|
6
|
|
|
|
|
|
|
} |
|
7
|
40
|
|
|
40
|
|
214
|
use vars qw($VERSION); |
|
|
40
|
|
|
|
|
72
|
|
|
|
40
|
|
|
|
|
1571
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
40
|
|
|
40
|
|
293
|
use Net::Gnats::Constants qw(CODE_OK CODE_NO_ACCESS CODE_INVALID_DATABASE); |
|
|
40
|
|
|
|
|
75
|
|
|
|
40
|
|
|
|
|
9626
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Net::Gnats::Command::CHDB |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Switches the current database to the name specified in the command. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 PROTOCOL |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
CHDB [database] |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 RESPONSES |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
The possible responses are: |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
422 (CODE_NO_ACCESS) |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
The user does not have permission to access the requested database. |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
417 (CODE_INVALID_DATABASE) |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
The database specified does not exist, or one or more configuration |
|
34
|
|
|
|
|
|
|
errors in the database were encountered. |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
210 (CODE_OK) |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
The current database is now database. Any operations performed will |
|
39
|
|
|
|
|
|
|
now be applied to database. |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
my $c = 'CHDB'; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
|
46
|
2
|
|
|
2
|
1
|
6
|
my ( $class, %options ) = @_; |
|
47
|
2
|
|
|
|
|
5
|
my $self = bless \%options, $class; |
|
48
|
2
|
|
|
|
|
8
|
return $self; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub as_string { |
|
52
|
3
|
|
|
3
|
1
|
7
|
my ($self) = @_; |
|
53
|
3
|
100
|
|
|
|
23
|
return undef if not defined $self->{database}; |
|
54
|
2
|
|
|
|
|
11
|
return $c . ' ' . $self->{database}; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub is_ok { |
|
58
|
2
|
|
|
2
|
0
|
4
|
my ($self) = @_; |
|
59
|
|
|
|
|
|
|
# command not issued yet |
|
60
|
2
|
100
|
|
|
|
11
|
return 0 if not defined $self->response; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# command received malformed response |
|
63
|
1
|
50
|
|
|
|
4
|
return 0 if not defined $self->response->code; |
|
64
|
1
|
50
|
|
|
|
5
|
return 1 if $self->response->code == CODE_OK; |
|
65
|
0
|
|
|
|
|
|
return 0; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |