File Coverage

blib/lib/Mojolicious/Plugin/DBViewer/Command.pm
Criterion Covered Total %
statement 23 31 74.1
branch n/a
condition n/a
subroutine 5 7 71.4
pod 0 5 0.0
total 28 43 65.1


line stmt bran cond sub pod time code
1             package Mojolicious::Plugin::DBViewer::Command;
2 2     2   1302 use Mojo::Base -base;
  2         5  
  2         17  
3              
4 2     2   357 use Carp 'croak';
  2         36  
  2         1088  
5              
6             has 'dbi';
7              
8             sub show_primary_keys {
9 6     6 0 649 my ($self, $database) = @_;
10              
11 6         43 my $tables = $self->show_tables($database);
12 6         23 my $primary_keys = {};
13 6         25 for my $table (@$tables) {
14 18         80 my $primary_key = $self->show_primary_key($database, $table);
15 18         75 $primary_keys->{$table} = $primary_key;
16             }
17 6         27 return $primary_keys;
18             }
19              
20             sub show_null_allowed_columns {
21 6     6 0 607 my ($self, $database) = @_;
22 6         39 my $tables = $self->show_tables($database);
23 6         29 my $null_allowed_columns = {};
24            
25 6         22 for my $table (@$tables) {
26 18         70 my $null_allowed_column = $self->show_null_allowed_column($database, $table);
27 18         63 $null_allowed_columns->{$table} = $null_allowed_column;
28             }
29 6         26 return $null_allowed_columns;
30             }
31              
32 0     0 0 0 sub show_null_allowed_column { croak "Unimplemented" }
33              
34             sub show_database_engines {
35 0     0 0 0 my ($self, $database) = @_;
36            
37 0         0 my $tables = $self->show_tables($database);
38 0         0 my $database_engines = {};
39 0         0 for my $table (@$tables) {
40 0         0 my $database_engine = $self->show_database_engine($database, $table);
41 0         0 $database_engines->{$table} = $database_engine;
42             }
43            
44 0         0 return $database_engines;
45             }
46              
47             sub params {
48 85     85 0 5384998 my ($self, $c) = @_;
49 85         401 my $params = $c->req->params->to_hash;
50 85         33282 return $params;
51             }
52              
53             1;