[Dbix-class] Re: ResultSet columns attribute broken?
Benjamin Schuster-Boeckler
bendaboots at gmx.de
Fri May 1 12:33:26 GMT 2009
On 1 May 2009, at 09:40, Peter Rabbitson wrote:
> Benjamin Schuster-Boeckler wrote:
>>> Bernhard Graf wrote:
>>>> Peter Rabbitson wrote:
>>>>
>>>>> Yes because you are looking at TODO tests, don't worry about
>>>>> those.
>>>>> I was actually asking if your live development code works, not the
>>>>> test suite. Once we confirm that we have fixed your problem we
>>>>> will
>>>>> release another DBIC version.
>>>>
>>>> Ah, ok.
>>>>
>>>> So I did install and - YES - it works fine!
>>>>
>>>> Thanks for your patience. ;-)
>>>
>>> 0.08102 now on CPAN, includes the above fix.
>>>
>>> Cheers
>>>
>>
>> I'm sorry to say, but I still get this error. I have the following
>> query
>> (from within Catalyst):
>>
>> $c->model('DB::Line')->search({ 'types.name' => {'!=',
>> 'Connection'} },
>> { join =>
>> [qw/ types /],
>> prefetch =>
>> [qw/ types /],
>> select =>
>> [qw/me.name types.name/],
>> distinct
>> => 1,
>> order_by =>
>> [qw/types.name me.name/]
>> }
>>
>> This used to work just fine, until 0.0810x. Now I get
>>
>> DBIx::Class::ResultSet::search(): Column type not loaded or not
>> passed
>> to new() prior to insert() on
>> TMEditor::Model::DB::Line=HASH(0x2662620)
>> trying to resolve relationship (maybe you forgot to call
>> ->reload_from_storage to get defaults from the db)
>>
>> I tried adding
>>
>> +columns => ['types.name']
>>
>> but that didn't do anything. Any suggestions?
>>
>
> Please show me the class definition of both DB::Line and the types
> class.
> I need to see column definitions and relationships.
Hi,
I tested reverting to older version yesterday and realised the problem
also existed in 0.08099. But it definitely works fine in 0.08012.
Here are the classes:
DB::Line:
---------------
package TMEditor::Schema::Line;
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components("Core");
__PACKAGE__->table("line");
__PACKAGE__->add_columns(
"auto_line",
{ data_type => "INT", default_value => undef, is_nullable => 0,
size => 11 },
"name",
{ data_type => "VARCHAR", default_value => "", is_nullable => 0,
size => 50 },
"source",
{
data_type => "VARCHAR",
default_value => undef,
is_nullable => 1,
size => 10,
},
"notes",
{
data_type => "TEXT",
default_value => undef,
is_nullable => 1,
size => 65535,
},
"colour",
{ data_type => "VARCHAR", default_value => undef, is_nullable => 1,
size => 7 },
"pattern",
{
data_type => "VARCHAR",
default_value => undef,
is_nullable => 1,
size => 15,
},
"type",
{ data_type => "SMALLINT", default_value => 0, is_nullable => 0,
size => 1 },
);
__PACKAGE__->set_primary_key("auto_line");
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-09 20:03:05
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/D7zAsgG0utHRX9JYVWSCA
__PACKAGE__->has_many(stops => 'TMEditor::Schema::Stop', 'auto_line');
__PACKAGE__->has_many(distances => 'TMEditor::Schema::Distance',
'auto_line');
__PACKAGE__->has_many(times => 'TMEditor::Schema::Timetable',
'auto_line');
__PACKAGE__->has_many(alltimes => 'TMEditor::Schema::FullTimetable',
'auto_line');
__PACKAGE__->belongs_to(types => 'TMEditor::Schema::LineTypes',
{ 'foreign.type_id' => 'self.type' });
# You can replace this text with custom content, and it will be
preserved on regeneration
1;
---------------
and DB::LineTypes:
---------------
package TMEditor::Schema::LineTypes;
use strict;
use warnings;
use base 'DBIx::Class';
__PACKAGE__->load_components("Core");
__PACKAGE__->table("line_types");
__PACKAGE__->add_columns(
"type_id",
{ data_type => "SMALLINT", default_value => "", is_nullable => 0,
size => 5 },
"name",
{
data_type => "VARCHAR",
default_value => undef,
is_nullable => 1,
size => 20,
},
);
__PACKAGE__->set_primary_key("type_id");
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2009-04-09 20:03:05
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:HXq2HUrF82EnH96avEgBkw
__PACKAGE__->has_many(lines => 'TMEditor::Schema::Line',
{ 'foreign.type' => 'self.type_id' });
# You can replace this text with custom content, and it will be
preserved on regeneration
1;
---------------
More information about the DBIx-Class
mailing list