* BUCHMULLER Norbert <[EMAIL PROTECTED]> [081014 08:20]:
> maybe it's a known issue, nevertheless, it's annoying.. The code below
> throws an exception:
>
> $schema->resultset('Artist')->search(
> {
> },
> {
> select => [ \'1 AS one' ],
> distinct => 1,
> }
> )->first;
>
> The exception:
>
> DBIx::Class::ResultSet::first(): DBI Exception: DBD::Pg::st execute
> failed: ERROR: syntax error at or near "AS" at character 43 [for
> Statement "SELECT 1 AS one FROM artist me GROUP BY 1 AS one"] at test.pl
> line 31
Try:
my $row = $schema->resultset('Artist')->search(
{
},
{
select => [ \'1' ],
as => [qw/one/],
distinct => 1,
}
)->first;
# SQL: SELECT 1 FROM artist me GROUP BY 1
print $row->get_column('one');
# output: 1
-Marc
_______________________________________________
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]