r33890 - in /trunk/librose-db-object-perl: ./ debian/ lib/Rose/DB/ lib/Rose/DB/Object/MakeMethods/ lib/Rose/DB/Object/Metadata/Column/ lib/Rose/DB/Object/Metadata/Relationship/ t/
bricas-guest at users.alioth.debian.org
bricas-guest at users.alioth.debian.org
Fri Apr 24 12:26:49 UTC 2009
Author: bricas-guest
Date: Fri Apr 24 12:26:44 2009
New Revision: 33890
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=33890
Log:
New upstream release
Modified:
trunk/librose-db-object-perl/Changes
trunk/librose-db-object-perl/META.yml
trunk/librose-db-object-perl/debian/changelog
trunk/librose-db-object-perl/lib/Rose/DB/Object.pm
trunk/librose-db-object-perl/lib/Rose/DB/Object/MakeMethods/Generic.pm
trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Column/Blob.pm
trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm
trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToOne.pm
trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/OneToMany.pm
trunk/librose-db-object-perl/t/00-warning.t
trunk/librose-db-object-perl/t/db-object-relationship.t
trunk/librose-db-object-perl/t/db-object.t
trunk/librose-db-object-perl/t/deep-joins.t
trunk/librose-db-object-perl/t/test-lib.pl
Modified: trunk/librose-db-object-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/Changes?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/Changes (original)
+++ trunk/librose-db-object-perl/Changes Fri Apr 24 12:26:44 2009
@@ -1,3 +1,12 @@
+0.781 (04.19.2009) - John Siracusa <siracusa at gmail.com>
+
+ * Added an explicit SQL_BLOB bind_param() argument for blob columns
+ in SQLite. (Reported by clausi)
+ * Added manager_iterator_method and support for manager_count_method
+ and manager_delete_method to relevant Relationship classes.
+ (Patch by Peter Karman)
+ * Updated test suite to consider DBD::SQLite 1.19+ non-broken.
+
0.780 (03.04.2009) - John Siracusa <siracusa at gmail.com>
* Fixed a bug that caused the delete_relationships() Metadata method
Modified: trunk/librose-db-object-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/META.yml?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/META.yml (original)
+++ trunk/librose-db-object-perl/META.yml Fri Apr 24 12:26:44 2009
@@ -1,12 +1,14 @@
--- #YAML:1.0
name: Rose-DB-Object
-version: 0.780
+version: 0.781
abstract: Extensible, high performance object-relational mapper (ORM).
author:
- John Siracusa <siracusa at gmail.com>
license: perl
distribution_type: module
configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
ExtUtils::MakeMaker: 0
requires:
Bit::Vector: 0
@@ -36,7 +38,7 @@
directory:
- t
- inc
-generated_by: ExtUtils::MakeMaker version 6.48
+generated_by: ExtUtils::MakeMaker version 6.50
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: trunk/librose-db-object-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/debian/changelog?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/debian/changelog (original)
+++ trunk/librose-db-object-perl/debian/changelog Fri Apr 24 12:26:44 2009
@@ -1,3 +1,9 @@
+librose-db-object-perl (1:0.781-1) UNRELEASED; urgency=low
+
+ * New upstream release
+
+ -- Brian Cassidy <brian.cassidy at gmail.com> Fri, 24 Apr 2009 09:25:55 -0300
+
librose-db-object-perl (1:0.780-1) unstable; urgency=low
* New upstream release.
Modified: trunk/librose-db-object-perl/lib/Rose/DB/Object.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/lib/Rose/DB/Object.pm?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/lib/Rose/DB/Object.pm (original)
+++ trunk/librose-db-object-perl/lib/Rose/DB/Object.pm Fri Apr 24 12:26:44 2009
@@ -16,7 +16,7 @@
use Rose::DB::Object::Exception;
use Rose::DB::Object::Util();
-our $VERSION = '0.780';
+our $VERSION = '0.781';
our $Debug = 0;
Modified: trunk/librose-db-object-perl/lib/Rose/DB/Object/MakeMethods/Generic.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/lib/Rose/DB/Object/MakeMethods/Generic.pm?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/lib/Rose/DB/Object/MakeMethods/Generic.pm (original)
+++ trunk/librose-db-object-perl/lib/Rose/DB/Object/MakeMethods/Generic.pm Fri Apr 24 12:26:44 2009
@@ -20,7 +20,7 @@
use Rose::DB::Object::Helpers();
use Rose::DB::Object::Util qw(column_value_formatted_key);
-our $VERSION = '0.780';
+our $VERSION = '0.781';
our $Debug = 0;
@@ -2937,7 +2937,7 @@
}
$args{'multi_many_ok'} = 1;
-
+
# Make query for object count
eval
{
@@ -2974,9 +2974,13 @@
my $is_iterator = $interface eq 'iterator' ? 1 : 0;
- if($is_iterator && $ft_method eq 'get_objects')
- {
- $ft_method = 'get_objects_iterator';
+ if($is_iterator)
+ {
+ $ft_method = $args->{'manager_iterator_method'} || 'get_objects_iterator';
+ }
+ else
+ {
+ $ft_method = $args->{'manager_find_method'} || 'get_objects';
}
$methods{$name} = sub
@@ -3064,7 +3068,7 @@
{
$args{$k} = $v unless(exists $args{$k});
}
-
+
# Make query for object list
eval
{
@@ -3159,7 +3163,8 @@
{
$objs =
$ft_manager->$ft_method(query => [ %key, @$query_args ],
- %$mgr_args, db => $self->db)
+ %$mgr_args,
+ db => $self->db)
or die $ft_manager->error;
}
else
Modified: trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Column/Blob.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Column/Blob.pm?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Column/Blob.pm (original)
+++ trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Column/Blob.pm Fri Apr 24 12:26:44 2009
@@ -5,9 +5,23 @@
use Rose::DB::Object::Metadata::Column::Text;
our @ISA = qw(Rose::DB::Object::Metadata::Column::Text);
-our $VERSION = '0.01';
+use DBI qw(:sql_types);
+
+our $VERSION = '0.781';
sub type { 'blob' }
+
+sub dbi_requires_bind_param
+{
+ my($self, $db) = @_;
+ return $db->driver eq 'sqlite' ? 1 : 0;
+}
+
+sub dbi_bind_param_attrs
+{
+ my($self, $db) = @_;
+ return $db->driver eq 'sqlite' ? SQL_BLOB : undef;
+}
1;
Modified: trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm (original)
+++ trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToMany.pm Fri Apr 24 12:26:44 2009
@@ -14,7 +14,7 @@
use Rose::DB::Object::Constants qw(PRIVATE_PREFIX);
-our $VERSION = '0.779';
+our $VERSION = '0.781';
our $Debug = 0;
@@ -23,6 +23,7 @@
__PACKAGE__->add_common_method_maker_argument_names
(
qw(share_db map_class map_from map_to manager_class manager_method
+ manager_count_method manager_iterator_method manager_find_method
manager_args query_args map_record_method)
);
@@ -728,6 +729,14 @@
Get or set the name of the L<manager_class|/manager_class> class method to call when fetching records. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects|Rose::DB::Object::Manager/get_objects> if this value is left undefined.
+=item B<manager_count_method [METHOD]>
+
+Get or set the name of the L<manager_class|/manager_class> class method to call when counting objects. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects_count|Rose::DB::Object::Manager/get_objects_count> if this value is left undefined.
+
+=item B<manager_iterator_method [METHOD]>
+
+Get or set the name of the L<manager_class|/manager_class> class method to call when creating an iterator. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects_iterator|Rose::DB::Object::Manager/get_objects_iterator> if this value is left undefined.
+
=item B<manager_args [HASHREF]>
Get or set a reference to a hash of name/value arguments to pass to the L<manager_method|/manager_method> when fetching objects. For example, this can be used to enforce a particular sort order for objects fetched via this relationship. Modifying the L<example|/EXAMPLE> above:
Modified: trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToOne.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToOne.pm?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToOne.pm (original)
+++ trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/ManyToOne.pm Fri Apr 24 12:26:44 2009
@@ -11,14 +11,15 @@
use Rose::Object::MakeMethods::Generic;
use Rose::DB::Object::MakeMethods::Generic;
-our $VERSION = '0.780';
+our $VERSION = '0.781';
__PACKAGE__->default_auto_method_types(qw(get_set_on_save delete_on_save));
__PACKAGE__->add_common_method_maker_argument_names
(
qw(class share_db key_columns required manager_class manager_method
- manager_args query_args join_args object_args)
+ manager_count_method manager_iterator_method manager_find_method
+ manager_delete_method manager_args query_args join_args object_args)
);
use Rose::Object::MakeMethods::Generic
@@ -375,6 +376,18 @@
Get or set the name of the L<manager_class|/manager_class> class method to call when fetching the object.
+=item B<manager_count_method [METHOD]>
+
+Get or set the name of the L<manager_class|/manager_class> class method to call when counting objects. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects_count|Rose::DB::Object::Manager/get_objects_count> if this value is left undefined.
+
+=item B<manager_iterator_method [METHOD]>
+
+Get or set the name of the L<manager_class|/manager_class> class method to call when creating an iterator. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects_iterator|Rose::DB::Object::Manager/get_objects_iterator> if this value is left undefined.
+
+=item B<manager_delete_method [METHOD]>
+
+Get or set the name of the L<manager_class|/manager_class> class method to call when deleting objects. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<delete_objects|Rose::DB::Object::Manager/delete_objects> if this value is left undefined.
+
=item B<manager_args [HASHREF]>
Get or set a reference to a hash of name/value arguments to pass to the L<manager_method|/manager_method> when fetching the object. See the documentation for L<Rose::DB::Object::Manager>'s L<get_objects|Rose::DB::Object::Manager/get_objects> method for a full list of valid arguments for use with the C<manager_args> parameter.
Modified: trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/OneToMany.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/OneToMany.pm?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/OneToMany.pm (original)
+++ trunk/librose-db-object-perl/lib/Rose/DB/Object/Metadata/Relationship/OneToMany.pm Fri Apr 24 12:26:44 2009
@@ -12,13 +12,15 @@
our $Debug = 0;
-our $VERSION = '0.779';
+our $VERSION = '0.781';
__PACKAGE__->default_auto_method_types(qw(find get_set_on_save add_on_save));
__PACKAGE__->add_common_method_maker_argument_names
(
- qw(class share_db key_columns manager_class manager_method manager_args query_args join_args)
+ qw(class share_db key_columns manager_class manager_method
+ manager_count_method manager_iterator_method manager_find_method
+ manager_args query_args join_args)
);
use Rose::Object::MakeMethods::Generic
@@ -279,6 +281,14 @@
=item B<manager_method [METHOD]>
Get or set the name of the L<manager_class|/manager_class> class method to call when fetching objects. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects|Rose::DB::Object::Manager/get_objects> if this value is left undefined.
+
+=item B<manager_count_method [METHOD]>
+
+Get or set the name of the L<manager_class|/manager_class> class method to call when counting objects. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects_count|Rose::DB::Object::Manager/get_objects_count> if this value is left undefined.
+
+=item B<manager_iterator_method [METHOD]>
+
+Get or set the name of the L<manager_class|/manager_class> class method to call when creating an iterator. The L<make_methods|Rose::DB::Object::Metadata::Relationship/make_methods> method will use L<get_objects_iterator|Rose::DB::Object::Manager/get_objects_iterator> if this value is left undefined.
=item B<manager_args [HASHREF]>
Modified: trunk/librose-db-object-perl/t/00-warning.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/t/00-warning.t?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/t/00-warning.t (original)
+++ trunk/librose-db-object-perl/t/00-warning.t Fri Apr 24 12:26:44 2009
@@ -72,7 +72,9 @@
eval { require DBD::SQLite };
-if(!$@ && $DBD::SQLite::VERSION >= 1.13)
+(my $version = $DBD::SQLite::VERSION || 0) =~ s/_//g;
+
+if(!$@ && ($version < 1.11 || ($version >= 1.13 && $version < 1.1902)))
{
print STDERR<<"EOF";
@@ -84,7 +86,7 @@
*** http://rt.cpan.org/Public/Bug/Display.html?id=21472
***
*** The SQLite tests will be skipped. Please install DBD::SQLite 1.12
-*** or a version that fixes the bugs in 1.13 and 1.14.
+*** or version 1.19_02 or later.
***
*** Press return to continue (or wait 60 seconds)
EOF
Modified: trunk/librose-db-object-perl/t/db-object-relationship.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/t/db-object-relationship.t?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/t/db-object-relationship.t (original)
+++ trunk/librose-db-object-perl/t/db-object-relationship.t Fri Apr 24 12:26:44 2009
@@ -2,7 +2,7 @@
use strict;
-use Test::More tests => 1598;
+use Test::More tests => 1603;
BEGIN
{
@@ -4523,7 +4523,7 @@
SKIP: foreach my $db_type ('sqlite')
{
- skip("SQLite tests", 460) unless($HAVE_SQLITE);
+ skip("SQLite tests", 465) unless($HAVE_SQLITE);
Rose::DB->default_type($db_type);
@@ -4672,6 +4672,25 @@
MySQLiteObject->meta->delete_relationship('not_other2_objs');
# End experiment
+
+ # Begin manager_*_method tests
+ my $manager_method_obj = MySQLiteObject->new(id => $o->id)->load;
+
+ is($manager_method_obj->custom_manager_method_other2_objs, 'ima-get-objects',
+ "custom manager method ima-get-objects - $db_type");
+
+ is($manager_method_obj->meta->relationship('custom_manager_method_other_obj_msoft')->manager_delete_method,
+ 'other_obj_delete', "custom manager method ima-delete - $db_type");
+
+ is($manager_method_obj->find_custom_manager_method_other2_objs, 'ima-find',
+ "custom manager method ima-find - $db_type");
+
+ is($manager_method_obj->custom_manager_method_other2_objs_iterator, 'ima-iterator',
+ "custom manager method ima-iterator - $db_type");
+
+ is($manager_method_obj->custom_manager_method_other2_objs_count, 'ima-count',
+ "custom manager method ima-count - $db_type");
+ # End manager_*_method tests
# Begin filtered collection tests
@@ -7798,6 +7817,45 @@
#column_map => { id => 'pid' },
query_args => [ id => { ne_sql => 'pid' } ],
},
+
+ # manager_*_methods
+ custom_manager_method_other2_objs =>
+ {
+ type => 'one to many',
+ class => 'MySQLiteOtherObject2',
+ manager_class => 'MySQLiteOtherObject2::Manager',
+ manager_method => 'other2_objs',
+ manager_count_method => 'other2_objs_count',
+ manager_iterator_method => 'other2_objs_iterator',
+ manager_find_method => 'other2_objs_find',
+ column_map => { id => 'pid' },
+ methods =>
+ {
+ count => undef,
+ find => undef,
+ iterator => undef,
+ get_set => undef,
+ get_set_now => undef,
+ get_set_on_save => undef,
+ },
+ },
+
+ custom_manager_method_other_obj_msoft =>
+ {
+ type => 'many to one',
+ class => 'MySQLiteOtherObject',
+ column_map =>
+ {
+ fk1 => 'k1',
+ fk2 => 'k2',
+ fk3 => 'k3',
+ },
+ referential_integrity => 0,
+ with_column_triggers => 1,
+ manager_class => 'MySQLiteOtherObject::Manager',
+ manager_delete_method => 'other_obj_delete', # TODO this not yet exercised
+ },
+
);
MySQLiteObject->meta->alias_column(fk1 => 'fkone');
@@ -7888,6 +7946,18 @@
);
MySQLiteOtherObject2->meta->initialize;
+
+ # Manager used only for custom manager_*_methods
+ package MySQLiteOtherObject2::Manager;
+
+ sub other2_objs { 'ima-get-objects' }
+ sub other2_objs_count { 'ima-count' }
+ sub other2_objs_iterator { 'ima-iterator' }
+ sub other2_objs_find { 'ima-find' }
+
+ package MySQLiteOtherObject::Manager;
+
+ sub other_obj_delete { 'ima-delete' } # TODO this not yet exercised
package MySQLiteColor;
Modified: trunk/librose-db-object-perl/t/db-object.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/t/db-object.t?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/t/db-object.t (original)
+++ trunk/librose-db-object-perl/t/db-object.t Fri Apr 24 12:26:44 2009
@@ -2,7 +2,7 @@
use strict;
-use Test::More tests => 566;
+use Test::More tests => 567;
BEGIN
{
@@ -942,7 +942,7 @@
SKIP: foreach my $db_type ('sqlite')
{
- skip("SQLite tests", 73) unless($HAVE_SQLITE);
+ skip("SQLite tests", 74) unless($HAVE_SQLITE);
Rose::DB->default_type($db_type);
@@ -1133,6 +1133,17 @@
ok(!$o->load(speculative => 1), "load() speculative explicit 2 - $db_type");
eval { $o->load(speculative => 0) };
ok($@, "load() non-speculative explicit 2 - $db_type");
+
+ #
+ # Test SQLite BLOB support
+ #
+
+ my $blob = "abc\0def";
+ $o = MySQLiteObject->new(id => 888, name => 'Blob', data => $blob);
+ $o->save;
+
+ $o = MySQLiteObject->new(id => $o->id)->load;
+ is($o->data, $blob, "blob check - $db_type");
}
SKIP: foreach my $db_type (qw(oracle))
@@ -1878,6 +1889,7 @@
start DATE,
save INT,
nums VARCHAR(255),
+ data BLOB,
last_modified TIMESTAMP,
date_created TIMESTAMP,
@@ -1926,6 +1938,7 @@
nums => { type => 'array' },
bitz => { type => 'bitfield', bits => 5, default => 101, alias => 'bits' },
decs => { type => 'decimal', precision => 10, scale => 2 },
+ data => { type => 'blob' },
#last_modified => { type => 'timestamp' },
date_created => { type => 'scalar' },
main::nonpersistent_column_definitions(),
@@ -1942,7 +1955,7 @@
name => 'last_modified'));
MySQLiteObject->meta->column('id')->add_trigger(inflate => sub { defined $_[1] ? [ $_[1] ] : undef });
- MySQLiteObject->meta->column('id')->add_trigger(deflate => sub { ref $_[1] ? @{$_[1]} : $_[1] });
+ MySQLiteObject->meta->column('id')->add_trigger(deflate => sub { ref $_[1] ? (wantarray ? @{$_[1]} : $_[1]->[0]) : $_[1] });
my $pre_inited = 0;
MySQLiteObject->meta->pre_init_hook(sub { $pre_inited++ });
Modified: trunk/librose-db-object-perl/t/deep-joins.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/t/deep-joins.t?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/t/deep-joins.t (original)
+++ trunk/librose-db-object-perl/t/deep-joins.t Fri Apr 24 12:26:44 2009
@@ -1962,7 +1962,9 @@
{
my($db_type) = shift;
- if($db_type eq 'sqlite' && $DBD::SQLite::VERSION < 1.11)
+ (my $version = $DBD::SQLite::VERSION) =~ s/_//g;
+
+ if($db_type eq 'sqlite' && $version < 1.11)
{
return 1;
}
Modified: trunk/librose-db-object-perl/t/test-lib.pl
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/librose-db-object-perl/t/test-lib.pl?rev=33890&op=diff
==============================================================================
--- trunk/librose-db-object-perl/t/test-lib.pl (original)
+++ trunk/librose-db-object-perl/t/test-lib.pl Fri Apr 24 12:26:44 2009
@@ -141,9 +141,9 @@
require DBD::SQLite;
};
- my $version = $DBD::SQLite::VERSION || 0;
-
- unless($ENV{'RDBO_NO_SQLITE'} || $version < 1.11 || $version >= 1.13)
+ (my $version = $DBD::SQLite::VERSION || 0) =~ s/_//g;
+
+ unless($ENV{'RDBO_NO_SQLITE'} || $version < 1.11 || ($version >= 1.13 && $version < 1.1902))
{
#unlink("$Bin/sqlite.db");
More information about the Pkg-perl-cvs-commits
mailing list