File Coverage

blib/lib/Fey/FakeDBI.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 4 4 100.0
pod 0 2 0.0
total 19 21 90.4


line stmt bran cond sub pod time code
1             package Fey::FakeDBI;
2              
3 29     29   26384 use strict;
  29         41  
  29         1163  
4 29     29   121 use warnings;
  29         37  
  29         4235  
5              
6             our $VERSION = '0.42';
7              
8             # This package allows us to use a DBI handle in id(). Even though we
9             # may not be quoting properly for a given DBMS, we will still generate
10             # unique ids, and that's all that matters.
11              
12             sub quote_identifier {
13 21     21 0 29 shift;
14              
15 21 100       48 if ( @_ == 3 ) {
16 12         60 return q{"} . $_[1] . q{"} . q{.} . q{"} . $_[2] . q{"};
17             }
18             else {
19              
20 9         34 return q{"} . $_[0] . q{"};
21             }
22             }
23              
24             sub quote {
25 2     2 0 17 my $text = $_[1];
26              
27 2         11 $text =~ s/"/""/g;
28 2         18 return q{"} . $text . q{"};
29             }
30              
31             1;
32              
33             # ABSTRACT: Just enough of the DBI API to fool Fey
34              
35             __END__
36              
37             =pod
38              
39             =head1 NAME
40              
41             Fey::FakeDBI - Just enough of the DBI API to fool Fey
42              
43             =head1 VERSION
44              
45             version 0.42
46              
47             =head1 SYNOPSIS
48              
49             my $select = Fey::SQL->new_select();
50              
51             $select->select(...)->where(...);
52              
53             print $select->sql( 'Fey::FakeDBI' );
54              
55             =head1 DESCRIPTION
56              
57             This class provides just enough of the C<DBI> API to use when Fey
58             needs a C<DBI> object for quoting SQL statements. It implements the
59             C<quote()> and C<quote_identifier()> methods only.
60              
61             It exists solely to allow some internal API re-use for Fey, and you
62             should never need to use it explicitly.
63              
64             =head1 BUGS
65              
66             See L<Fey> for details on how to report bugs.
67              
68             =head1 AUTHOR
69              
70             Dave Rolsky <autarch@urth.org>
71              
72             =head1 COPYRIGHT AND LICENSE
73              
74             This software is Copyright (c) 2011 - 2015 by Dave Rolsky.
75              
76             This is free software, licensed under:
77              
78             The Artistic License 2.0 (GPL Compatible)
79              
80             =cut