Cursor cursor = null;
db.openDatabase();
cursor = db.execQuery("select person_id, person_name" + " from person_table where person_id in (" + stringBuffer.toString() + ") order by person_name_jp asc");
code as above
then how can I print the cursor's string ("select person_id,person_name from person_table where ...") to logcat?
Iterate through your cursor using cursor.moveToNext()
or cursor.moveToPosition(position)
manually or inside the cycle.
Get from cursor required data and just put it into Log:
Log.v("your_tag", cursor.getString(cursor.getColumnIndex(person_name)));
https://developer.android.com/reference/android/database/Cursor.html
Assign your query string to a temporary string object which you pass to executeQuery
and simply use Log.i()
to print you query in logs:
String query="your query";
Log.i("your tag", query);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.