[Dbix-class] Oracle xmltype

Matt S Trout dbix-class at trout.me.uk
Tue May 5 11:05:56 GMT 2009


On Mon, May 04, 2009 at 07:02:15AM -0700, Morgon Hed wrote:
> 
> > http://search.cpan.org/~ribasushi/DBIx-Class-0.08102/lib/DBIx/Class/Manual/Cookbook.pod#Using_database_functions_or_stored_procedures
> 
> Thanks for the link.
> 
> My fundamental problem is that I more and more come to the conclusion that DBIx::Class is just not for me as I don't understand it.
> 
> I simply have no systematic overview about what the individual components are supposed to model and I can't find any documentation that would explain that in any way that is accessible to me ... 
> 
> Here's one example:
> 
> In the spirit of your link I can do this:
> 
> 
> $schema->resultset('Stream')->search(
>                                                {},
>                                                    {
>                                                      select => [ { 'xmltype.getCLobVal' => 'xml' } ],
>                                                      as     => ['xml'],
>                                                    }
>                                              );
> 
> 
> And this works - I can retrieve the XML with that but that is not what I ultimately want.
> 
> I don't want to mention each and every attribute again in the above search (the above search retrieves the XML-field only), all I want is a way to tell DBIx::Class to treat one column a slightly little bit different from the others - and I want to tell that DBIx::Class on the object-level, not by basically supplying my own SQL.

You can set '+select' and '+as', and stick that in a resultset method, so
the code just becomes

$stream_rs->with_xml_field->...

> I am pretty sure that DBIx::Class is well thought out and capable but for me it seems it makes hard things possible at the price of making simple things hard (at least for newbies).

Hopefully http://search.cpan.org/perldoc?DBIx::Class::Manual::Glossary will
clarify what all the bits are - ::DocMap may also be your friend.

-- 
        Matt S Trout         Catalyst and DBIx::Class consultancy with a clue
     Technical Director      and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.uk        http://shadowcat.co.uk/blog/matt-s-trout/



More information about the DBIx-Class mailing list