X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FADO%2FMicrosoft_SQL_Server.pm;h=7c053af26eb1d00d0f41997edf45cb50e001e6f4;hb=56dca25f0e1582928ba897df4e1cf44c9710d4f2;hp=90d763942763729bb8bd6c9c8afd8b8ea4959f7d;hpb=f3a9ea3d41f4d32346bc5ea7ce83a7dcfe45b118;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm b/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm index 90d7639..7c053af 100644 --- a/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm +++ b/lib/DBIx/Class/Storage/DBI/ADO/Microsoft_SQL_Server.pm @@ -9,6 +9,54 @@ use base qw/ /; use mro 'c3'; +=head1 NAME + +DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server - Support for Microsoft +SQL Server via DBD::ADO + +=head1 SYNOPSIS + +This subclass supports MSSQL server connections via L. + +=head1 DESCRIPTION + +The MSSQL specific functionality is provided by +L. + +=head1 EXAMPLE DSN + + dbi:ADO:provider=sqlncli10;server=EEEBOX\SQLEXPRESS + +=head1 CAVEATS + +=head2 identities + +C<_identity_method> is set to C<@@identity>, as C doesn't work +with L. See L +for caveats regarding this. + +=head2 truncation bug + +There is a bug with MSSQL ADO providers where data gets truncated based on the +size of the bind sizes in the first prepare call: + +L + +The C workaround is used (see L) with the +approximate maximum size of the data_type of the bound column, or 8000 (maximum +VARCHAR size) if the data_type is not available. + +This code is incomplete and may be buggy. Particularly, C is not +supported yet. The data_type list for other DBs is also incomplete. Please +report problems (and send patches.) + +=head2 fractional seconds + +Fractional seconds with L are not +currently supported, datetimes are truncated at the second. + +=cut + sub _rebless { my $self = shift; $self->_identity_method('@@identity'); @@ -94,51 +142,45 @@ sub _mssql_max_data_type_representation_size_in_bytes { } } -1; - -=head1 NAME - -DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server - Support for Microsoft -SQL Server via DBD::ADO - -=head1 SYNOPSIS - -This subclass supports MSSQL server connections via L. - -=head1 DESCRIPTION - -The MSSQL specific functionality is provided by -L. - -=head2 CAVEATS - -=head3 identities - -C<_identity_method> is set to C<@@identity>, as C doesn't work -with L. See L -for caveats regarding this. +sub datetime_parser_type { + 'DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format' +} -=head3 truncation bug +package # hide from PAUSE + DBIx::Class::Storage::DBI::ADO::Microsoft_SQL_Server::DateTime::Format; -There is a bug with MSSQL ADO providers where data gets truncated based on the -size of the bind sizes in the first prepare call: +my $datetime_format = '%m/%d/%Y %I:%M:%S %p'; +my $datetime_parser; -L +sub parse_datetime { + shift; + require DateTime::Format::Strptime; + $datetime_parser ||= DateTime::Format::Strptime->new( + pattern => $datetime_format, + on_error => 'croak', + ); + return $datetime_parser->parse_datetime(shift); +} -The C workaround is used (see L) with the -approximate maximum size of the data_type of the bound column, or 8000 (maximum -VARCHAR size) if the data_type is not available. +sub format_datetime { + shift; + require DateTime::Format::Strptime; + $datetime_parser ||= DateTime::Format::Strptime->new( + pattern => $datetime_format, + on_error => 'croak', + ); + return $datetime_parser->format_datetime(shift); +} -This code is incomplete and may be buggy. Particularly, C is not -supported yet. The data_type list for other DBs is also incomplete. Please -report problems (and send patches.) +1; =head1 AUTHOR -See L. +See L and L. =head1 LICENSE You may distribute this code under the same terms as Perl itself. =cut +# vim:sts=2 sw=2: