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