]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Added extra check exception on update notes, check.
authorWill Budic <redacted>
Sun, 23 Feb 2020 00:20:54 +0000 (11:20 +1100)
committerWill Budic <redacted>
Sun, 23 Feb 2020 00:20:54 +0000 (11:20 +1100)
htdocs/cgi-bin/system/modules/Settings.pm

index 20dbe2f613eb7c4625360c5b4874d53b091d66bc..b48ec7d624f6d879d59d4224da48bd31f5c3d2a5 100644 (file)
@@ -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 {