dbMan/Extension/LineNumbers.pm untested

filter: Statementstmt 0.0% 0 / 27 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 48 CC 2 SCAR 11.5
CC
2
Cov
0%
handle_action
6.0
IDENTIFICATION
2.0
preference
2.0
CRAP 3.1
1 package DBIx::dbMan::Extension::LineNumbers;
2  
3 use strict;
4 use base 'DBIx::dbMan::Extension';
5  
6 our $VERSION = '0.02';
7  
8 1;
9  
10 sub IDENTIFICATION { return "000001-000076-000002"; }
11  
12 sub preference { return 30; }
13  
14 sub known_actions { return [ qw/SQL_OUTPUT/ ]; }
15  
16 sub handle_action {
17 my ($obj,%action) = @_;
18  
19 $action{processed} = 1;
20 if ($action{action} eq 'SQL_OUTPUT' and $obj->{-mempool}->get('line_numbers') and $obj->{-mempool}->get('output_format') ne 'insert') {
21 my $i = 0;
22 for my $line (@{$action{result}}) {
23 $line = [ ++$i, @$line ];
24 }
25 $action{fieldnames} = [ '#', @{$action{fieldnames}} ];
26 $action{fieldtypes} = [ -9999, @{$action{fieldtypes}} ];
27 }
28  
29 return %action;
30 }