private void movePrefixedSettingsToNewTable(SQLiteDatabase db,String sourceTable,String destTable,String[] prefixesToMove){
  SQLiteStatement insertStmt=null;
  SQLiteStatement deleteStmt=null;
  db.beginTransaction();
  try {
    insertStmt=db.compileStatement("INSERT INTO " + destTable + " (name,value) SELECT name,value FROM "+ sourceTable+ " WHERE substr(name,0,?)=?");
    deleteStmt=db.compileStatement("DELETE FROM " + sourceTable + " WHERE substr(name,0,?)=?");
    for (    String prefix : prefixesToMove) {
      insertStmt.bindLong(1,prefix.length() + 1);
      insertStmt.bindString(2,prefix);
      insertStmt.execute();
      deleteStmt.bindLong(1,prefix.length() + 1);
      deleteStmt.bindString(2,prefix);
      deleteStmt.execute();
    }
    db.setTransactionSuccessful();
  }
  finally {
    db.endTransaction();
    if (insertStmt != null) {
      insertStmt.close();
    }
    if (deleteStmt != null) {
      deleteStmt.close();
    }
  }
}

private void movePrefixedSettingsToNewTable ( SQLiteDatabase db , String sourceTable , String destTable , String [ ] prefixesToMove ) { SQLiteStatement insertStmt = null ; SQLiteStatement deleteStmt = null ; db . beginTransaction ( ) ; try { insertStmt = db . compileStatement ( "INSERT INTO " + destTable + " (name,value) SELECT name,value FROM " + sourceTable + " WHERE substr(name,0,?)=?" ) ; deleteStmt = db . compileStatement ( "DELETE FROM " + sourceTable + " WHERE substr(name,0,?)=?" ) ; for ( String prefix : prefixesToMove ) { insertStmt . bindLong ( 1 , prefix . length ( ) + 1 ) ; insertStmt . bindString ( 2 , prefix ) ; insertStmt . execute ( ) ; deleteStmt . bindLong ( 1 , prefix . length ( ) + 1 ) ; deleteStmt . bindString ( 2 , prefix ) ; deleteStmt . execute ( ) ; } db . setTransactionSuccessful ( ) ; } finally { db . endTransaction ( ) ; if ( insertStmt != null ) { insertStmt . close ( ) ; } if ( deleteStmt != null ) { deleteStmt . close ( ) ; } } }
move any settings with the given prefixes from the source table to the destination table .
