Wednesday, April 25, 2012

Re: [android-developers] newbie SQL Light Question

This is an abstraction so you don't have to build the SQL query yourself.  If you want more flexibility you can use the rawQuery() method:
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#rawQuery%28java.lang.String,%20java.lang.String[]%29

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Apr 25, 2012 at 3:38 PM, gary@deanblakely.com <gary@deanblakely.com> wrote:
I'm learning SQLLite using the NotePad tutorial appication.  The code
pasted below is very strange to me.  I'm used to using SQL i.e. Select
KEY_ROWID, KEY_TITLE, KEY_BODY from DATABASE_TABLE
WHERE BLAH BLAH BLAH.

One of the nice things about SQL is that it is pretty much the same
between the platforms so when a developer has to learn a new platform,
such as Android, the SQL is the same.

What's going on?  Why don't you use SQL?
Thanks,
Gary

  public Cursor fetchNote(long rowId) throws SQLException {

       Cursor mCursor =

           mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
                   KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId,
null,
                   null, null, null, null);
       if (mCursor != null) {
           mCursor.moveToFirst();
       }
       return mCursor;

   }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate