File Coverage

blib/lib/SQL/Maker/SQLType.pm
Criterion Covered Total %
statement 19 28 67.8
branch 1 4 25.0
condition n/a
subroutine 8 10 80.0
pod 0 6 0.0
total 28 48 58.3


line stmt bran cond sub pod time code
1             package SQL::Maker::SQLType;
2 3     3   46431 use strict;
  3         7  
  3         100  
3 3     3   10 use warnings;
  3         4  
  3         65  
4 3     3   1558 use utf8;
  3         28  
  3         11  
5 3     3   102 use Exporter qw/import/;
  3         5  
  3         669  
6              
7             our @EXPORT_OK = qw/sql_type/;
8              
9             sub sql_type {
10 1     1 0 10 my ($value_ref, $type) = @_;
11 1         8 SQL::Maker::SQLType->new(value_ref => $value_ref, type => $type);
12             }
13              
14             sub new {
15 1     1 0 3 my $class = shift;
16 1 50       6 my %args = @_==1 ? %{$_[0]} : @_;
  0         0  
17 1         9 bless {%args}, $class;
18             }
19              
20 1     1 0 460 sub value_ref { $_[0]->{value_ref} }
21 1     1 0 6 sub type { $_[0]->{type} }
22              
23             sub as_sql {
24 0     0 0   my ($self, $supplied_colname, $quote_cb) = @_;
25 0           my $stmt;
26 0 0         if (defined $supplied_colname) {
27 0           $stmt = $quote_cb->($supplied_colname) . ' = ?';
28             } else {
29 0           $stmt = '?';
30             }
31 0           return $stmt;
32             }
33              
34             sub bind {
35 0     0 0   my $self = shift;
36 0           return $self;
37             }
38              
39             1;
40             __END__