Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         this.db = openDatabase(databaseName, "", displayName);
  2.         Mojo.Log.info("Database version", this.db.version);
  3.         debugObject(this.db);
  4.         if (this.db.version === "0.2") {
  5.             var updateSQL = ["ALTER TABLE notes ADD COLUMN syncnum",
  6.                 "ALTER TABLE notes ADD COLUMN version",
  7.                 "ALTER TABLE notes ADD COLUMN minversion",
  8.                 "ALTER TABLE notes ADD COLUMN sharekey",
  9.                 "ALTER TABLE notes ADD COLUMN publishkey",
  10.                 "ALTER TABLE notes ADD COLUMN tags",
  11.                 "ALTER TABLE notes ADD COLUMN systemtags"
  12.             ];
  13.             this.updateOldVersion(this.db, this.db.version, updateSQL, inCallback);
  14.         }
  15.  
  16.  
  17.  
  18.     this.updateOldVersion = function (database, oldVersion, sqlString, inCallback) {
  19.        
  20.         Mojo.Log.info ("Entering updateOldVersion in DB to version", version);
  21.         database.changeVersion (oldVersion, version,
  22.             function(transaction){
  23.                 Mojo.Log.info("Transaction executeSql", sqlString);
  24.                 transaction.executeSql (sqlString,
  25.                     function(){
  26.                         Mojo.Log.info("success! updating DB");
  27.                     },
  28.                     function(){
  29.                         Mojo.Log.info("FAILURE! updating DB");
  30.                     }
  31.                 );
  32.             },
  33.             function(error){
  34.                 Mojo.Log.info("Too bad!", database.version);
  35.                 Mojo.Log.info("error %j", error);
  36.  
  37.             },
  38.             function () {
  39.                 Mojo.log.info("Success from chnageVersion");
  40.                 //this.init(inCallback) // success handler
  41.             }
  42.         );
  43.     };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement