Fey/FakeDBI.pm

filter: Statementstmt 100% 15 / 15 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 91.3% 21 / 23 CC 2 SCAR 3.4
CC
2
Cov
100%
quote_identifier
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« Fey/Table/Alias.pm ↑ Summary Fey/Role/Joinable.pm »
1 package Fey::FakeDBI;
2  
3 28 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 28 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 28 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 15 ▶ shift;
Subroutine quote_identifier: called CC=2 SCAR=6.9
Pod undocumented
14  
15 15 ▶ if ( @_ == 3 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 3) { } 7 8 15
16 7 return q{"} . $_[1] . q{"} . q{.} . q{"} . $_[2] . q{"};
17 }
18 else {
19  
20 8 return q{"} . $_[0] . q{"};
21 }
22 }
23  
24 sub quote {
25 2 ▶ my $text = $_[1];
Subroutine quote: called CC=1 SCAR=0.0
Pod undocumented
26  
27 2 $text =~ s/"/""/g;
28 2 return q{"} . $text . q{"};
29 }
30  
31 28 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
« Fey/Table/Alias.pm ↑ Summary Fey/Role/Joinable.pm »