On Fri, 31 Jan 2014 16:47:26 +0100
Hugues <[email protected]> wrote:

> Hello  David
> query works well with  $sth->fetchall_arrayref but the result with 
> template toolkit doesn'work.
> 
> return template 'result' => {
>                                    resultC      =>
> $sth->fetchall_arrayref,
> 
> }

Bah, sorry.  That will return an arrayref of arrayrefs, one per DB
row.  Usually you'll want an arrayref of hashrefs, which is what your
template code is expecting.

The somewhat unintuitive syntax for that is:

$sth->fetchall_arrayref({});

Passing it an empty hashref as the slice param asks for each row to be
returned as a hashref.  See the DBI docs for further info.


-- 
David Precious ("bigpresh") <[email protected]>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github


_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to