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   610 use 5.006;
  1         2  
  1         32  
2 1     1   3 use strict;
  1         2  
  1         24  
3 1     1   4 use warnings;
  1         1  
  1         43  
4              
5             package SQL::Concrete::Dollars;
6             $SQL::Concrete::Dollars::VERSION = '1.002';
7             # ABSTRACT: use SQL::Concrete with dollar placeholders
8              
9 1     1   23 use SQL::Concrete ':noncore';
  1         2  
  1         6  
10 1     1   221 BEGIN { our @ISA = 'SQL::Concrete' } # inherit import()
11              
12 3     3 1 1748 sub sql_render { SQL::Concrete::Renderer::Dollars->new->render( @_ ) }
13              
14             package SQL::Concrete::Renderer::Dollars;
15             $SQL::Concrete::Renderer::Dollars::VERSION = '1.002';
16 1     1   88 BEGIN { our @ISA = 'SQL::Concrete::Renderer' }
17              
18             sub render {
19 3     3   5 my $self = shift;
20 3         18 local $self->{'placeholder_id'} = 0;
21 3         12 $self->SUPER::render( @_ );
22             }
23              
24             sub render_bind {
25 8     8   10 my $self = shift;
26 8         5 push @{ $self->{'bind'} }, $_[0];
  8         15  
27 8         31 '$'.++$self->{'placeholder_id'};
28             }
29              
30             1;
31              
32             __END__