Database recreation? I don't get it...

vasper

Member
Licensed User
Longtime User
Am I missing something? Everytime I run the dbutils program in my test environment the database is recreated and reinitialized as though it didn't exist from the last time I run the program. The same thing happens on my own test app. Why? I don't restart the emulator, and I don't erase user data. What if I need to keep database persistant through installs?
 
Last edited:

vasper

Member
Licensed User
Longtime User
This is my code. Everytime I restart the program from the IDE or the emulator

B4X:
      If FirstTime Then
      Dim dbDir As String
      Dim dbVer As Int
      If File.ExternalWritable Then
         dbDir = File.DirDefaultExternal
      Else
         dbDir = File.DirInternal
      End If
      dmDRDB.Initialize(dbDir,"dmDiceRoller.db",True)
      dbVer=DBUtils.GetDBVersion(dmDRDB)
      Log("DBVersion " & dbVer)' I get 1 ALWAYS
      DBUtils.SetDBVersion(dmDRDB,2)
      dbVer=DBUtils.GetDBVersion(dmDRDB)
      Log("DBVersion " & dbVer) 'I get 2 
   End If

I tested with 2.2 emulator and it didn't work. Then I tested on a 3.0 emulator and it worked! I have no idea why. And it still keeps deleting the database in 2.2 where I run again from the run statement in b4a. There seems to be a difference in how the install is behaving.
 
Last edited:

vasper

Member
Licensed User
Longtime User
Great! Thanks. There should be a list of those bugs by Google!!! So far I have found that 2.3 doesn't do Landscape, and 2.2 doesn't do DirDefaultExternal. 250000 apps later...
 
Top