| 1 | #!/usr/bin/perl | ||||||||||
| 2 | package SQL::QueryBuilder::Pretty::Handler::DBI::db; | ||||||||||
| 3 | |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 10 | 0 | my $class = shift; | |||||||||
| 11 | 0 | my %self = @_; | |||||||||
| 12 | |||||||||||
| 13 | 0 | my $database = $self{'handler'}->{'Driver'}->{'Name'}; | |||||||||
| 14 | |||||||||||
| 15 | 0 | $class = CORE::join( q{::}, $class, $database ); | |||||||||
| 16 | 0 | ▶ | eval "use $class; 1" or croak $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 0 | return $class->new( %self ); | |||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | =head1 NAME | ||||||||||
| 21 | |||||||||||
| 22 | SQL::QueryBuilder::Pretty::Handler::DBI::db - DBI handler extension for | ||||||||||
| 23 | SQL::QueryBuilder::Pretty. | ||||||||||
| 24 | |||||||||||
| 25 | =head1 VERSION | ||||||||||
| 26 | |||||||||||
| 27 | Version 0.01 | ||||||||||
| 28 | |||||||||||
| 29 | =head1 SYNOPSIS | ||||||||||
| 30 | |||||||||||
| 31 | Directly: | ||||||||||
| 32 | |||||||||||
| 33 | use SQL::QueryBuilder::Pretty::Handler::DBI::db; | ||||||||||
| 34 | |||||||||||
| 35 | my $pretty = SQL::QueryBuilder::Pretty::Handler::DBI::db->new(); | ||||||||||
| 36 | |||||||||||
| 37 | print $pretty->print('SELECT * FROM table WHERE col1 = NOW()'); | ||||||||||
| 38 | |||||||||||
| 39 | or indirecly using SQL::QueryBuilder::Pretty: | ||||||||||
| 40 | |||||||||||
| 41 | use SQL::QueryBuilder::Pretty; | ||||||||||
| 42 | |||||||||||
| 43 | my $pretty = SQL::QueryBuilder::Pretty->new( | ||||||||||
| 44 | '-handler' => $dbh, | ||||||||||
| 45 | ); | ||||||||||
| 46 | |||||||||||
| 47 | print $pretty->print('SELECT * FROM table WHERE col1 = NOW()'); | ||||||||||
| 48 | |||||||||||
| 49 | =head1 DESCRIPTION | ||||||||||
| 50 | |||||||||||
| 51 | L<DBI> handler extension for SQL::QueryBuilder::Pretty. | ||||||||||
| 52 | |||||||||||
| 53 | =over 4 | ||||||||||
| 54 | |||||||||||
| 55 | =item I<PACKAGE>->new(I<%options>) | ||||||||||
| 56 | |||||||||||
| 57 | Initializes the object. | ||||||||||
| 58 | |||||||||||
| 59 | =back | ||||||||||
| 60 | |||||||||||
| 61 | =head1 SEE ALSO | ||||||||||
| 62 | |||||||||||
| 63 | L<SQL::QueryBuilder::Pretty>, L<DBI>. | ||||||||||
| 64 | |||||||||||
| 65 | =head1 AUTHOR | ||||||||||
| 66 | |||||||||||
| 67 | André Rivotti Casimiro, C<< <rivotti at cpan.org> >> | ||||||||||
| 68 | |||||||||||
| 69 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 70 | |||||||||||
| 71 | Copyright (C) 2009 by André Rivotti Casimiro. Published under the terms of | ||||||||||
| 72 | the Artistic License 2.0. | ||||||||||
| 73 | |||||||||||
| 74 | =cut | ||||||||||
| 75 | |||||||||||
| 76 | 1 | 1; | |||||||||