title: Should I always use transactions in android sqlite?
body: <p>Here is a simple example:</p>
  
  <pre><code>public boolean containsId(Long userid) {
      SQLiteDatabase db = this.getReadableDatabase();
      Cursor cursor = db.rawQuery("select * from " + getTableName() + " where id = " + userid, null);
      boolean rows = cursor.getCount() &gt; 0;
      db.close();
      return rows;
  }
  </code></pre>
  
  <p>I thought sqlite automatically starts a transaction. My colleague said I must always start a transaction.</p>
  
  <p>So what is the right pattern? Should I start a transaction if I read data from database? I am sure that no other thread will write at this time in this table.</p>