Why are you defining this as a virtual view instead of just having a result
class for the table and adding a method to its resultset class?
BR, Alex
Am 2012-03-28 17:40, schrieb William Piel:
Hi all,
I'd like to create a custom ResultSource query that uses "IN" in the SQL. How
can I use the bind parameters so that I can pass an array to provide the
contents for IN(...) ? The below example works so long as @my_array has only
one element -- beyond that I get a mismatch in the number of placeholders.
Passing it \@my_array does not work.
thanks,
Bill
package My::Schema::Result::TableT;
use strict;
use warnings;
use base qw/DBIx::Class::Core/;
__PACKAGE__->table_class('DBIx::Class::ResultSet::View');
__PACKAGE__->result_source_instance->is_virtual(1);
__PACKAGE__->result_source_instance->view_definition(q[
SELECT t.x, t.y, t.z
FROM table t
WHERE t.a = ?
AND t.b IN (?);
]);
my $results = $schema->resultset( 'TableT' )->search( {}, { bind => [
$my_scalar, @my_array ]} );
_______________________________________________
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]
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
_______________________________________________
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]