X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FMSSQL.pm;h=40afe76607663593f11e85840f1be120fcba1c46;hb=bb3e90c8291b0927ae3e39f29c01c5911374b3e3;hp=e355ce9f457ef1ce70be84139a94a3ac59efb714;hpb=81092e2d683da60a94ad7d356cdff8bfbb49012f;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/MSSQL.pm b/lib/DBIx/Class/Storage/DBI/MSSQL.pm index e355ce9..40afe76 100644 --- a/lib/DBIx/Class/Storage/DBI/MSSQL.pm +++ b/lib/DBIx/Class/Storage/DBI/MSSQL.pm @@ -5,8 +5,9 @@ use warnings; use base qw/DBIx::Class::Storage::DBI/; -sub last_insert_id { - my( $id ) = $_[0]->_dbh->selectrow_array('SELECT @@IDENTITY' ); +sub _dbh_last_insert_id { + my ($self, $dbh, $source, $col) = @_; + my ($id) = $dbh->selectrow_array('SELECT SCOPE_IDENTITY()'); return $id; } @@ -15,7 +16,19 @@ sub build_datetime_parser { my $type = "DateTime::Format::Strptime"; eval "use ${type}"; $self->throw_exception("Couldn't load ${type}: $@") if $@; - return $type->new( pattern => '%m/%d/%Y %H:%M:%S' ); + return $type->new( pattern => '%Y-%m-%d %H:%M:%S' ); # %F %T +} + +sub sqlt_type { 'SQLServer' } + +sub _sql_maker_opts { + my ( $self, $opts ) = @_; + + if ( $opts ) { + $self->{_sql_maker_opts} = { %$opts }; + } + + return { limit_dialect => 'Top', %{$self->{_sql_maker_opts}||{}} }; } 1; @@ -38,6 +51,17 @@ L. These classes will merge this class with a DBD-specific class to obtain fully correct behavior for your scenario. +=head1 METHODS + +=head2 last_insert_id + +=head2 sqlt_type + +=head2 build_datetime_parser + +The resulting parser handles the MSSQL C type, but is almost +certainly not sufficient for the other MSSQL 2008 date/time types. + =head1 AUTHORS Brian Cassidy