SQLite Datenbank speichert nicht

Begonnen von Herby am 27. April 2019 · 2 Antworten

#1

Hallo,

meine SQLite-Datenbank speichert nur Änderungen, wenn das Programm im Speicher ist. Solange ich das Programm im Speicher lasse, klappt alles wunderbar. Wische ich das Programm aus dem Speicher, dann setzt Android die Datenbank wieder zurück, sodass die Änderungen nicht mehr gespeichert sind. (Ich denke die Datenbank wird dann wieder neu nach "documents" kopiert).
Sind meine Einträge für "mobile" grundsätzlich richtig ?

Vielen Dank und Grüße herby

if the environment is "mobile" then
set the fullscreen of this stack to true
set the fullscreenmode of me to "exactFit"
put url ("binfile:" & specialFolderPath("resources") & "/Medizin.db") into url ("binfile:" & specialFolderPath("documents") & "/Medizin.db")
put specialFolderPath("documents") & "/Medizin.db" into xpfd
else
put the filename of this stack into xpfd
set the itemDelimiter to "/"
delete the last item of xpfd
put xpfd &"/Medizin.db" into xpfd
end if

Moderator
#2

HI Herby,

kleiner Logikfehler:

...
   if the environment is "mobile" then
      ## Das passiert automatisch auf der mobilen Platform
      ## set the fullscreen of this stack to true
      set the fullscreenmode of me to "exactFit"
      
      ## Wenn Du später mal anfängst, Deinen Code zu DEBUGgen,
      ## wirst Du diese Technik zu schätzen wissen: Variablen kosten nix
      ## daher ist es ratsam, welche zu erstellen, um später deren Inhalt im Debugger 
      ## überprüfen zu können. Selbst wenn es momentan nicht nötig ist.
      put specialFolderPath("resources") & "/Medizin.db" into tQuellDB
      put specialFolderPath("documents") & "/Medizin.db" tZielDB
      
      ## Das machst Du bei JEDEM Programmstart!
      ## Bitte mal auf der Zunge zergehen lassen... 8-)
      ## put url ("binfile:" & specialFolderPath("resources") & "/Medizin.db") into url ("binfile:" & specialFolderPath("documents") & "/Medizin.db")
      
      ## Das sollte aber nur EINMAL beim allerersten Programmstart passieren, daher:
      if there is NOT a file tZielDB then
         put url("binfile:" & tQuellDB) into url("binfile:" & tZielDB)
      end if
      put tZielDB into xpfd
   else
      
      ## Auch in der IDE funktionieren specialfolderpath() Codes:
      ## put the filename of this stack into xpfd
      ## set the itemDelimiter to "/"
      ## delete the last item of xpfd
      ## put xpfd &"/Medizin.db" into xpfd
      
      ## "resources" zeigt in der IDE auf den Ordner in dem sich der aktuelle Stack befindet:
      put specialfolderpath("resources") & "/Medizin.db" into xpfd
   end if. 

Gruß

Klaus

#3

Hallo Klaus, (du Held!)

logisch, ich kopiere beim Neustart die Datenbank wieder neu.

Vielen Dank !!!
herby

Du möchtest antworten? Melde dich an oder registriere dich.