[Dbix-class] err messages, bug in search

Mark Hedges hedges at ucsd.edu
Fri Mar 31 01:07:02 CEST 2006


I guess there are error messages clucked from the code in
places where I do things wrong.  

But what does this mean?

DBIx::Class::ResultSet::find(): Don't know how to store prefetched <prefetched thing> at <my script> line 9

I was trying to use prefetch in a find().

When I tried a multi-level prefetch in a search, it didn't work.
Looking at the SQL log, it got all the joins right, but the
where clause used only the "where pk = searched_for_pk_value"
which mysql reports as "ambiguous field pk in where clause".

But if I were to use search_literal, the manual page would 
seem to indicate that I can't use prefetch.

Aha, I managed to trick search by saying 

    my $rs = $schema->resultset('Level1')->search( 
        {   'me.email' => $email },
        {   prefetch => {
                thing2s  => 'thing3',
            }
        },
    );

Seems like the where clause for a search should automatically
get a 'me.' prefix in case the joined tables in a prefetch have 
columns of the same name.  (In this case thing2 also has an 
email column, it is the fk.)

Mark



More information about the Dbix-class mailing list