Skip to content

Create assigning part in update statement

yuki-kimoto edited this page Nov 8, 2012 · 1 revision

Create assigning part in update statement

DBIx::Custom Documents >

Create assiging part in update statement by assign_clause method.

my $param = {id => 1, title => 'Perl'};
my $assign_clause = $dbi->assign_clause($param);

This the following string.

id = :id, title = :title

You can create update statement using this.

my $update_sql = "update book set $assign_clause";

You can execute this SQL by execute method.

$dbi->execute($update_sql, $param);
Clone this wiki locally