Vihaan Verma
Vihaan Verma

Reputation: 13143

sqlite3: Select rowid with SQLiteDatbase instance

Is there a way for selecting the rowid from table using SQLiteDatabase instance

Cursor websiteCursor= mDatabaseManipulator.query(mTableName, null, COLUMN_WEBSITENAME+"='"+websiteName+"'", null, null, null, null);

Above cursor doesn't get the rowid. The doc says passing null in second argument will return all columns. But rowid is not returned.

I m getting rowid using rawQuery.

Cursor websiteCursor = mDatabaseManipulator.rawQuery("Select rowid _id, * from " + mTableName + " where " + COLUMN_WEBSITENAME + " = '" + websiteName +"'", null);

Upvotes: 0

Views: 124

Answers (1)

Rohan Kandwal
Rohan Kandwal

Reputation: 9336

I think there is some problem in the way that you are implementing the cursor, try this :-

Cursor websiteCursor= mDatabaseManipulator.query(mTableName, new String[]{rowid_id}, COLUMN_WEBSITENAME+" =? ", new String[]{websiteName}, null, null, null);

Upvotes: 1

Related Questions