3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-26 13:59:47 +01:00

DualIndexSQLiteObject: quote unprepared keys

This commit is contained in:
Pragmatic Software 2020-04-29 20:01:49 -07:00
parent e1d1e83512
commit f23df0d4ac

View File

@ -683,7 +683,7 @@ sub remove {
if (defined $self->get_data($lc_index1, $lc_index2, $data_index)) {
eval {
my $sth = $self->{dbh}->prepare("UPDATE Stuff SET $data_index = ? WHERE index1 = ? AND index2 = ?");
my $sth = $self->{dbh}->prepare("UPDATE Stuff SET '$data_index' = ? WHERE index1 = ? AND index2 = ?");
$sth->execute(undef, $index1, $index2);
$self->{cache}->{$index1}->{$index2}->{$data_index} = undef;
@ -741,7 +741,7 @@ sub set {
if (not defined $value) { $value = $self->get_data($index1, $index2, $key); }
else {
eval {
my $sth = $self->{dbh}->prepare("UPDATE Stuff SET $key = ? WHERE index1 = ? AND index2 = ?");
my $sth = $self->{dbh}->prepare("UPDATE Stuff SET '$key' = ? WHERE index1 = ? AND index2 = ?");
$sth->execute($value, $index1, $index2);
my ($lc_index1, $lc_index2) = (lc $index1, lc $index2);
@ -787,7 +787,7 @@ sub unset {
}
eval {
my $sth = $self->{dbh}->prepare("UPDATE Stuff SET $key = ? WHERE index1 = ? AND index2 = ?");
my $sth = $self->{dbh}->prepare("UPDATE Stuff SET '$key' = ? WHERE index1 = ? AND index2 = ?");
$sth->execute(undef, $index1, $index2);
my ($lc_index1, $lc_index2) = (lc $index1, lc $index2);