Revision 6bdcd838
Von Moritz Bunkus vor etwa 5 Jahren hinzugefügt
SL/DB/Helper/ActsAsList.pm | ||
---|---|---|
143 | 143 |
my $column = column_name($self); |
144 | 144 |
my $result = $self->db->with_transaction(sub { |
145 | 145 |
my $query = qq|UPDATE | . $self->meta->table . qq| SET ${column} = ? WHERE id = ?|; |
146 |
my $sth = $self->db->dbh->prepare($query) || die $self->db->dbh->errstr;
|
|
146 |
my $sth = $self->db->dbh->prepare($query) || SL::X::DBUtilsError->throw(msg => 'reorder_list error', db_error => $self->db->dbh->errstr);
|
|
147 | 147 |
|
148 | 148 |
foreach my $new_position (1 .. scalar(@ids)) { |
149 |
$sth->execute($new_position, $ids[$new_position - 1]) || die SL::X::DBUtilsError->new(error => $sth->errstr);
|
|
149 |
$sth->execute($new_position, $ids[$new_position - 1]) || SL::X::DBUtilsError->throw(msg => 'reorder_list error', db_error => $sth->errstr);
|
|
150 | 150 |
} |
151 | 151 |
|
152 | 152 |
$sth->finish; |
Auch abrufbar als: Unified diff
Module: Exception::Lite durch Exception::Class ersetzt