@MediumTest
  public void testCursorUpdate() {
    mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, d INTEGER, s INTEGER);");
    for (int i = 0; i < 20; i++) {
      mDatabase.execSQL("INSERT INTO test (d, s) VALUES (" + i + "," + i % 2 + ");");
    }

    Cursor c = mDatabase.query("test", null, "s = 0", null, null, null, null);
    int dCol = c.getColumnIndexOrThrow("d");
    int sCol = c.getColumnIndexOrThrow("s");

    int count = 0;
    while (c.moveToNext()) {
      assertTrue(c.updateInt(dCol, 3));
      count++;
    }
    assertEquals(10, count);

    assertTrue(c.commitUpdates());

    assertTrue(c.requery());

    count = 0;
    while (c.moveToNext()) {
      assertEquals(3, c.getInt(dCol));
      count++;
    }

    assertEquals(10, count);
    assertTrue(c.moveToFirst());
    assertTrue(c.deleteRow());
    assertEquals(9, c.getCount());
    c.close();
  }
  @MediumTest
  public void testBlob() throws Exception {
    // create table
    mDatabase.execSQL(
        "CREATE TABLE test (_id INTEGER PRIMARY KEY, s TEXT, d REAL, l INTEGER, b BLOB);");
    // insert blob
    Object[] args = new Object[4];

    byte[] blob = new byte[1000];
    byte value = 99;
    Arrays.fill(blob, value);
    args[3] = blob;

    String s = new String("text");
    args[0] = s;
    Double d = 99.9;
    args[1] = d;
    Long l = (long) 1000;
    args[2] = l;

    String sql = "INSERT INTO test (s, d, l, b) VALUES (?,?,?,?)";
    mDatabase.execSQL(sql, args);
    // use cursor to access blob
    Cursor c = mDatabase.query("test", null, null, null, null, null, null);
    c.moveToNext();
    ContentValues cv = new ContentValues();
    DatabaseUtils.cursorRowToContentValues(c, cv);

    int bCol = c.getColumnIndexOrThrow("b");
    int sCol = c.getColumnIndexOrThrow("s");
    int dCol = c.getColumnIndexOrThrow("d");
    int lCol = c.getColumnIndexOrThrow("l");
    byte[] cBlob = c.getBlob(bCol);
    assertTrue(Arrays.equals(blob, cBlob));
    assertEquals(s, c.getString(sCol));
    assertEquals((double) d, c.getDouble(dCol));
    assertEquals((long) l, c.getLong(lCol));

    // new byte[]
    byte[] newblob = new byte[1000];
    value = 98;
    Arrays.fill(blob, value);

    c.updateBlob(bCol, newblob);
    cBlob = c.getBlob(bCol);
    assertTrue(Arrays.equals(newblob, cBlob));

    // commit
    assertTrue(c.commitUpdates());
    assertTrue(c.requery());
    c.moveToNext();
    cBlob = c.getBlob(bCol);
    assertTrue(Arrays.equals(newblob, cBlob));
    c.close();
  }