title: Delete multiple rows in SQLITE (android)
body: <p>I want to delete all the rows from the table that match the ids in an array. I can do that by either of the below 2 methods (both are working). Can you please advice which one is better?</p>
  
  <p>METHOD 1:</p>
  
  <pre><code>public void deleteRec(String[] ids) { //ids is an array
          SQLiteDatabase db = this.getWritableDatabase();
          db.delete(TABLE_NAME, KEY_ID+" IN (" + new String(new char[ids.length-1]).replace("\0", "?,") + "?)", ids);
          db.close();
      }
  </code></pre>
  
  <p>METHOD 2:</p>
  
  <pre><code>public void deleteRec(String[] ids) { //ids is an array
          String allid = TextUtils.join(", ", ids);
          SQLiteDatabase db = this.getWritableDatabase();
          db.execSQL(String.format("DELETE FROM "+TABLE_NAME+" WHERE "+KEY_ID+" IN (%s);", allid));
         db.close();
      }
  </code></pre>