r77538 - in /branches/upstream/librose-db-object-perl/current: ./ lib/Rose/DB/ lib/Rose/DB/Object/ t/
periapt at users.alioth.debian.org
periapt at users.alioth.debian.org
Sat Jul 16 18:24:51 UTC 2011
Author: periapt
Date: Sat Jul 16 18:24:43 2011
New Revision: 77538
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=77538
Log:
[svn-upgrade] new version librose-db-object-perl (0.795)
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/ConventionManager.pm
branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Loader.pm
branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Manager.pm
branches/upstream/librose-db-object-perl/current/t/db-object-loader-7.t
branches/upstream/librose-db-object-perl/current/t/db-object-manager.t
branches/upstream/librose-db-object-perl/current/t/make-modules.t
branches/upstream/librose-db-object-perl/current/t/test-lib.pl
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=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/Changes (original)
+++ branches/upstream/librose-db-object-perl/current/Changes Sat Jul 16 18:24:43 2011
@@ -1,3 +1,13 @@
+0.795 (07.14.2011) - John Siracusa <siracusa at gmail.com>
+
+ * The Loader now passes the Manager class name as a second argument to
+ module_preamble and module_postamble subroutines to allow Manager
+ classes to be distinguished from object classes.
+ * Corrected a typo in the ConventionManager documentation ("objs_"
+ should be "_objs")
+ * Fixed a bug that caused load-on-demand columns to be loaded by
+ load(with => ...) method calls. (Reported by Marlon Bailey)
+
0.794 (12.30.2010) - John Siracusa <siracusa at gmail.com>
* Handle null default values for foreign key columns in PostgreSQL
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=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/META.yml (original)
+++ branches/upstream/librose-db-object-perl/current/META.yml Sat Jul 16 18:24:43 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Rose-DB-Object
-version: 0.794
+version: 0.795
abstract: Extensible, high performance object-relational mapper (ORM).
author:
- John Siracusa <siracusa at gmail.com>
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=77538&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 Sat Jul 16 18:24:43 2011
@@ -16,7 +16,7 @@
use Rose::DB::Object::Exception;
use Rose::DB::Object::Util();
-our $VERSION = '0.794';
+our $VERSION = '0.795';
our $Debug = 0;
Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/ConventionManager.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/ConventionManager.pm?rev=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/ConventionManager.pm (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/ConventionManager.pm Sat Jul 16 18:24:43 2011
@@ -10,7 +10,7 @@
use Rose::DB::Object::Metadata::Object;
our @ISA = qw(Rose::DB::Object::Metadata::Object);
-our $VERSION = '0.786';
+our $VERSION = '0.795';
our $Debug = 0;
@@ -1040,7 +1040,7 @@
The default implementation passes the name of the table pointed to by FK through the L<singular_to_plural|/singular_to_plural> method in order to build the name.
-If the selected name is the name of an existing or potential method in the target class, then the suffixes "objs_" and "_objects" are tried in that order. If neither of those suffixes resolves the situation, then ascending numeric suffixes starting with "1" are tried until a unique name is found.
+If the selected name is the name of an existing or potential method in the target class, then the suffixes "_objs" and "_objects" are tried in that order. If neither of those suffixes resolves the situation, then ascending numeric suffixes starting with "1" are tried until a unique name is found.
=item B<auto_relationship_name_one_to_many TABLE, CLASS>
@@ -1048,7 +1048,7 @@
If L<tables_are_singular|/tables_are_singular> is true, then TABLE is passed to the L<singular_to_plural|/singular_to_plural> method and the result is used as the name. Otherwise, TABLE is used as-is.
-If the selected name is the name of an existing or potential method in the target class, then the suffixes "objs_" and "_objects" are tried in that order. If neither of those suffixes resolves the situation, then ascending numeric suffixes starting with "1" are tried until a unique name is found.
+If the selected name is the name of an existing or potential method in the target class, then the suffixes "_objs" and "_objects" are tried in that order. If neither of those suffixes resolves the situation, then ascending numeric suffixes starting with "1" are tried until a unique name is found.
=item B<auto_relationship_name_one_to_one TABLE, CLASS>
Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Loader.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Loader.pm?rev=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Loader.pm (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Loader.pm Sat Jul 16 18:24:43 2011
@@ -17,7 +17,7 @@
use Rose::Object;
our @ISA = qw(Rose::Object);
-our $VERSION = '0.787';
+our $VERSION = '0.795';
our $Debug = 0;
@@ -446,7 +446,7 @@
if($preamble)
{
my $this_preamble = ref $preamble eq 'CODE' ?
- $preamble->($class->object_class->meta) : $preamble;
+ $preamble->($class->object_class->meta, $class) : $preamble;
print {$pm} $this_preamble;
}
@@ -456,7 +456,7 @@
if($postamble)
{
my $this_postamble = ref $postamble eq 'CODE' ?
- $postamble->($class->object_class->meta) : $postamble;
+ $postamble->($class->object_class->meta, $class) : $postamble;
print {$pm} $this_postamble;
}
@@ -1521,13 +1521,13 @@
=item B<module_preamble [ SCALAR | CODE ]>
-If defined as a scalar, inserts the contents of the variable into the auto-generated file before any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> is passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the preamble text.
+If defined as a scalar, inserts the contents of the variable into the auto-generated file before any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> and the L<Rose::DB::Object::Manager>-derived class name are passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the preamble text.
Defaults to to the value of the loader object's L<module_preamble|/module_preamble> attribute.
=item B<module_postamble [ SCALAR | CODE ]>
-If defined as a scalar, inserts the contents of the variable into the auto-generated file after any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> is passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the postamble text.
+If defined as a scalar, inserts the contents of the variable into the auto-generated file after any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> and the L<Rose::DB::Object::Manager>-derived class name are passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the postamble text.
Defaults to to the value of the loader object's L<module_postamble|/module_postamble> attribute.
@@ -1539,11 +1539,11 @@
=item B<module_preamble [ SCALAR | CODE ]>
-If defined as a scalar, inserts the contents of the variable into the auto-generated file before any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> is passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the preamble text.
+If defined as a scalar, inserts the contents of the variable into the auto-generated file before any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> and the L<Rose::DB::Object::Manager>-derived class name are passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the preamble text.
=item B<module_postamble [ SCALAR | CODE ]>
-If defined as a scalar, inserts the contents of the variable into the auto-generated file after any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> is passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the postamble text.
+If defined as a scalar, inserts the contents of the variable into the auto-generated file after any of the auto-generated class information. If provided as a code ref, calls the indicated function, passing the L<metadata object|Rose::DB::Object::Metadata> as a parameter. (The metadata object that belongs to the C<object_class> and the L<Rose::DB::Object::Manager>-derived class name are passed if the module is a L<Rose::DB::Object::Manager>-derived class.) The returned value of the function is inserted as the postamble text.
=item B<pre_init_hook [CODE]>
Modified: branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Manager.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Manager.pm?rev=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Manager.pm (original)
+++ branches/upstream/librose-db-object-perl/current/lib/Rose/DB/Object/Manager.pm Sat Jul 16 18:24:43 2011
@@ -733,7 +733,7 @@
my($fields, $fields_string, $table);
- $args{'nonlazy'} = [] unless(exists $args{'nonlazy'});
+ $args{'nonlazy'} = [] unless(defined $args{'nonlazy'});
my $nonlazy = $args{'nonlazy'};
my %nonlazy = (ref $nonlazy ? map { $_ => 1 } @$nonlazy : ());
Modified: branches/upstream/librose-db-object-perl/current/t/db-object-loader-7.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/t/db-object-loader-7.t?rev=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/t/db-object-loader-7.t (original)
+++ branches/upstream/librose-db-object-perl/current/t/db-object-loader-7.t Sat Jul 16 18:24:43 2011
@@ -2,7 +2,7 @@
use strict;
-use Test::More tests => 1 + (5 * 20);
+use Test::More tests => 1 + (5 * 21);
BEGIN
{
@@ -53,7 +53,7 @@
{
SKIP:
{
- skip("$db_type tests", 20) unless($Have{$db_type});
+ skip("$db_type tests", 21) unless($Have{$db_type});
}
next unless($Have{$db_type});
@@ -95,10 +95,12 @@
if($db_type =~ /^pg/)
{
is($product_class->meta->column('name_fk')->default, undef, "null default fk - $db_type");
+ is($product_class->meta->column('some_text')->type, 'text', "text column - $db_type");
}
else
{
SKIP: { skip("null default fk - $db_type", 1) }
+ SKIP: { skip("text column - $db_type", 1) }
}
ok($JCS::Called_For{$product_class}, "custom metadata - $db_type");
@@ -248,6 +250,8 @@
date_created TIMESTAMP NOT NULL DEFAULT NOW(),
release_date TIMESTAMP,
+ some_text TEXT,
+
UNIQUE(name)
)
EOF
@@ -310,6 +314,8 @@
date_created TIMESTAMP NOT NULL DEFAULT NOW(),
release_date TIMESTAMP,
+
+ some_text TEXT,
UNIQUE(name)
)
Modified: branches/upstream/librose-db-object-perl/current/t/db-object-manager.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/t/db-object-manager.t?rev=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/t/db-object-manager.t (original)
+++ branches/upstream/librose-db-object-perl/current/t/db-object-manager.t Sat Jul 16 18:24:43 2011
@@ -2,7 +2,7 @@
use strict;
-use Test::More tests => 3907;
+use Test::More tests => 3910;
BEGIN
{
@@ -93,7 +93,7 @@
SKIP: foreach my $db_type (qw(pg)) #pg_with_schema
{
- skip("PostgreSQL tests", 783) unless($HAVE_PG);
+ skip("PostgreSQL tests", 784) unless($HAVE_PG);
Rose::DB->default_type($db_type);
@@ -731,6 +731,10 @@
ok(!defined $objs->[0]->{'status'}, "lazy main 1 - $db_type");
is($objs->[0]->status, 'with', "lazy main 2 - $db_type");
+ my $object = MyPgObject->new(db => $db, id => $objs->[0]->id);
+ $object->load(with => [ 'nicks.type' ]);
+ is($object->{'status'}, undef, "lazy load(with) 1 - $db_type");
+
my $nicks = $objs->[0]->{'nicks'}; # make sure this isn't hitting the db
is(scalar @$nicks, 4, "get_objects() with many 3 - $db_type");
@@ -3127,7 +3131,7 @@
SKIP: foreach my $db_type ('mysql')
{
- skip("MySQL tests", 790) unless($HAVE_MYSQL);
+ skip("MySQL tests", 791) unless($HAVE_MYSQL);
Rose::DB->default_type($db_type);
@@ -3743,6 +3747,10 @@
ok(!defined $objs->[0]->{'status'}, "lazy main 1 - $db_type");
is($objs->[0]->status, 'with', "lazy main 2 - $db_type");
+ my $object = MyMySQLObject->new(id => $objs->[0]->id);
+ $object->load(with => [ 'nicks.type' ]);
+ is($object->{'status'}, undef, "lazy load(with) 1 - $db_type");
+
my $nicks = $objs->[0]->{'nicks'}; # make sure this isn't hitting the db
is(scalar @$nicks, 4, "get_objects() with many 3 - $db_type");
@@ -8905,7 +8913,7 @@
SKIP: foreach my $db_type (qw(sqlite))
{
- skip("SQLite tests", 793) unless($HAVE_SQLITE);
+ skip("SQLite tests", 794) unless($HAVE_SQLITE);
Rose::DB->default_type($db_type);
@@ -9458,6 +9466,10 @@
ok(!defined $objs->[0]->{'status'}, "lazy main 1 - $db_type");
is($objs->[0]->status, 'with', "lazy main 2 - $db_type");
+ my $object = MySQLiteObject->new(id => $objs->[0]->id);
+ $object->load(with => [ 'nicks.type' ]);
+ is($object->{'status'}, undef, "lazy load(with) 1 - $db_type");
+
my $nicks = $objs->[0]->{'nicks'}; # make sure this isn't hitting the db
# SQLite seems to disobey the "ORDER BY t1.id, t2.nick DESC" clause
Modified: branches/upstream/librose-db-object-perl/current/t/make-modules.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/t/make-modules.t?rev=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/t/make-modules.t (original)
+++ branches/upstream/librose-db-object-perl/current/t/make-modules.t Sat Jul 16 18:24:43 2011
@@ -102,7 +102,8 @@
module_postamble =>
sub
{
- "# My Postamble for " . $_[0]->class . "\n";
+ no warnings 'uninitialized';
+ "# My Postamble for " . $_[0]->class . " ($_[1])\n";
});
my $mylsq_5_51 = ($db_type eq 'mysql' && Rose::DB->new->database_version >= 5_000_051) ? 1 : 0;
@@ -170,7 +171,7 @@
1;
-# My Postamble for ${class_prefix}::Product
+# My Postamble for ${class_prefix}::Product ()
EOF
is(slurp("$Lib_Dir/$class_prefix/Product/Manager.pm"), <<"EOF", "Product Manager 1 - $db_type");
@@ -189,7 +190,7 @@
1;
-# My Postamble for ${class_prefix}::Product
+# My Postamble for ${class_prefix}::Product (${class_prefix}::Product::Manager)
EOF
is(slurp("$Lib_Dir/$class_prefix/Color.pm"), <<"EOF", "Color 1 - $db_type");
@@ -228,7 +229,7 @@
1;
-# My Postamble for ${class_prefix}::Color
+# My Postamble for ${class_prefix}::Color ()
EOF
unshift(@INC, $Lib_Dir);
Modified: branches/upstream/librose-db-object-perl/current/t/test-lib.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/librose-db-object-perl/current/t/test-lib.pl?rev=77538&op=diff
==============================================================================
--- branches/upstream/librose-db-object-perl/current/t/test-lib.pl (original)
+++ branches/upstream/librose-db-object-perl/current/t/test-lib.pl Sat Jul 16 18:24:43 2011
@@ -255,7 +255,9 @@
my $dbh;
- eval
+ local $@;
+
+ eval
{
$dbh = Rose::DB->new($type)->retain_dbh()
or die Rose::DB->error;
More information about the Pkg-perl-cvs-commits
mailing list