[CDBI] Re: delete on table with multiple pks
Peter Speltz
peterspeltz at gmail.com
Mon Nov 28 16:57:21 GMT 2005
On 11/28/05, Perrin Harkins <perrin at elem.com> wrote:
> On Sun, 2005-11-27 at 23:47 -0600, Peter Speltz wrote:
> > Are you saying inflating key columns works fine in DBIx::Class?
>
> It works fine in Class::DBI with the one line patch I posted in June. I
> can re-send it later if you need it.
>
Thanks. I think i have it. Is this it ?
diff -r -u orig/Class-DBI-0.96/lib/Class/DBI/Relationship/HasA.pm
Class-DBI-0.96/lib/Class/DBI/Relationship/HasA.pm
--- orig/Class-DBI-0.96/lib/Class/DBI/Relationship/HasA.pm 2004-04-25
11:33:36.000000000 -0400
+++ Class-DBI-0.96/lib/Class/DBI/Relationship/HasA.pm 2005-05-27
14:43:36.000000000 -0400
@@ -23,6 +23,7 @@
my $column = $self->accessor;
return (
select => $self->_inflator,
+ after_create => $self->_inflator,
"after_set_$column" => $self->_inflator,
deflate_for_create => $self->_deflator(1),
deflate_for_update => $self->_deflator,
diff -r -u orig/Class-DBI-0.96/t/06-hasa.t Class-DBI-0.96/t/06-hasa.t
--- orig/Class-DBI-0.96/t/06-hasa.t 2003-08-19 12:50:07.000000000 -0400
+++ Class-DBI-0.96/t/06-hasa.t 2005-05-27 14:30:14.000000000 -0400
@@ -3,7 +3,7 @@
BEGIN {
eval "use DBD::SQLite";
- plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 24);
+ plan $@ ? (skip_all => 'needs DBD::SQLite for testing') : (tests => 25);
}
@YA::Film::ISA = 'Film';
@@ -164,3 +164,19 @@
isa_ok $foo, "Film", "Object in after_create trigger";
}
+# test has_a() on primary keys
+package MultiKey;
+use base 'CDBase';
+__PACKAGE__->table('multikey');
+__PACKAGE__->columns('Primary' => qw/ id film /);
+__PACKAGE__->has_a(film => "Film");
+__PACKAGE__->db_Main->do( qq{
+ CREATE TABLE multikey (
+ id INTEGER,
+ film VARCHAR(255)
+ )
+});
+
+package main;
+my $from_scalar = MultiKey->create({ id => 7, film => 'Bad Taste' });
+isa_ok($from_scalar->film(), "Film");
Only in Class-DBI-0.96/t: 06-hasa.t~
--
pjs
More information about the ClassDBI
mailing list