dbMan/Extension/SQLShowResult.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 59 CC 9 SCAR 40.0
CC
9
Cov
0%
handle_action
90.0
IDENTIFICATION
2.0
preference
2.0
CRAP 54.8
1 package DBIx::dbMan::Extension::SQLShowResult;
2  
3 use strict;
4 use base 'DBIx::dbMan::Extension';
5 use Text::FormatTable;
6  
7 our $VERSION = '0.05';
8  
9 1;
10  
11 sub IDENTIFICATION { return "000001-000015-000005"; }
12  
13 sub preference { return 0; }
14  
15 sub known_actions { return [ qw/SQL_RESULT/ ]; }
16  
17 sub handle_action {
18 my ($obj,%action) = @_;
19  
20 $action{processed} = 1;
21 if ($action{action} eq 'SQL_RESULT') {
22 if ($action{type} eq 'select') {
23 $action{action} = 'SQL_OUTPUT';
24 unless ($obj->{-mempool}->get('output_format')) {
25 my @all_formats = $obj->{-mempool}->get_register('output_format');
26 $obj->{-mempool}->set('output_format',$all_formats[0]) if @all_formats;
27 }
28 delete $action{processed};
29 } elsif ($action{type} eq 'do') {
30 if ($action{result} > -1) {
31 $action{action} = 'OUTPUT';
32 if ($action{result} ne '0E0') {
33 $action{output} = "Processed ".$action{result}." line".(($action{result} == 1)?'':'s').".\n" ;
34 } else {
35 $action{output} = "Command processed.\n" ;
36 }
37 } else {
38 $action{action} = 'NONE';
39 }
40 }
41 }
42  
43 return %action;
44 }