Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2988] Database.remove + database.install updates the database after restart of the app in iOS

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2012-01-03T17:51:18.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsn/a
ReporterRene Pot
AssigneePaul Dowsett
Created2011-11-10T00:26:33.000+0000
Updated2016-03-08T07:47:59.000+0000

Description

When doing database.remove() the database is still available, but after restart the new one is available. As the install does only works once, the database does not update if the file does. Therefore I want to remove the database, and re-install it. This works on android, but not on iOS, but only after a restart of the app. I think this is therefore a bug. Code snippet:
var version = '3';
var DB = Ti.Database.install(Titanium.Filesystem.resourcesDirectory + 'db.sqlite','db');
var queryResult = DB.execute('SELECT value FROM config WHERE name = "version"');
if (queryResult.isValidRow() && queryResult.fieldByName('value') != version){
    DB.remove(); 
    var DB = Ti.Database.install(Titanium.Filesystem.resourcesDirectory + 'db.sqlite','db');
}

Comments

  1. Paul Dowsett 2011-11-10

    Thank you for raising this ticket. If you are able to provide all the information described in the [JIRA Ticket Checklist](http://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist) guidelines, *in the correct fields and using the right format*, we will be able to escalate it to the core team. Thanks in advance.
  2. Paul Dowsett 2012-01-03

    DB.remove() is currently an Android-only feature. Please see TIMOB-6969, which requests an equivalent method. Thanks for bringing my attention to this. I'm closing this now.
  3. Shak Hossain 2013-12-28

JSON Source