File Coverage

blib/lib/URI/mssql.pm
Criterion Covered Total %
statement 13 13 100.0
branch 8 10 80.0
condition n/a
subroutine 4 4 100.0
pod 2 3 66.6
total 27 30 90.0


line stmt bran cond sub pod time code
1             package URI::mssql;
2 2     2   2508 use base 'URI::_odbc';
  2         5  
  2         919  
3             our $VERSION = '0.20';
4              
5 40     40 1 15107 sub default_port { 1433 }
6 40     40 0 16358 sub canonical_engine { 'mssql' }
7              
8             sub dbi_dsn {
9 23     23 1 7456 my $self = shift;
10 23 100       52 my $driver = shift or return $self->SUPER::dbi_dsn;
11 16         26 my $lcd = lc $driver;
12 16 100       29 return $self->SUPER::dbi_dsn if $lcd eq 'odbc';
13              
14 13 50       26 my $class = $lcd eq 'ado' ? 'URI::_ado'
    100          
15             : $lcd eq 'sybase' ? 'URI::sybase'
16             : die "Unknown driver: $driver\n";
17              
18 13 50       555 eval "require $class" or die;
19              
20             # Make a copy blessed into the alternate class to get its DSN.
21 13         53 my $alt = bless \"$self" => $class;
22 13         89 return $alt->dbi_dsn;
23             }
24              
25             1;
26              
27             =head1 Name
28              
29             URI::mssql - Microsoft SQL Server database URI
30              
31             =head1 Description
32              
33             L format for Microsoft SQL Server.
34              
35             =head1 Interface
36              
37             The following differences exist compared to the C interface:
38              
39             =head2 Instance Methods
40              
41             =head3 C
42              
43             my $dsn = $uri->dbi_dsn;
44             $dsn = $uri->dbi_dsn($driver);
45              
46             Extends the implementation of C to support a driver argument. By
47             default, C returns a DSN appropriate for use with L. Pass
48             "sybase" or "ado" to instead get a DSN appropriate to L or
49             L, respectively. Note that DBD::ADO value is experimental and
50             subject to change. L.
51              
52             =cut