[Bast-commits] r8510 - in DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI: . Sybase

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Tue Feb 2 19:31:00 GMT 2010


Author: caelum
Date: 2010-02-02 19:31:00 +0000 (Tue, 02 Feb 2010)
New Revision: 8510

Removed:
   DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/Sybase/ASA.pm
Modified:
   DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm
Log:
rename ::Sybase::ASA to ::SQLAnywhere, per mst

Modified: DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm	2010-02-02 18:39:33 UTC (rev 8509)
+++ DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/SQLAnywhere.pm	2010-02-02 19:31:00 UTC (rev 8510)
@@ -1,19 +1,82 @@
-package # hide from PAUSE
-  DBIx::Class::Storage::DBI::SQLAnywhere;
+package DBIx::Class::Storage::DBI::SQLAnywhere;
 
 use strict;
 use warnings;
 use base qw/DBIx::Class::Storage::DBI/;
 use mro 'c3';
+use List::Util ();
 
-sub _rebless {
+__PACKAGE__->mk_group_accessors(simple => qw/
+  _identity
+/);
+
+=head1 NAME
+
+DBIx::Class::Storage::DBI::Sybase::ASA - Driver for Sybase SQL Anywhere
+
+=head1 DESCRIPTION
+
+This class implements autoincrements for Sybase SQL Anywhere and selects the
+RowNumberOver limit implementation.
+
+You need the C<DBD::SQLAnywhere> driver that comes with the SQL Anywhere
+distribution, B<NOT> the one on CPAN. It is usually under a path such as:
+
+    /opt/sqlanywhere11/sdk/perl
+
+=cut
+
+sub last_insert_id { shift->_identity }
+
+sub insert {
   my $self = shift;
+  my ($source, $to_insert) = @_;
 
-  if (ref $self eq __PACKAGE__) {
-    require DBIx::Class::Storage::DBI::Sybase::ASA;
-    bless $self, 'DBIx::Class::Storage::DBI::Sybase::ASA';
-    $self->_rebless;
+  my $supplied_col_info = $self->_resolve_column_info($source, [keys %$to_insert]);
+
+  my $is_identity_insert = (List::Util::first { $_->{is_auto_increment} } (values %$supplied_col_info) )
+     ? 1
+     : 0;
+
+  my $identity_col = List::Util::first {
+      $source->column_info($_)->{is_auto_increment} 
+  } $source->columns;
+
+  if ((not $is_identity_insert) && $identity_col) {
+    my $dbh = $self->_get_dbh;
+    my $table_name = $source->from;
+    $table_name    = $$table_name if ref $table_name;
+
+    my ($identity) = $dbh->selectrow_array("SELECT GET_IDENTITY('$table_name')");
+
+    $to_insert->{$identity_col} = $identity;
+
+    $self->_identity($identity);
   }
+
+  return $self->next::method(@_);
 }
 
+# stolen from DB2
+
+sub _sql_maker_opts {
+  my ( $self, $opts ) = @_;
+
+  if ( $opts ) {
+    $self->{_sql_maker_opts} = { %$opts };
+  }
+
+  return { limit_dialect => 'RowNumberOver', %{$self->{_sql_maker_opts}||{}} };
+}
+
 1;
+
+=head1 AUTHOR
+
+See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
+
+=head1 LICENSE
+
+You may distribute this code under the same terms as Perl itself.
+
+=cut

Deleted: DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/Sybase/ASA.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/Sybase/ASA.pm	2010-02-02 18:39:33 UTC (rev 8509)
+++ DBIx-Class/0.08/branches/sybase_asa/lib/DBIx/Class/Storage/DBI/Sybase/ASA.pm	2010-02-02 19:31:00 UTC (rev 8510)
@@ -1,82 +0,0 @@
-package DBIx::Class::Storage::DBI::Sybase::ASA;
-
-use strict;
-use warnings;
-use base qw/DBIx::Class::Storage::DBI/;
-use mro 'c3';
-use List::Util ();
-
-__PACKAGE__->mk_group_accessors(simple => qw/
-  _identity
-/);
-
-=head1 NAME
-
-DBIx::Class::Storage::DBI::Sybase::ASA - Driver for Sybase SQL Anywhere
-
-=head1 DESCRIPTION
-
-This class implements autoincrements for Sybase SQL Anywhere and selects the
-RowNumberOver limit implementation.
-
-You need the C<DBD::SQLAnywhere> driver that comes with the SQL Anywhere
-distribution, B<NOT> the one on CPAN. It is usually under a path such as:
-
-    /opt/sqlanywhere11/sdk/perl
-
-=cut
-
-sub last_insert_id { shift->_identity }
-
-sub insert {
-  my $self = shift;
-  my ($source, $to_insert) = @_;
-
-  my $supplied_col_info = $self->_resolve_column_info($source, [keys %$to_insert]);
-
-  my $is_identity_insert = (List::Util::first { $_->{is_auto_increment} } (values %$supplied_col_info) )
-     ? 1
-     : 0;
-
-  my $identity_col = List::Util::first {
-      $source->column_info($_)->{is_auto_increment} 
-  } $source->columns;
-
-  if ((not $is_identity_insert) && $identity_col) {
-    my $dbh = $self->_get_dbh;
-    my $table_name = $source->from;
-    $table_name    = $$table_name if ref $table_name;
-
-    my ($identity) = $dbh->selectrow_array("SELECT GET_IDENTITY('$table_name')");
-
-    $to_insert->{$identity_col} = $identity;
-
-    $self->_identity($identity);
-  }
-
-  return $self->next::method(@_);
-}
-
-# stolen from DB2
-
-sub _sql_maker_opts {
-  my ( $self, $opts ) = @_;
-
-  if ( $opts ) {
-    $self->{_sql_maker_opts} = { %$opts };
-  }
-
-  return { limit_dialect => 'RowNumberOver', %{$self->{_sql_maker_opts}||{}} };
-}
-
-1;
-
-=head1 AUTHOR
-
-See L<DBIx::Class/AUTHOR> and L<DBIx::Class/CONTRIBUTORS>.
-
-=head1 LICENSE
-
-You may distribute this code under the same terms as Perl itself.
-
-=cut




More information about the Bast-commits mailing list