File Coverage

blib/lib/Fey/Role/SQL/HasBindParams.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Fey::Role::SQL::HasBindParams;
2              
3 27     27   19215 use strict;
  27         59  
  27         1189  
4 27     27   141 use warnings;
  27         48  
  27         891  
5 27     27   147 use namespace::autoclean;
  27         44  
  27         231  
6              
7             our $VERSION = '0.43';
8              
9 27     27   2891 use Fey::Types qw( ArrayRef Bool );
  27         91  
  27         232  
10              
11 27     27   118557 use Moose::Role;
  27         52  
  27         255  
12              
13             has '_bind_params' => (
14             traits => ['Array'],
15             is => 'ro',
16             isa => ArrayRef,
17             default => sub { [] },
18             handles => { _add_bind_param => 'push' },
19             init_arg => undef,
20             );
21              
22             has 'auto_placeholders' => (
23             is => 'ro',
24             isa => Bool,
25             default => 1,
26             );
27              
28             # This needs to be a method and not a delegated method so it can be excluded
29             # by classes which need to exclude it.
30             sub bind_params {
31 11     11 1 658 return @{ $_[0]->_bind_params() };
  11         390  
32             }
33              
34             1;
35              
36             # ABSTRACT: A role for queries which can have bind parameters
37              
38             __END__
39              
40             =pod
41              
42             =head1 NAME
43              
44             Fey::Role::SQL::HasBindParams - A role for queries which can have bind parameters
45              
46             =head1 VERSION
47              
48             version 0.43
49              
50             =head1 SYNOPSIS
51              
52             use Moose 2.1200;
53              
54             with 'Fey::Role::SQL::HasBindParams';
55              
56             =head1 DESCRIPTION
57              
58             Classes which do this role represent a query which can have bind
59             parameters.
60              
61             =head1 METHODS
62              
63             This role provides the following methods:
64              
65             =head2 $query->bind_params()
66              
67             Returns the bind params associated with the query.
68              
69             =head2 $query->auto_placeholders()
70              
71             This attribute determines whether values are automatically turned into
72             placeholders and stored as bind parameters.
73              
74             =head1 BUGS
75              
76             See L<Fey> for details on how to report bugs.
77              
78             =head1 AUTHOR
79              
80             Dave Rolsky <autarch@urth.org>
81              
82             =head1 COPYRIGHT AND LICENSE
83              
84             This software is Copyright (c) 2011 - 2015 by Dave Rolsky.
85              
86             This is free software, licensed under:
87              
88             The Artistic License 2.0 (GPL Compatible)
89              
90             =cut