From 9731f49a62660aceae17384f6d373acc526b03dc Mon Sep 17 00:00:00 2001 From: Will Budic Date: Sun, 23 Feb 2020 11:20:54 +1100 Subject: [PATCH] Added extra check exception on update notes, check. --- htdocs/cgi-bin/system/modules/Settings.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/htdocs/cgi-bin/system/modules/Settings.pm b/htdocs/cgi-bin/system/modules/Settings.pm index 20dbe2f..b48ec7d 100644 --- a/htdocs/cgi-bin/system/modules/Settings.pm +++ b/htdocs/cgi-bin/system/modules/Settings.pm @@ -186,9 +186,15 @@ sub renumerate { #$sql_date =~ s/T/ /; $sql_date = DateTime::Format::SQLite->parse_datetime($sql_date); $sql = "SELECT rowid, DATE FROM life_log_temp_table WHERE ID_RTF > 0 AND DATE = '".$sql_date."';"; - my @new = selectRecords($db, $sql); + my @new = selectRecords($db, $sql)->fetchrow_array(); if(scalar @new > 0){ - $db->do("UPDATE NOTES SET LID =". $new[0]." WHERE LID==".$row[0].";"); + try{#can fail here, for various reasons. + $sql="UPDATE NOTES SET LID =". $new[0]." WHERE LID==".$row[0].";"; + $db->do($sql); + } + catch{ + SettingsException->throw(error=>"Database error encountered. sql->$sql", show_trace=>$DEBUG); + }; } } @@ -217,7 +223,7 @@ sub selectRecords { return $pst; }catch{ SettingsException->throw(error=>"Database error encountered.", show_trace=>$DEBUG); - } + }; } sub getTableColumnNames { -- 2.34.1