Code example for SQLiteDatabase

Methods: execSQLupdate

0
				//introducing sub accounts 
				Log.i(TAG, "Adding column for parent accounts");
				String addParentAccountSql = "ALTER TABLE " + ACCOUNTS_TABLE_NAME + 
						" ADD COLUMN " + KEY_PARENT_ACCOUNT_UID + " varchar(255)";
	 
				db.execSQL(addColumnSql);
				db.execSQL(addParentAccountSql);
			} 
			 
			//update account types to GnuCash account types 
			//since all were previously CHECKING, now all will be CASH 
			Log.i(TAG, "Converting account types to GnuCash compatible types");
			ContentValues cv = new ContentValues();
			cv.put(KEY_TYPE, AccountType.CASH.toString());
			db.update(ACCOUNTS_TABLE_NAME, cv, null, null);
 
            if (oldVersion == 2 && newVersion == 3){
                Log.i(TAG, "Adding flag for placeholder accounts");
                String addPlaceHolderAccountFlagSql = "ALTER TABLE " + ACCOUNTS_TABLE_NAME +
                        " ADD COLUMN " + KEY_PLACEHOLDER + " tinyint default 0";
 
                db.execSQL(addPlaceHolderAccountFlagSql);
            } 
		} else { 
			Log.i(TAG, "Cannot downgrade database.");
		} 
	} 
Connect your IDE to all the code out there  Get Codota for Java