Re: [CDBI] Weird things with has_a and lazy population
[prev]
[thread]
[next]
[Date index for 2005/11/17]
On Wed, 16 Nov 2005 13:26:23 -0500
Perrin Harkins <perrin@xxxx.xxx> wrote:
> >=20
> > then it just prints empty strings
>=20
> That's obviously broken, and you don't even have a has_a() on name().
> Forget the lazy-loading, has_a(), etc. and just figure out why name() is
> returning nothing when that row in the database has a value.
>=20
> - Perrin
>=20
Now i tried to make test more clear, without columns(Essential, but
still cant figure out what wrong:
> DBI Class:
package ClientApp::Domain;
use strict; =20
use base qw/Catalyst::Base ClientApp:DB/;
__PACKAGE__->set_up_table('my_domains')
__PACKAGE__->has_a(plan =3D> 'ClientApp::Plan'); =
=20
1;
> Client code:
my $domain =3D ClientApp::Domain->retrieve(1); # row actually exists in
database
print $domain->name; # --> empty
print $domain->plan; # --> empty
print ref($domain); # --> ClientApp::Domain
print Dumper($domain); # --> $VAR1 =3D bless( { 'id' =3D> '1' },'ClientAp=
p::Domain' );
> here is DBI->trace:
=2E...
T <- prepare_cached('SELECT id FROM my_domains WHERE id =3D ?
')=3D ( DBIx::ContextualFetch::st=3DHASH(0x8426a7c) ) [1 items] at DBI.pm
line 391
T <- FETCH('Active')=3D '' at DBI.pm line 1124
T <- FETCH('Taint')=3D 1 at ContextualFetch.pm line 49
<- STORE('Taint' 0)=3D 1 at ContextualFetch.pm line 50
<- execute(46)=3D 1 at ContextualFetch.pm line 51
T <- STORE('Taint' 1)=3D 1 at ContextualFetch.pm line 52
T <- FETCH('NAME_lc')=3D [ 'id' ] at DBI.pm line 1125
T <- bind_columns(SCALAR(0x84709f8))=3D 1 at DBI.pm line 1125
T <- fetchrow_arrayref=3D [ '46' ] row1 at ContextualFetch.pm line 59
T <- fetchrow_arrayref=3D undef row1 at ContextualFetch.pm line 59
<- disconnect_all=3D '' at DBI.pm line 677 =
=20
!T <- DESTROY(DBIx::ContextualFetch::st=3DHASH(8426a7c))=3D undef during g=
lobal des...
--=20
Dmitry <df2@xx.xx>
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi