[CDBI] result from 'search_where' to 'update'

Cyril Cheneson ccheneson at gmail.com
Tue Apr 14 10:17:01 BST 2009


Hi everybody

I m querying a Mysql db via the 'search_where' method which returns an iterator.

But when I m trying to update a field for each record found, this
doesnt seem to work

##############################
Id is a array ref and $userid a scalar


    my $msgs = Messages->search_where(
        id => $messageIds, user_id => $userid
    );

    while (my $msg = $msgs->next) {
            $msg->$col($value);
            $msg->update;
    }

##############################

Has anyone seen this problem/behaviour before?

I also tried
$msg->set($col => $value);
but without any success either.

so I m not sure if the
$msg->$col($value)
is evaluated properly (I also tried to eval this , same result)

Thanks a lot

Cyril



More information about the ClassDBI mailing list