[Dbix-class] Custom ResultSource and 'in'

BUCHMULLER Norbert norbi.lists at nix.hu
Wed Apr 1 17:08:53 BST 2009


On Mon, 30 Mar 2009 12:49:03 -0500 Chris Burch wrote:

> Is there a way to get my array into that 'in(?)'?

If your RDBMS and DBD supports SQL arrays, then probably:

With the DBIx::Class 0.08100 release candidates (or trunk from
Subversion) and SQL::Abstract 1.51 DBIC passes arrayref bind parameters
down to DBI. From that point it depends on the DBD and the RDBMS - if it
can interpret it as an SQL array (eg. with PostgreSQL and DBD::Pg it
works). I can't test it on MS SQL Server, and I don't even know if it has
the concept of arrays. And probably you have to write the SQL a bit
differently, as IN doesn't take SQL arrays (eg. in PostgreSQL you would
have to write 't.sectionid = ANY (?)').

But, first of all, is it necessary to use a literal SQL based
ResultSource? I don't see anything in your SQL query that cannot be done
with pure DBIC..

norbi



More information about the DBIx-Class mailing list