kulls has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I have successfully compiled the arbitary query in catalyst as mentioned here.
But It generates the incorrect sql statement which I have mentioned below
SELECT * FROM ( SELECT * from test where name='?' ) me: 'raja'

Below is the call from the controller
my $friends = [ $c->model('DB')->resultset('Metrics')->search ( {}, { bind => ['raja' ] } )];

Is there any parameter/settings that I need to include in the model class ?.
Raja

Update :
It's working fine . I have removed the quotes in the place holder as well as minor changes in my model class.

Replies are listed 'Best First'.
Re: catalyst Arbitary query
by Your Mother (Archbishop) on Jul 01, 2010 at 17:40 UTC

    You can also make it more terse/idiomatic like so–

    my $friend_rs = $c->model("DB::Metrics") ->search({}, { bind => ["raja"] });

    Catalyst's DBIC model rolls up the resultsets for you.

    (Update: corrected embarrassing typo.)