[Dbix-class] Extracting ORDER BY clause

Robert Kinyon rob.kinyon at gmail.com
Tue Jul 5 12:41:51 GMT 2011


On Tue, Jul 5, 2011 at 02:54, Dmitry Belyavsky <beldmit at gmail.com> wrote:
> Greetings!
>
> On Tue, Jul 5, 2011 at 10:47 AM, Marc Logghe <logghe.marc at gmail.com> wrote:
>> Hi,
>>>
>>> So I want smth like
>>>
>>> my $rs = $schema->resultset("Client")->search({name => 'Ivan'},
>>> {order_by => 'created'});
>>> my $order_str = $rs->_get_order_by_any_way();
>>>
>>> How can I get it?
>>>
>>  Did not test this. But you might call $rs->as_query which returns an array
>> ref. The first element in that array is the SQL. You can fish out the order
>> by using a regex or split.
>
> Yes, just now I do so. But I want to find more common way.

There are no simple introspection methods on a resultset. Every so
often, someone asks for pieces of it, but no-one has actually worked
on building it properly.

Rob



More information about the DBIx-Class mailing list