[Dbix-class] question on syntax
Nigel Metheringham
nigel.metheringham at dev.intechnology.co.uk
Mon Feb 11 10:55:16 GMT 2008
On 11 Feb 2008, at 10:31, Peter Sørensen wrote:
> DELETE FROM authorized_users WHERE ( ( ( policy = ? ) AND ( email = ?
> ) ) ): 'policy1', 'IN(user1 at xx.com,user2 at xx.com )'
That should delete the entry from authorized_users where
policy = 'policy1'
AND
email = 'IN(user1 at xx.com,user2 at xx.com )' (ie literal string)
which you can probably see is not quite what you intended...
I think you want something like:-
if ( @{ $diff->deleted } ) {
my @del_list;
foreach my $val ( @{ $diff->deleted } ) {
push( @del_list, $val );
}
my $result_set =
$c->model('DLDB::Model::CatalystModelName::AuthorizedUsers')-
>search(
{
-and => [
{ 'policy' => $data->{policy} },
{ 'email' => { -in => \@del_list } }
]
}
)->delete;
}
Nigel.
--
[ Nigel Metheringham Nigel.Metheringham at InTechnology.co.uk ]
[ - Comments in this message are my own and not ITO opinion/policy - ]
More information about the DBIx-Class
mailing list