r49743 - in /branches/upstream/librose-db-object-perl/current: ./ lib/Rose/DB/ lib/Rose/DB/Object/ lib/Rose/DB/Object/Metadata/ lib/Rose/DB/Object/Metadata/Relationship/ t/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Fri Jan 1 04:52:25 UTC 2010


Author: jawnsy-guest
Date: Fri Jan  1 04:52:21 2010
New Revision: 49743

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=49743
Log:
[svn-upgrade] Integrating new upstream version, librose-db-object-perl (0.785)

Modified:
    branches/upstream/librose-db-object-perl/current/Changes
    branches/upstream/librose-db-object-perl/current/META.yml
    branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object.pm
    branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Cached.pm
    branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Auto.pm
    branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm
    branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Tutorial.pod
    branches/upstream/librose-db-object-perl/current/t/db-object-cached.t

Modified: branches/upstream/librose-db-object-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/Changes?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/Changes (original)
+++ branches/upstream/librose-db-object-perl/current/Changes Fri Jan  1 04:52:21 2010
@@ -1,3 +1,14 @@
+0.785 (12.31.2009) - John Siracusa <siracusa at gmail.com>
+
+    * Fixed Rose::DB::Object::Cached to correctly honor alternate column
+      accessor/mutator method names.  (Reported by Kevin McGrath)
+    * Stopped the default auto-init handler from asking the convention
+      manager to name foreign keys that have only partially populated
+      column lists, causing it to burn through the "good" foreign key
+      names.  (Patch by Douglas Wilson)
+    * Corrected some typos in the ManyToMany documentation and the tutorial.
+      (Thanks to Bart Dopheide)
+
 0.784 (10.16.2009) - John Siracusa <siracusa at gmail.com>
 
     * Fixed a bug introduced by the multi-many Manager bug fix in the

Modified: branches/upstream/librose-db-object-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/META.yml?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/META.yml (original)
+++ branches/upstream/librose-db-object-perl/current/META.yml Fri Jan  1 04:52:21 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Rose-DB-Object
-version:            0.784
+version:            0.785
 abstract:           Extensible, high performance object-relational mapper (ORM).
 author:
     - John Siracusa <siracusa at gmail.com>
@@ -38,7 +38,7 @@
     directory:
         - t
         - inc
