On Sun, 15 Jun 2008, James. L wrote:
hi,
trying to fetch rows with one field substringed
(mysql). the field is substringed but the result
contains one field only instead of all fields(there
are 10 fields per row). here is the code.
$rs = $rs->search( { user_id => $uid },
{
+select => [ "substring(content, 1,
100)" => 'content' ],
+as => [ qw/content/ ],
},
);
btw, there seems to be more than one way to call sql
function: +select => [ \"substring(content, 1, 100)" ]
is the same as above.
here is result of DBIC_TRACE:
SELECT substring(content, 1, 100), content FROM
reviews me WHERE ( user_id = ? ): '2'
10 fields per row? What does that mean? what SQL do you expect?
Your search call up there is broken because you ask for 2 columns on data
in "+select", but only have one name for them in "+as", you need to name
them both.
Jess
_______________________________________________
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/[EMAIL PROTECTED]