I'm trying to do a query against a table "products" and a subtable
"productlocs" via a relationship called "sources".  I've produced the
following debugging info:

Rose::DB - 0.734, Rose::DB::Object - 0.764, Rose::DB::Object::Manager -
0.764, Server - "bullseye"
Query is combined viz:
prodcode => {'like' => "%shp%"}
productlocs.loccode => {'like' => "%mtg%"}
Status => {'ne' => "P"}
with_objects => productlocs

which seems OK to me and if I don't include the "productlocs.loccode"
component, it works.  But Rose crashes with the following:

Rose::DB::Object::Manager - no foreign key or relationship named
'productlocs' at C:/Perl/site/lib/Rose/DB/Object/Manager.pm line 717
        Rose::DB::Object::Manager::get_objects('Rose::DB::Object::Manager',
'object_class', 'MG::Product', 'query', 'ARRAY(0x24f5b78)', 'with_objects',
'ARRAY(0x24f5b90)') called at db.pl line 349
        main::search_results('products', 'HASH(0x236529c)') called at db.pl 
line 40

which I understand to mean that it doesn't like "productlocs.loccode" - it
wants the relationship name i.e. I should be using "sources.loccode".  Which
would be fine except that the Rose::DB::Object::Manager documentation says:

# We need to disambiguate the "name" column below since it
# appears in more than one table referenced by this query.
# When more than one table is queried, the tables have numbered
# aliases starting from the "main" table ("products").  The
# "products" table is t1, "categories" is t2, and "code_names"
# is t3.  You can read more about automatic table aliasing in
# the documentation for the get_objects() method below.
#
# "category.name" and "categories.name" would work too, since
# table and relationship names are also valid prefixes.

I expect I'm misunderstanding something as usual.  But if the documentation
is right, then shouldn't the error message say "no foreign key or
relationship or table named..."?  i.e. the error message seems to match the
result but not the documentation.

thanks,


James.

Masters Traditional Games
+44 (0)1727 855058
http://www.mastersgames.com




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to