I pushed sqlite3 (from my Android SDK tools folder) to my rooted device
(*Galaxy
S III, 4.0.3*), since it wasn't on there.
But executing any query or even just entering sqlite3 fails with an error.
via adb shell:
~ # sqlite3/system/xbin/sqlite3: line 1: syntax error: unexpected (
~ #
The initial cursor position is before the first row. You have to
moveToNext() or moveToFirst( before you get any data out of the cursor.
On 12/09/10 01:36, kypriakos wrote:
I have the following code that accesses data on a database residing
in
/data/data/app name/databases (I copy my
Personally, I use the following logic which caters nicely for no rows
as well:
if (cursor != null) {
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
// doSomething with cursor row
}
cursor.close();
}
--
You received this message because you are subscribed to the Google
Groups Android
No need to explicitly move to position -1 - it's the initial position.
Just doing while (moveNext()) is fine.
09.12.2010 20:00, H ?:
Personally, I use the following logic which caters nicely for no rows
as well:
if (cursor != null) {
cursor.moveToPosition(-1);
while
I have the following code that accesses data on a database residing
in
/data/data/app name/databases (I copy my database from the assets
dir into the databases dir at runtime).
c = myDB.rawQuery(SELECT * FROM +dbTable+ WHERE name='+line
+', null);
System.out.println (Executing
first u get point the cursor to the first item
and iterate,because by default ur cursor will be pointing to last item tat
is been added
example
cursor.moveToFirst();
if (!cursor.isAfterLast())
{
do
{
String msg= msgcursor.getString(3);
... which can be shortened to:
while (cursor.moveToNext()) {
cursor.getString(...)
}
-- Kostya
09.12.2010 9:41, nithya nataraj пишет:
first u get point the cursor to the first item
and iterate,because by default ur cursor will be pointing to last item
tat is been added
example
7 matches
Mail list logo