Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.connect = function()
- {
- try
- {
- var oldHandle = Titanium.App.Properties.getString('handle');
- //Handle is Not empty, lets removed Cached DB
- if(oldHandle!="")
- {
- Ti.API.info("Connected baby with Old Handle = "+oldHandle+ " and Db file ="+ this.dbName);
- //Get the Handle
- var dbOld = Titanium.Database.install(this.dbName,oldHandle);
- // Destroy It
- dbOld.remove();
- //Reset the Handle Property to Empty
- Titanium.App.Properties.setString('handle',"");
- Ti.API.info("Removed Old Handle = "+oldHandle );
- }
- //Install Fresh One
- connection = Titanium.Database.install(this.dbName,this.dbHandle);
- Titanium.App.Properties.setString('handle',this.dbHandle);
- Ti.API.info("Installed New DB with Handle ="+this.dbHandle);
- return true;
- }
- catch(ex)
- {
- Ti.API.info(ex.description);
- return false;
- }
- }
Add Comment
Please, Sign In to add comment