code: private void validateQuerySql(SQLiteDatabase db, String sql,
                                    CancellationSignal cancellationSignal) {
          db.getThreadSession().prepare(sql,
                  db.getThreadDefaultConnectionFlags(true /*readOnly*/), cancellationSignal, null);
      }
docs: Verifies that a SQL SELECT statement is valid by compiling it.
  If the SQL statement is not valid, this method will throw a {@link SQLiteException}.