Merge 'oracle_shorten_aliases' into 'trunk'
Rafael Kitover [Tue, 5 Jan 2010 12:54:56 +0000 (12:54 +0000)]
r22328@hlagh (orig r8201):  caelum | 2009-12-31 12:29:51 -0500
new branch to fix table aliases in queries over the 30char limit
r22329@hlagh (orig r8202):  caelum | 2009-12-31 12:55:50 -0500
failing test
r22330@hlagh (orig r8203):  caelum | 2009-12-31 13:00:35 -0500
switch oracle tests to done_testing()
r22331@hlagh (orig r8204):  caelum | 2009-12-31 15:02:50 -0500
got something working
r22332@hlagh (orig r8205):  caelum | 2009-12-31 15:08:30 -0500
POD touchups
r22343@hlagh (orig r8216):  caelum | 2010-01-01 07:42:03 -0500
fix uninitialized warning and a bug in ResultSet
r22419@hlagh (orig r8234):  caelum | 2010-01-05 07:53:18 -0500
append half of a base64 MD5 to shortened table aliases for Oracle

Makefile.PL
lib/DBIx/Class.pm
lib/DBIx/Class/Storage/DBI/Replicated.pm
lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
lib/DBIx/Class/Storage/DBI/Sybase/Microsoft_SQL_Server.pm
t/74mssql.t

index c7764c3..813b808 100644 (file)
@@ -51,8 +51,7 @@ requires 'Sub::Name'                => '0.04';
 requires 'Data::Dumper::Concise'    => '1.000';
 
 my %replication_requires = (
-  'Moose',                    => '0.87',
-  'MooseX::AttributeHelpers'  => '0.21',
+  'Moose',                    => '0.90',
   'MooseX::Types',            => '0.16',
   'namespace::clean'          => '0.11',
   'Hash::Merge',              => '0.11',
index cbe5988..3a8fa69 100644 (file)
@@ -116,7 +116,7 @@ Then you can use these classes in your application's code:
   # Output all artists names
   # $artist here is a DBIx::Class::Row, which has accessors
   # for all its columns. Rows are also subclasses of your Result class.
-  foreach $artist (@artists) {
+  foreach $artist (@all_artists) {
     print $artist->name, "\n";
   }
 
index 1589b5f..d8a5f6d 100644 (file)
@@ -7,8 +7,7 @@ BEGIN {
   ## use, so we explicitly test for these.
 
   my %replication_required = (
-    'Moose' => '0.87',
-    'MooseX::AttributeHelpers' => '0.21',
+    'Moose' => '0.90',
     'MooseX::Types' => '0.16',
     'namespace::clean' => '0.11',
     'Hash::Merge' => '0.11'
@@ -119,8 +118,7 @@ to force a query to run against Master when needed.
 
 Replicated Storage has additional requirements not currently part of L<DBIx::Class>
 
-  Moose => '0.87',
-  MooseX::AttributeHelpers => '0.20',
+  Moose => '0.90',
   MooseX::Types => '0.16',
   namespace::clean => '0.11',
   Hash::Merge => '0.11'
index e5fa1a1..a7a1dfa 100644 (file)
@@ -1,7 +1,6 @@
 package DBIx::Class::Storage::DBI::Replicated::Pool;
 
 use Moose;
-use MooseX::AttributeHelpers;
 use DBIx::Class::Storage::DBI::Replicated::Replicant;
 use List::Util 'sum';
 use Scalar::Util 'reftype';
@@ -125,26 +124,31 @@ removes the replicant under $key from the pool
 
 has 'replicants' => (
   is=>'rw',
-  metaclass => 'Collection::Hash',
+  traits => ['Hash'],
   isa=>HashRef['Object'],
   default=>sub {{}},
-  provides  => {
-    'set' => 'set_replicant',
-    'get' => 'get_replicant',
-    'empty' => 'has_replicants',
-    'count' => 'num_replicants',
-    'delete' => 'delete_replicant',
-    'values' => 'all_replicant_storages',
+  handles  => {
+    'set_replicant' => 'set',
+    'get_replicant' => 'get',
+    'has_replicants' => 'is_empty',
+    'num_replicants' => 'count',
+    'delete_replicant' => 'delete',
+    'all_replicant_storages' => 'values',
   },
 );
 
+around has_replicants => sub {
+    my ($orig, $self) = @_;
+    return !$self->$orig;
+};
+
 has next_unknown_replicant_id => (
   is => 'rw',
-  metaclass => 'Counter',
+  traits => ['Counter'],
   isa => Int,
   default => 1,
-  provides => {
-    inc => 'inc_unknown_replicant_id'
+  handles => {
+    'inc_unknown_replicant_id' => 'inc',
   },
 );
 
index 9666a00..0173fac 100644 (file)
@@ -13,7 +13,11 @@ sub _rebless {
   my $self = shift;
   my $dbh  = $self->_get_dbh;
 
+  return if ref $self ne __PACKAGE__;
+
   if (not $self->_typeless_placeholders_supported) {
+    require
+      DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars;
     bless $self,
       'DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server::NoBindVars';
     $self->_rebless;
index 02e1950..04efcf6 100644 (file)
@@ -31,13 +31,18 @@ for my $storage_type (@storage_types) {
 
   $schema = DBICTest::Schema->clone;
 
-  if ($storage_idx != 0) { # autodetect
-    $schema->storage_type("::$storage_type");
-  }
-
   $schema->connection($dsn, $user, $pass);
 
-  $schema->storage->ensure_connected;
+  if ($storage_idx != 0) { # autodetect
+    no warnings 'redefine';
+    local *DBIx::Class::Storage::DBI::_typeless_placeholders_supported =
+      sub { 0 };
+#    $schema->storage_type("::$storage_type");
+    $schema->storage->ensure_connected;
+  }
+  else {
+    $schema->storage->ensure_connected;
+  }
 
   if ($storage_idx == 0 && ref($schema->storage) =~ /NoBindVars\z/) {
     my $tb = Test::More->builder;