1

Cursor.getCount () is negative (= -1)

 3 years ago
source link: https://www.codesd.com/item/cursor-getcount-is-negative-1.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Cursor.getCount () is negative (= -1)

advertisements

I tried to load a list of values from a table, but the cursor returns a length of -1?

Is there a possibility to view a sqlite database on a android emulator?

The Code which is buggy:

final Cursor c = db.query(
    ACCESS_TOKEN_TABLE,
    new String[] { ACCESS_TOKEN_COL_ID, ACCESS_TOKEN_COL_VALUE },
    ACCESS_TOKEN_COL_SERVER_ID + "=" + serverId,
    null,
    null,
    null,
    null);

public static final String COL_ID = "_id";
public static final String ACCESS_TOKEN_TABLE = "accesstoken";
public static final String ACCESS_TOKEN_COL_ID = COL_ID;
public static final String ACCESS_TOKEN_COL_SERVER_ID = "server_id";
public static final String ACCESS_TOKEN_COL_VALUE = "value";

And there is one entry in the database. The value of ServerID is 1 and there exists one entry, where the ServerID is 1.

Sincerely xZise

PS: Two questions only to open the database.


you have an sqlite3 command if you "adb -e shell" with a CLI interface to the db. better yet - i know of an eclipse plugin that can view sqlite database content using the ddms. but my personal favorite is to pull the db file out of the emulator, and use sqlite database browser to view the contents.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK