File Coverage

blib/lib/SQL/Concrete/Dollars.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 32 32 100.0


line stmt bran cond sub pod time code
1 1     1   914 use 5.006;
  1         4  
  1         52  
2 1     1   7 use strict;
  1         2  
  1         50  
3 1     1   7 use warnings;
  1         2  
  1         88  
4              
5             package SQL::Concrete::Dollars;
6             $SQL::Concrete::Dollars::VERSION = '1.003';
7             # ABSTRACT: use SQL::Concrete with dollar placeholders
8              
9 1     1   20 use SQL::Concrete ':noncore';
  1         3  
  1         7  
10 1     1   347 BEGIN { our @ISA = 'SQL::Concrete' } # inherit import()
11              
12 3     3 1 2800 sub sql_render { SQL::Concrete::Renderer::Dollars->new->render( @_ ) }
13              
14             package SQL::Concrete::Renderer::Dollars;
15             $SQL::Concrete::Renderer::Dollars::VERSION = '1.003';
16 1     1   182 BEGIN { our @ISA = 'SQL::Concrete::Renderer' }
17              
18             sub render {
19 3     3   4 my $self = shift;
20 3         20 local $self->{'placeholder_id'} = 0;
21 3         16 $self->SUPER::render( @_ );
22             }
23              
24             sub render_bind {
25 8     8   10 my $self = shift;
26 8         8 push @{ $self->{'bind'} }, $_[0];
  8         20  
27 8         42 '$'.++$self->{'placeholder_id'};
28             }
29              
30             1;
31              
32             __END__