File Coverage

blib/lib/Fey/FakeDBI.pm
Criterion Covered Total %
statement 10 14 71.4
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 2 0.0
total 14 23 60.8


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