Commits

a4z committed 2b2c988

fix ldsoconf time stamp bug

Comments (0)

Files changed (2)

src/sbbdep/cachedb.cpp

   Execute("SELECT value FROM keyvalstore WHERE key='ldsoconf';", dsldtime);
 
   if(dsldtime.getRowCount()!= 1)
-    throw a4z::ErrorMessage("keyval ldsoconf coutn != 1");
+    Execute("INSERT INTO keyvalstore (key, value) VALUES ('ldsoconf', 0);");
+
+  dsldtime.Reset();
+  Execute("SELECT value FROM keyvalstore WHERE key='ldsoconf';", dsldtime);
+  if(dsldtime.getRowCount()!= 1)
+    throw a4z::ErrorMessage("keyval ldsoconf count != 1");
 
   if(lddirs.getLdSoConfTime() > dsldtime.getField(0).asInt64())
       {
 CacheDB::persistLdSoTime()
 {
   LDDirs lddirs;
-  Execute("update keyvalstore set value = " +  std::to_string(lddirs.getLdSoConfTime()) + " ;") ;
+  Execute("update keyvalstore set value = " +
+      std::to_string(lddirs.getLdSoConfTime()) +
+      " where key = 'ldsoconf' ;") ;
 }
 //--------------------------------------------------------------------------------------------------
 

src/sbbdep/cachesql.cpp

       value  NOT NULL
  ); 
 
-
   CREATE TRIGGER on_before_delete_pkgs BEFORE DELETE ON pkgs 
     FOR EACH ROW  BEGIN
     DELETE from dynlinked WHERE pkg_id = OLD.id;
 
   CREATE TABLE ldlnkdirs (dirname TEXT PRIMARY KEY NOT NULL);      
   CREATE TABLE ldusrdirs (dirname TEXT PRIMARY KEY NOT NULL); 
-        
+
+  INSERT INTO keyvalstore (key, value) VALUES ('ldsoconf', 0);        
+
 )~";
 
   sql+=CreateVersion(MAJOR_VERSION , MINOR_VERSION , PATCH_VERSION);