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   764 use Mojo::Base -base;
  2         3  
  2         16  
3              
4 2     2   309 use Carp 'croak';
  2         2  
  2         778  
5              
6             has 'dbi';
7              
8             sub show_primary_keys {
9 6     6 0 409 my ($self, $database) = @_;
10              
11 6         30 my $tables = $self->show_tables($database);
12 6         13 my $primary_keys = {};
13 6         12 for my $table (@$tables) {
14 18         51 my $primary_key = $self->show_primary_key($database, $table);
15 18         51 $primary_keys->{$table} = $primary_key;
16             }
17 6         15 return $primary_keys;
18             }
19              
20             sub show_null_allowed_columns {
21 6     6 0 412 my ($self, $database) = @_;
22 6         30 my $tables = $self->show_tables($database);
23 6         14 my $null_allowed_columns = {};
24            
25 6         17 for my $table (@$tables) {
26 18         51 my $null_allowed_column = $self->show_null_allowed_column($database, $table);
27 18         41 $null_allowed_columns->{$table} = $null_allowed_column;
28             }
29 6         17 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 3445838 my ($self, $c) = @_;
49 85         336 my $params = $c->req->params->to_hash;
50 85         21229 return $params;
51             }
52              
53             1;