[Dbix-class] Oracle xmltype

Matt S Trout dbix-class at trout.me.uk
Mon May 11 17:22:26 GMT 2009

On Tue, May 05, 2009 at 05:24:31AM -0700, Morgon Hed wrote:
> > You can set '+select' and '+as', and stick that in a
> > resultset method, so
> > the code just becomes
> > 
> > $stream_rs->with_xml_field->...
> Thanks for the reply but I don't quite understand what you are saying.
> I can easily do the follwing:
> my $s1 = $schema->resultset('Stream')->search(
>                                                {},
>                                                    {
>                                                      select => [ 'another_col', { 'xmltype.getCLobVal' => 'xml' } ],
>                                                      as     => [qw/another_col xml/],
>                                                    }
>                                              );
> Then I can of course retrieve more columns - why would I want to use '+select' (which is not even mentioned in the  DBIx::Class::ResultSet pod)?

Yes it is.

> And would that really mean that I have to declare all attributes via "add_columns" (so that accessors are generated) and then have to add them all again to the above search?

Using +select you'd only have to add the xml one *once*.

And you'd do that in a resultset method so you'd only have to type -that-

Please quit being combative and assuming things are harder than you think
they are, your problems are interesting but not -hard- to solve and while I'm
doing my best to help, your repeated default assumption that DBIC can't do
what you want rather than that you haven't been able to figure it out is
started to really piss me off - and that's not conducive to me wanting to
carry on helping you for free :P

        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