From: Will Budic Date: Sun, 23 Feb 2020 00:20:54 +0000 (+1100) Subject: Added extra check exception on update notes, check. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=9731f49a62660aceae17384f6d373acc526b03dc;p=LifeLog.git Added extra check exception on update notes, check. --- 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 {