infect the storage subdrivers
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI / MSSQL.pm
1 package DBIx::Class::Storage::DBI::MSSQL;
2
3 use strict;
4 use warnings;
5
6 use base qw/DBIx::Class::Storage::DBI/;
7
8 sub last_insert_id {
9   my $self = shift;
10   my ($id) =
11     $self->dbh_do( sub { shift->selectrow_array('SELECT @@IDENTITY' ) } );
12   return $id;
13 }
14
15 sub build_datetime_parser {
16   my $self = shift;
17   my $type = "DateTime::Format::Strptime";
18   eval "use ${type}";
19   $self->throw_exception("Couldn't load ${type}: $@") if $@;
20   return $type->new( pattern => '%m/%d/%Y %H:%M:%S' );
21 }
22
23 1;
24
25 =head1 NAME
26
27 DBIx::Class::Storage::DBI::MSSQL - Storage::DBI subclass for MSSQL
28
29 =head1 SYNOPSIS
30
31 This subclass supports MSSQL, and can in theory be used directly
32 via the C<storage_type> mechanism:
33
34   $schema->storage_type('::DBI::MSSQL');
35   $schema->connect_info('dbi:....', ...);
36
37 However, as there is no L<DBD::MSSQL>, you will probably want to use
38 one of the other DBD-specific MSSQL classes, such as
39 L<DBIx::Class::Storage::DBI::Sybase::MSSQL>.  These classes will
40 merge this class with a DBD-specific class to obtain fully
41 correct behavior for your scenario.
42
43 =head1 AUTHORS
44
45 Brian Cassidy <bricas@cpan.org>
46
47 =head1 LICENSE
48
49 You may distribute this code under the same terms as Perl itself.
50
51 =cut