-generated_by:       ExtUtils::MakeMaker version 6.54
+generated_by:       ExtUtils::MakeMaker version 6.56
 meta-spec:
     url:      http://module-build.sourceforge.net/META-spec-v1.4.html
     version:  1.4

Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object.pm?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object.pm (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object.pm Fri Jan  1 04:52:21 2010
@@ -16,7 +16,7 @@
 use Rose::DB::Object::Exception;
 use Rose::DB::Object::Util();
 
-our $VERSION = '0.784';
+our $VERSION = '0.785';
 
 our $Debug = 0;
 
@@ -2428,7 +2428,7 @@
 
 =head1 CONTRIBUTORS
 
-Bradley C Bailey, Graham Barr, David Christensen, Lucian Dragus, Justin Ellison, Perrin Harkins, Cees Hek, Benjamin Hitz, Peter Karman, Ed Loehr, Michael Reece, Thomas Whaples, Teodor Zlatanov
+Bradley C Bailey, Graham Barr, David Christensen, Lucian Dragus, Justin Ellison, Perrin Harkins, Cees Hek, Benjamin Hitz, Peter Karman, Ed Loehr, Michael Reece, Thomas Whaples, Douglas Wilson, Teodor Zlatanov
 
 =head1 AUTHOR
 

Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Cached.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Cached.pm?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Cached.pm (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Cached.pm Fri Jan  1 04:52:21 2010
@@ -9,7 +9,7 @@
 
 use Rose::DB::Object::Constants qw(STATE_IN_DB);
 
-our $VERSION = '0.7663';
+our $VERSION = '0.785';
 
 our $Debug = 0;
 
@@ -26,7 +26,8 @@
   my($self) = shift;
 
   my $class = ref $self;
-  my $pk = join(PK_SEP, grep { defined } map { $self->$_() } $self->meta->primary_key_column_names);
+  my $meta  = $self->meta;
+  my $pk = join(PK_SEP, grep { defined } map { $self->$_() } $meta->primary_key_column_accessor_names);
 
   no strict 'refs';
 
@@ -39,13 +40,15 @@
   {
     ${"${class}::Objects_By_Id_Loaded"}{$pk} = $loaded;
   }
+
+  my $accessor = $meta->column_accessor_method_names_hash;
 
   foreach my $cols ($self->meta->unique_keys_column_names)
   {
     no warnings;
     my $key_name  = join(UK_SEP, @$cols);
     my $key_value = join(UK_SEP, grep { defined($_) ? $_ : UNDEF } 
-                         map { $self->$_() } @$cols);
+                         map { my $m = $accessor->{$_}; $self->$m() } @$cols);
 
     ${"${class}::Objects_By_Key"}{$key_name}{$key_value} = $self;
     ${"${class}::Objects_Keys"}{$pk}{$key_name} = $key_value;
@@ -119,7 +122,7 @@
 
   unless(delete $args{'refresh'})
   {
-    my $pk = join(PK_SEP, grep { defined } map { $_[0]->$_() } $_[0]->meta->primary_key_column_names);
+    my $pk = join(PK_SEP, grep { defined } map { $_[0]->$_() } $_[0]->meta->primary_key_column_accessor_names);
 
     my $object = __xrdbopriv_get_object($_[0], $pk);
 
@@ -131,12 +134,15 @@
     }
     elsif(!(defined $object && $object == CACHE_EXPIRED))
     {
-      foreach my $cols ($_[0]->meta->unique_keys_column_names)
+      my $meta = $_[0]->meta;
+      my $accessor = $meta->column_accessor_method_names_hash;
+
+      foreach my $cols ($meta->unique_keys_column_names)
       {
         no warnings;
         my $key_name  = join(UK_SEP, @$cols);
         my $key_value = join(UK_SEP, grep { defined($_) ? $_ : UNDEF } 
-                             map { $_[0]->$_() } @$cols);
+                             map { my $m = $accessor->{$_}; $_[0]->$m() } @$cols);
 
         if(my $object = __xrdbopriv_get_object($_[0], $key_name, $key_value))
         {
@@ -191,7 +197,7 @@
   my($self) = shift;
 
   my $class = ref $self;
-  my $pk = join(PK_SEP, grep { defined } map { $self->$_() } $self->meta->primary_key_column_names);
+  my $pk = join(PK_SEP, grep { defined } map { $self->$_() } $self->meta->primary_key_column_accessor_names);
 
   no strict 'refs';
   delete ${"${class}::Objects_By_Id"}{$pk};
@@ -214,7 +220,7 @@
   my($self) = shift;
 
   my $class = ref $self;
-  my $pk = join(PK_SEP, grep { defined } map { $self->$_() } $self->meta->primary_key_column_names);
+  my $pk = join(PK_SEP, grep { defined } map { $self->$_() } $self->meta->primary_key_column_accessor_names);
 
   no strict 'refs';
   ${"${class}::Objects_By_Id"}{$pk} = $self;

Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Auto.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Auto.pm?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Auto.pm (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Auto.pm Fri Jan  1 04:52:21 2010
@@ -393,6 +393,13 @@
                           $fk_info->{'FK_TABLE_NAME'}  eq $table);
         }
 
+        my $local_column   = $fk_info->{'FK_COLUMN_NAME'};
+        my $foreign_column = $fk_info->{'UK_COLUMN_NAME'};
+
+        my $fk_id = $fk_info->{'RDBO_FK_ID'} = $fk_info->{'FK_NAME'} || $fk_info->{'UK_NAME'};
+
+        $fk{$fk_id}{'key_columns'}{$local_column} = $foreign_column;
+
         push(@fk_info, $fk_info);
       }
 
@@ -406,9 +413,13 @@
 
       my $cm = $self->convention_manager;
 
+      my %seen_fk_id;
+
       FK_INFO: foreach my $fk_info (@fk_info)
       {
-        my $fk_id = $fk_info->{'RDBO_FK_ID'} = $fk_info->{'FK_NAME'} || $fk_info->{'UK_NAME'};
+        my $fk_id = $fk_info->{'RDBO_FK_ID'};
+
+        next  if($seen_fk_id{$fk_id}++);
 
         my $foreign_class = 
           $self->class_for(catalog => $fk_info->{'UK_TABLE_CAT'},
@@ -469,11 +480,7 @@
           next FK_INFO;
         }
 
-        my $local_column   = $fk_info->{'FK_COLUMN_NAME'};
-        my $foreign_column = $fk_info->{'UK_COLUMN_NAME'};
-
         $fk{$fk_id}{'class'} = $foreign_class;
-        $fk{$fk_id}{'key_columns'}{$local_column} = $foreign_column;
 
         my $key_name =
           $cm->auto_foreign_key_name($foreign_class, $fk_id, 

Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm Fri Jan  1 04:52:21 2010
@@ -659,7 +659,7 @@
   $color = Color->new(id => 1);
   $color->load;
 
-  @widgets = map { $_->name } $c->widgets; # ('Sprocket')
+  @widgets = map { $_->name } $color->widgets; # ('Sprocket')
 
 =head1 METHOD MAP
 

Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Tutorial.pod
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Tutorial.pod?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Tutorial.pod (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Tutorial.pod Fri Jan  1 04:52:21 2010
@@ -1488,7 +1488,7 @@
 In this case, there is no ambiguity, so the relationship definition can be shortened to this.
 
 
-    use ProductColorMap;
+    use Product;
     ...
     __PACKAGE__->meta->setup
     (
@@ -1505,7 +1505,7 @@
 
 In fact, since the map table is named according to the default L<conventions|Rose::DB::Object::ConventionManager>, it can be shortened even further.
 
-    use ProductColorMap;
+    use Product;
     ...
     __PACKAGE__->meta->setup
     (
@@ -1519,7 +1519,7 @@
 
 And further still:
 
-    use ProductColorMap;
+    use Product;
     ...
     __PACKAGE__->meta->setup
     (

Modified: branches/upstream/librose-db-object-perl/current/t/db-object-cached.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/t/db-object-cached.t?rev=49743&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/t/db-object-cached.t (original)
+++ branches/upstream/librose-db-object-perl/current/t/db-object-cached.t Fri Jan  1 04:52:21 2010
@@ -815,18 +815,18 @@
   $o = MySQLiteObject->new(name => 'John');
   $o->load or die $o->error;
 
-  $loaded = $MySQLiteObject::Objects_By_Key_Loaded{'name'}{'John'};
-
-  is($MySQLiteObject::Objects_By_Key_Loaded{'name'}{'John'}, $loaded, "cache_expires_in uk 1 - $db_type");
-  $o->load or die $o->error;
-  is($MySQLiteObject::Objects_By_Key_Loaded{'name'}{'John'}, $loaded, "cache_expires_in uk 2 - $db_type");
+  $loaded = $MySQLiteObject::Objects_By_Key_Loaded{'namex'}{'John'};
+
+  is($MySQLiteObject::Objects_By_Key_Loaded{'namex'}{'John'}, $loaded, "cache_expires_in uk 1 - $db_type");
+  $o->load or die $o->error;
+  is($MySQLiteObject::Objects_By_Key_Loaded{'namex'}{'John'}, $loaded, "cache_expires_in uk 2 - $db_type");
   sleep(5);
   $o->load or die $o->error;
-  ok($MySQLiteObject::Objects_By_Key_Loaded{'name'}{'John'} != $loaded, "cache_expires_in uk 3 - $db_type");
+  ok($MySQLiteObject::Objects_By_Key_Loaded{'namex'}{'John'} != $loaded, "cache_expires_in uk 3 - $db_type");
 
   MySQLiteObject->remember_all;
 
-  $loaded = $MySQLiteObject::Objects_By_Key_Loaded{'name'}{'John'};
+  $loaded = $MySQLiteObject::Objects_By_Key_Loaded{'namex'}{'John'};
 
   ok($loaded && $loaded ne $o, "remember_all - $db_type");
 }
@@ -1144,18 +1144,18 @@
 CREATE TABLE rose_db_object_test
 (
   id             INTEGER PRIMARY KEY AUTOINCREMENT,
-  name           VARCHAR(32) NOT NULL,
+  namex          VARCHAR(32) NOT NULL,
   flag           BOOLEAN NOT NULL,
   flag2          BOOLEAN,
   status         VARCHAR(32) DEFAULT 'active',
   bits           VARCHAR(5) DEFAULT '00101' NOT NULL,
   nums           VARCHAR(255),
-  start          DATE,
+  startx         DATE,
   save           INT,
   last_modified  TIMESTAMP,
   date_created   TIMESTAMP,
 
-  UNIQUE(name)
+  UNIQUE(namex)
 )
 EOF
 
@@ -1173,13 +1173,13 @@
 
     MySQLiteObject->meta->columns
     (
-      'name',
+      namex    => { alias => 'name' },
       id       => { primary_key => 1 },
       flag     => { type => 'boolean', default => 1 },
       flag2    => { type => 'boolean' },
       status   => { default => 'active' },
-      start    => { type => 'date', default => '12/24/1980' },
-      save     => { type => 'scalar' },
+      startx   => { type => 'date', default => '12/24/1980', alias => 'start' },
+      'save',
       nums     => { type => 'array' },
       bits     => { type => 'bitfield', bits => 5, default => 101 },
       last_modified => { type => 'timestamp' },
@@ -1189,7 +1189,7 @@
     eval { MySQLiteObject->meta->initialize };
     Test::More::ok($@, 'meta->initialize() reserved method');
 
-    MySQLiteObject->meta->add_unique_key('name');
+    MySQLiteObject->meta->add_unique_key('namex');
 
     MySQLiteObject->meta->alias_column(save => 'save_col');
     MySQLiteObject->meta->initialize(preserve_existing => 1);




More information about the Pkg-perl-cvs-commits mailing list