upgrade - Transfer data to new database version android -


I'm trying to write a function that will take the current information in the database and keep it in the new version. is.

  public void updateTable (SQLiteDatabase db) {Cursor C = db.rawQuery (select tbl_name from sqlite_master where tbl_name = '"+ tableName +"' ", null); If (c ! = Null & amp; amp; amp; c.getCount ()> 0) {c = db.rawQuery ("Choose + to +" + + Table Name, blank); ArrayList & lt; Transactions & gt; TempList = New ArrayList & lt; Transactions & gt; (); while (c.moveToNext ()) {transaction T = CreateTechnication (C); if (T! = Null) tempList.add (t);} Droptable (DB); For the createTable (Transaction T: tempelist) {addOccurrence (t);}} and {new runtime exception throw ("No new table to update This method gets the database given to the on-upgrade method.  
  Upgrade to Public Zero (SQLiteDatabase DB, Int Old Warren, It Newversion {Switch} (NewVersion) {Cases NEW_VERSION_NUMBER: transTable.updateTable (db); breakdown;}}   

The problem is, I do not have anything in that database I get the upgrade method! So I'm just erasing my database ... Is there a way to do this or do I have to rely on limited use of alternative changes? Thank you.

public void on upgrade (SQLiteDatabase new_db, int oldWarson, it Newversion) {// to -o Automatically generated method stub system.out.print ("upgrade ()"); New_db.execSQL ("if empty table exists" + + TableName + ";"); OnCreate (new_db); }

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -