[Dbix-class] substring and +select

James. L perlwle at yahoo.com
Mon Jun 16 05:30:54 BST 2008


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'
 
what am i missing here?

James.


      



More information about the DBIx-Class mailing list