Use query.
Android precompile queries and using too many different raw queries may cause performance issue.
Use rawQuery only when absolutely needed.
Also, both your example have a MAJOR security issue of SQL Injection.
You should sanitize the userId.
The most obvious thing to do is let Android do it by using:
db.query(USER_TABLE_NAME, ALL_COLUMNS, "user_id = ?", new String[] {userId}, null, null, null);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…