]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Bug 31 - PostgreSQL new log view is not being created.
authorWill Budicm <redacted>
Fri, 4 Dec 2020 11:07:15 +0000 (22:07 +1100)
committerWill Budicm <redacted>
Fri, 4 Dec 2020 11:07:15 +0000 (22:07 +1100)
htdocs/cgi-bin/login_ctr.cgi
htdocs/cgi-bin/main.cgi
htdocs/cgi-bin/system/modules/Settings.pm

index 5938a7307ffb2c17ebac5df30a6ef699dca7a3ae..a699bcd3129c455f38ec5abb09a4e8708a6cf99d 100755 (executable)
@@ -344,16 +344,16 @@ sub checkCreateTables {
         $db->do(Settings::createLOGStmt());
 
         my $st = $db->prepare('INSERT INTO LOG(ID_CAT,DATE,LOG) VALUES (?,?,?)');
-            $st->execute( 3, $today, "DB Created!");
-            $st->finish();
-            $session->param("cdb", "1");            
+           $st->execute( 3, $today, "DB Created!");            
+           $session->param("cdb", "1");
     }
 
     # From v.1.6 view uses server side views, for pages and correct record by ID and PID lookups.
     # This should make queries faster, less convulsed, and log renumeration less needed for accurate pagination.
     if(!$curr_tables{'VW_LOG'}) {
-        $db->do(Settings::createViewLOGStmt());
+        $db->do(Settings::createViewLOGStmt()) or LifeLogException -> throw("ERROR:".$@)        ;
     }
+
     if(!$curr_tables{'CAT'}) {
         $db->do(Settings::createCATStmt());
         $changed = 1;
@@ -389,6 +389,17 @@ sub checkCreateTables {
     #
     if(!$hasNotesTbl) {$db->do(Settings::createNOTEStmt())}
 
+    if(Settings::isProgressDB()){        
+        my @tbls = $db->tables(undef, 'public');
+        foreach (@tbls){
+            my $t = uc substr($_,7);
+            $curr_tables{$t} = 1;
+        }
+        if(!$curr_tables{'VW_LOG'}) {
+            LifeLogException -> throw("VW_LOG not created! Try logging in again.");
+        }
+    }
+
     if($changed){
         #It is also good to run db fix (config page) to renum if this is an release update?
         #Release in software might not be what is in db, which counts.
index 6f4d22ed922207980a425c5029907873d092feef..307b308cec599295fb17ee8a3c5ff72af59502a4 100755 (executable)
@@ -103,10 +103,10 @@ if ( $rs_keys || $stmD || $prm_vc > 0 || $prm_xc > 0 || $prm_aa > 0) { $toggle =
 
 
 ##Handle Session Keeps
-$sss->expire(&Settings::sessionExprs);
+$sss->expire(Settings::sessionExprs());
 $sss->param('theme', $TH_CSS);
 $sss->param('bgcolor', $BGCOL);
-$sss->param('sss_main', $today);
+#ss->param('sss_main', $today);
 #
 
 #Reset Clicked
index 9cc14cf78329fa1b2d1757d72d43aacd6b388e88..f825b6a3c8c2d0ae62146cf7823ea058cae158bc 100644 (file)
@@ -273,7 +273,7 @@ sub selStartOfYear {
 sub createViewLOGStmt {
 if($IS_PG_DB){
   return qq(
-    CREATE VIEW VW_LOG AS
+    CREATE VIEW public.VW_LOG AS
      SELECT *, (select count(ID) from LOG as recount where a.id >= recount.id) as PID
          FROM LOG as a ORDER BY Date(DATE) DESC;
     );