From 1a86ba1286ffaeee9ce32710dbdb8bb54bfc5b2e Mon Sep 17 00:00:00 2001 From: Kirill Solomko Date: Mon, 10 May 2021 15:30:48 +0200 Subject: [PATCH] TT#121854 check delete from non-existing table * cleanup_data(): - print error message when deletion from a table fails (usually a non-exiting table is provided) - amount of affected rows is set to 0 if undefined Change-Id: I066041aae5d6a65c766480a2bbaf976c6563d188 --- lib/NGCP/Cleanup.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/NGCP/Cleanup.pm b/lib/NGCP/Cleanup.pm index 67ec5d9..ce04306 100644 --- a/lib/NGCP/Cleanup.pm +++ b/lib/NGCP/Cleanup.pm @@ -655,6 +655,8 @@ SQL DELETE FROM $table WHERE $col < unix_timestamp(date(date_sub(now(), interval ? day))) $limit SQL } + $self->error("Cannot delete: $DBI:errstr") if $DBI::err; + $aff //= 0; $deleted_rows += $aff; last unless $aff > 0; }