[Dbix-class] feedback on cookbook "arbitrary sql" example
Terrence Brannon
schemelab at gmail.com
Thu Mar 25 20:21:53 GMT 2010
This email concerns
http://search.cpan.org/~ribasushi/DBIx-Class-0.08120/lib/DBIx/Class/Manual/Cookbook.pod#Arbitrary_SQL_through_a_custom_ResultSource
The first thing is that the ->table ->add_columns line is commented out:
# ->table, ->add_columns, etc.
And it therefore seemed optional.
But if you dont use ->table() you get some odd errors.
Next, if you want to find out how to use ->table(), common sense would
point you to DBIx::Class::Core docs (
http://search.cpan.org/~ribasushi/DBIx-Class-0.08120/lib/DBIx/Class/Core.pm
) but that is a top-level doc file with several sub files, none of
which obviously point to a ->table command
It turns out that the argument to ->table() is a view name.
Now, most importantly, I think this section should advise people to
create views in the database and have the ::Loader create a result
class for them unless they enjoy manually typing in column defs for
add_columns... there is no tool which selects a series of result
classes and the columns in them, and merges them into an add_columns
statement is there? Otherwise you have to manually copy/paste column
defs from all the tables you are joining.
More information about the DBIx-Class
mailing list