summaryrefslogtreecommitdiff
path: root/bucky2/lib/Bucky
diff options
context:
space:
mode:
Diffstat (limited to 'bucky2/lib/Bucky')
-rw-r--r--bucky2/lib/Bucky/DB.pm10
1 files changed, 9 insertions, 1 deletions
diff --git a/bucky2/lib/Bucky/DB.pm b/bucky2/lib/Bucky/DB.pm
index 9690f40..682e48e 100644
--- a/bucky2/lib/Bucky/DB.pm
+++ b/bucky2/lib/Bucky/DB.pm
@@ -56,10 +56,18 @@ sub update
my $criteria_string = $self->criteria($criteria);
return unless length $criteria_string;
- my $sql = "UPDATE $type SET $key_value_string WHERE $criteria_string";
+ my $sql = "UPDATE $type SET $key_value_string $criteria_string";
$self->execute($sql);
}
+sub update_by_id
+ {
+ my ($self, $type, $opt) = @_;
+ my $id = $opt->{'id'} + 0;
+ $opt->{'criteria'} = "id=$id";
+
+ $self->update($type, $opt)
+ }
sub select
{
my ($self, $type, $criteria) = @_;