[Bast-commits] r6405 - in DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI: . ODBC Sybase

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Sun May 24 20:53:15 GMT 2009


Author: ribasushi
Date: 2009-05-24 20:53:15 +0000 (Sun, 24 May 2009)
New Revision: 6405

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm
Log:
Switch around inheritance of MSSQL drivers, remove some duplicate code

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2009-05-24 18:13:04 UTC (rev 6404)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/MSSQL.pm	2009-05-24 20:53:15 UTC (rev 6405)
@@ -16,9 +16,21 @@
   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;
 
 =head1 NAME
@@ -39,6 +51,17 @@
 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<DATETIME> type, but is almost
+certainly not sufficient for the other MSSQL 2008 date/time types.
+
 =head1 AUTHORS
 
 Brian Cassidy <bricas at cpan.org>

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-05-24 18:13:04 UTC (rev 6404)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm	2009-05-24 20:53:15 UTC (rev 6405)
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use base qw/DBIx::Class::Storage::DBI/;
+use base qw/DBIx::Class::Storage::DBI::MSSQL/;
 
 sub _prep_for_execute {
     my $self = shift;
@@ -29,26 +29,6 @@
 
 sub last_insert_id { shift->{_scope_identity} }
 
-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}||{}} };
-}
-
-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__
@@ -75,17 +55,6 @@
 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<DATETIME> type, but is almost
-certainly not sufficient for the other MSSQL 2008 date/time types.
-
 =head1 AUTHORS
 
 Marc Mims C<< <marc at questright.com> >>

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm	2009-05-24 18:13:04 UTC (rev 6404)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI/Sybase/MSSQL.pm	2009-05-24 20:53:15 UTC (rev 6405)
@@ -14,7 +14,7 @@
     .' ::DBI::Sybase::Microsoft_SQL_Server';
 
 
-use base qw/DBIx::Class::Storage::DBI::ODBC::Microsoft_SQL_Server DBIx::Class::Storage::DBI::Sybase/;
+use base qw/DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server/;
 
 1;
 




More information about the Bast-commits mailing list