I am trying to get fields from a table in a SQLite database. I checked that the data is in the table using the sqlite3 command and running the query that I received from the Cursor using the debugger regarding the database referenced inside my database object.
Here is my code:
openForRead();
Cursor cursor = database.query(DATABASE_TABLE,
null,
null,
null,
null,
null,
"((" + latitude + " - " + KEY_LAT + ") * (" + latitude + " - " + KEY_LAT + ") + ( "
+ longitude + " - " + KEY_LONG + ") * ( " + longitude + " - "+ KEY_LONG + "))",
"10"
);
close();
This code generates an SQL query, for example:
SELECT * FROM airport ORDER BY ((35.9314068 - latitude) * (35.9314068 - latitude) + ( -115.09285366 - longitude) * ( -115.09285366 - longitude)) LIMIT 10
I have only 5 airports in the table right now, so I'm not going to overcome any memory limit or anything like that.
When I run this query in sqlite3, I return the data.
Why is my cursor always empty? It is empty even if I set all to null (which should just return everything ..)
source
share