[android-developers] sqlite3 on Android fails with: syntax error: unexpected “(”

2012-12-03 Thread Mathias Lin
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 ( ~ #

Re: [android-developers] sqlite3 on Android

2010-12-09 Thread Michael MacDonald
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

Re: [android-developers] sqlite3 on Android

2010-12-09 Thread H
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

Re: [android-developers] sqlite3 on Android

2010-12-09 Thread Kostya Vasilyev
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

[android-developers] sqlite3 on Android

2010-12-08 Thread kypriakos
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

Re: [android-developers] sqlite3 on Android

2010-12-08 Thread 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 cursor.moveToFirst(); if (!cursor.isAfterLast()) { do { String msg= msgcursor.getString(3);

Re: [android-developers] sqlite3 on Android

2010-12-08 Thread Kostya Vasilyev
... 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