X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FODBC%2FMicrosoft_SQL_Server.pm;h=3c18a3c431ba6a468910b2fa3c213b3c6abfbddd;hb=2eebd801e7300ecc24a68c0062f35aa72775908f;hp=88eeab62feff173ec7c463f80ccce5f318b9d9ec;hpb=c1cac6332247a092ddc886c52607b24104c3fb46;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm index 88eeab6..3c18a3c 100644 --- a/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm @@ -14,14 +14,14 @@ sub _prep_for_execute { return ($sql, $bind); } -sub insert { - my ($self, $source, $to_insert) = @_; +sub _execute { + my $self = shift; + my ($op) = @_; - my $bind_attributes = $self->source_bind_attributes($source); - my (undef, $sth) = $self->_execute( 'insert' => [], $source, $bind_attributes, $to_insert); - $self->{_scope_identity} = $sth->fetchrow_array; + my ($rv, $sth, @bind) = $self->dbh_do($self->can('_dbh_execute'), @_); + $self->{_scope_identity} = $sth->fetchrow_array if $op eq 'insert'; - return $to_insert; + return wantarray ? ($rv, $sth, @bind) : $rv; } sub last_insert_id { shift->{_scope_identity} } @@ -38,14 +38,22 @@ sub _sql_maker_opts { return { limit_dialect => 'Top', %{$self->{_sql_maker_opts}||{}} }; } +sub build_datetime_parser { + my $self = shift; + my $type = "DateTime::Format::Strptime"; + eval "use ${type}"; + $self->throw_exception("Couldn't load ${type}: $@") if $@; + return $type->new( pattern => '%F %T' ); +} + 1; __END__ =head1 NAME -DBIx::Class::Storage::ODBC::Microsoft_SQL_Server - Support specific to -Microsoft SQL Server over ODBC +DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server - Support specific +to Microsoft SQL Server over ODBC =head1 DESCRIPTION @@ -64,6 +72,16 @@ be called is the same execute statement, not just the same connection. So, this implementation appends a SELECT SCOPE_IDENTITY() statement onto each INSERT to accommodate that requirement. +=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