[Dbix-class] weird behaviour of a DBIC schema in Catalyst context
Florian Ragwitz
rafl at debian.org
Tue Jun 20 17:32:33 CEST 2006
Hello,
I wrote a small DBIC schema which has a ResultSource for a view called
foo. This view as a column called bar which usually looks like that:
Foo Bar <foo at bar.com>
I also wrote some tests to verify that the content of the bar column
looks like that and the tests pass.
Now I wanted to use the schema as a Catalyst model using
C::M::DBIC::Schema. Now, the same query on the foo resultset returns a
row object which bar accessor returns something in the form of:
Foo bar <foo at bar.com>
which is not what I expected. I did some debugging and found out that
there's a difference in what
$self->{sth}->fetchrow_array
returns in DBIx::Class::Storage::DBI::Cursor::next. I have no idea what
could cause this diferences. Attached are two logs of interactive
debugging sessions.
Any idea what's going wrong here?
TIA,
Flo
--
BOFH excuse #336:
the xy axis in the trackball is coordinated with the summer solstice
-------------- next part --------------
rafl at ata ~/projects/perl/BugStats > perl -Ilib -d t/model_DebianDB.t < 20.06.06 16:08:51 >
Loading DB routines from perl5db.pl version 1.28
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
1..7
ok 1 - use DebianDB;
main::(t/model_DebianDB.t:7): my $schema = DebianDB->clone->connect( 'dbi:Pg:host=localhost;dbname=bugstats', 'bugstats', 'bugstats' );
DB<1> r
ok 2 - The object isa DBIx::Class::Schema
ok 3 - The object isa DBIx::Class::ResultSet
ok 4 - The object isa DBIx::Class::ResultSet
main::(t/model_DebianDB.t:19): my $rafl = $rs->first;
ok 5
DB<1> b DBIx::Class::Storage::DBI::Cursor::next
DB<2> r
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:69):
69: my ($self) = @_;
DB<2> l
69==>b my ($self) = @_;
70
71: $self->_check_forks_threads;
72: if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) {
73: $self->{sth}->finish if $self->{sth}->{Active};
74: delete $self->{sth};
75: $self->{done} = 1;
76 }
77: return if $self->{done};
78: unless ($self->{sth}) {
DB<2> n
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:71):
71: $self->_check_forks_threads;
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:72):
72: if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) {
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:77):
77: return if $self->{done};
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:78):
78: unless ($self->{sth}) {
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:79):
79: $self->{sth} = ($self->{storage}->_select(@{$self->{args}}))[1];
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:79):
79: $self->{sth} = ($self->{storage}->_select(@{$self->{args}}))[1];
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:80):
80: if ($self->{attrs}{software_limit}) {
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:86):
86: my @row = $self->{sth}->fetchrow_array;
DB<2> x $self->{sth}
0 DBI::st=HASH(0x8b89bb0)
empty hash
DB<3> x $self->{sth}->fetchrow_array
0 1821
1 'Florian Ragwitz'
2 'florian at mookooh.org'
3 'Florian Ragwitz <florian at mookooh.org>'
DB<4>
-------------- next part --------------
131 rafl at ata ~/projects/perl/BugStats > DBIX_CLASS_STORAGE_DBI_DEBUG=1 perl -d ./script/bugstats_server.pl -r < 20.06.06 16:12:05 >
Loading DB routines from perl5db.pl version 1.28
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(./script/bugstats_server.pl:14):
14: my $debug = 0;
DB<1> r
[Tue Jun 20 16:12:07 2006] [catalyst] [debug] Debug messages enabled
[Tue Jun 20 16:12:07 2006] [catalyst] [debug] Loaded plugins:
.------------------------------------------------------------------------------.
| Catalyst::Plugin::StackTrace 0.04 |
| Catalyst::Plugin::ConfigLoader 0.06 |
| Catalyst::Plugin::DefaultEnd 0.05 |
| Catalyst::Plugin::Static::Simple 0.14 |
'------------------------------------------------------------------------------'
[Tue Jun 20 16:12:07 2006] [catalyst] [debug] Loaded dispatcher "Catalyst::Dispatcher"
[Tue Jun 20 16:12:07 2006] [catalyst] [debug] Loaded engine "Catalyst::Engine::HTTP::Restarter"
[Tue Jun 20 16:12:07 2006] [catalyst] [debug] Found home "/home/rafl/projects/perl/BugStats"
[Tue Jun 20 16:12:10 2006] [catalyst] [debug] Loaded components:
.-------------------------------------------------------------------+----------.
| Class | Type |
+-------------------------------------------------------------------+----------+
| BugStats::Controller::Root | instance |
| BugStats::Controller::Stats | instance |
| BugStats::Model::DebianDB | instance |
| BugStats::Model::DebianDB::BinaryPackage | class |
| BugStats::Model::DebianDB::Person | class |
| BugStats::Model::DebianDB::PersonAlias | class |
| BugStats::Model::DebianDB::PersonDetail | class |
| BugStats::Model::DebianDB::SourcePackage | class |
| BugStats::Model::DebianDB::Uploaders | class |
| BugStats::Model::Update | class |
| BugStats::View::TT | instance |
'-------------------------------------------------------------------+----------'
[Tue Jun 20 16:12:10 2006] [catalyst] [debug] Loaded Private actions:
.----------------------+----------------------------------------+--------------.
| Private | Class | Method |
+----------------------+----------------------------------------+--------------+
| /default | BugStats::Controller::Root | default |
| /end | BugStats | end |
| /stats/default | BugStats::Controller::Stats | default |
| /stats/process | BugStats::Controller::Stats | process |
| /stats/list | BugStats::Controller::Stats | list |
'----------------------+----------------------------------------+--------------'
[Tue Jun 20 16:12:10 2006] [catalyst] [debug] Loaded Path actions:
.--------------------------------------+---------------------------------------.
| Path | Private |
+--------------------------------------+---------------------------------------+
| /stats/list | /stats/list |
'--------------------------------------+---------------------------------------'
[Tue Jun 20 16:12:10 2006] [catalyst] [info] BugStats powered by Catalyst 5.6902
You can connect to your server at http://ata:3000
BugStats::Controller::Stats::list(/home/rafl/projects/perl/BugStats/script/../lib/BugStats/Controller/Stats.pm:41):
41: $c->stash->{maintainers} = $c->model('DebianDB')->resultset('PersonDetail')->search(undef, {
42: page => $page,
43: rows => $rows,
44: order_by => 'fullname',
DB<1> b DBIx::Class::Storage::DBI::Cursor::next
DB<2> r
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:69):
69: my ($self) = @_;
DB<2> l
69==>b my ($self) = @_;
70
71: $self->_check_forks_threads;
72: if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) {
73: $self->{sth}->finish if $self->{sth}->{Active};
74: delete $self->{sth};
75: $self->{done} = 1;
76 }
77: return if $self->{done};
78: unless ($self->{sth}) {
DB<2> n
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:71):
71: $self->_check_forks_threads;
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:72):
72: if ($self->{attrs}{rows} && $self->{pos} >= $self->{attrs}{rows}) {
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:77):
77: return if $self->{done};
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:78):
78: unless ($self->{sth}) {
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:79):
79: $self->{sth} = ($self->{storage}->_select(@{$self->{args}}))[1];
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:79):
79: $self->{sth} = ($self->{storage}->_select(@{$self->{args}}))[1];
DB<2>
SELECT me.id, me.name, me.email, me.fullname FROM person_detail me ORDER BY fullname LIMIT 10 OFFSET 20 ()
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:80):
80: if ($self->{attrs}{software_limit}) {
DB<2>
DBIx::Class::Storage::DBI::Cursor::next(/usr/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm:86):
86: my @row = $self->{sth}->fetchrow_array;
DB<2> x $self->{sth}
0 DBI::st=HASH(0x9856ad8)
empty hash
DB<3> x $self->{sth}->fetchrow_array
0 1346
1 'Adam Kessel'
2 'ajkessel at debian.org'
3 'Adam Kessel <ajkessel at debian.org>'
DB<4>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060620/c66070ee/attachment.pgp
More information about the Dbix-class
mailing list