[Dbix-class] Oracle xmltype
Morgon Hed
morgonhed at yahoo.com
Tue May 5 12:24:31 GMT 2009
> 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)?
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?
--- On Tue, 5/5/09, Matt S Trout <dbix-class at trout.me.uk> wrote:
> From: Matt S Trout <dbix-class at trout.me.uk>
> Subject: Re: [Dbix-class] Oracle xmltype
> To: "DBIx::Class user and developer list" <dbix-class at lists.scsys.co.uk>
> Date: Tuesday, May 5, 2009, 7:05 AM
> 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/
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk
>
More information about the DBIx-Class
mailing list