Re: [android-developers] Re: running sqlite3 commands from app?

2009-11-30 Thread Dianne Hackborn
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html#execSQL(java.lang.String,
java.lang.Object[])

On Mon, Nov 30, 2009 at 12:37 PM, dsukhram  wrote:

> Well thats the question i'm asking. I've looked at a various classes
> under the android.database.sqlite package but I can't seem to find one
> to do what I want. Can you tell me which one I need to use?
> On Nov 30, 2:57 pm, Dianne Hackborn  wrote:
> > Why would you want to do that?  Use the SQLite APIs to execute whatever
> > operations you want on the database.
> >
> >
> >
> >
> >
> > On Mon, Nov 30, 2009 at 11:49 AM, dsukhram 
> wrote:
> > > When my app loads up I need to import a bunch of records into its
> > > database.
> >
> > > How do I run the following sqlite3 command from my app?
> >
> > > sqlite3>.read /data/data//files/records.sql
> >
> > > --
> > > 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+unsubscr...@googlegroups.com
> 
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: running sqlite3 commands from app?

2009-12-01 Thread sathya subbiah
Hi,

Use 
execSQLprovided
by Android for executing SQL commands.



On Tue, Dec 1, 2009 at 7:50 AM, dsukhram  wrote:

> Thanks for your reply. But I have looked at this class and I only see
> methods for creating,deleting or executing queries on a database. I
> don't see any methods for issuing a sqlite command. Maybe i'm blind
> but can you point out a method in this class that i would use?
>
> thanks
>
> On Nov 30, 4:04 pm, Dianne Hackborn  wrote:
> > http://developer.android.com/reference/android/database/sqlite/SQLite..
> .,
> > java.lang.Object[])
> >
> >
> >
> > On Mon, Nov 30, 2009 at 12:37 PM, dsukhram 
> wrote:
> > > Well thats the question i'm asking. I've looked at a various classes
> > > under the android.database.sqlite package but I can't seem to find one
> > > to do what I want. Can you tell me which one I need to use?
> > > On Nov 30, 2:57 pm, Dianne Hackborn  wrote:
> > > > Why would you want to do that?  Use the SQLite APIs to execute
> whatever
> > > > operations you want on the database.
> >
> > > > On Mon, Nov 30, 2009 at 11:49 AM, dsukhram 
> > > wrote:
> > > > > When my app loads up I need to import a bunch of records into its
> > > > > database.
> >
> > > > > How do I run the following sqlite3 command from my app?
> >
> > > > > sqlite3>.read /data/data//files/records.sql
> >
> > > > > --
> > > > > 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+unsubscr...@googlegroups.com
> 
> >
> > > 
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > hack...@android.com
> >
> > > > Note: please don't send private questions to me, as I don't have time
> to
> > > > provide private support, and so won't reply to such e-mails.  All
> such
> > > > questions should be posted on public forums, where I and others can
> see
> > > and
> > > > answer them.- Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > > --
> > > 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+unsubscr...@googlegroups.com
> 
> >
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see
> and
> > answer them.
>
> --
> 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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: running sqlite3 commands from app?

2009-12-01 Thread Dianne Hackborn
You put -real- SQL in to those.  ".tables" is a meta-command of sqlite3.

Please, forget about the sqlite3 command, that is only for debugging from
the command line.  You can accomplish everything with the Java API.  You
probably want to get a sqlite3 manual to help you with the command syntax.

On Tue, Dec 1, 2009 at 6:32 AM, dsukhram  wrote:

> When I try to run the '.tables' command by doing the following:
>
> SQLiteDatabase db = this.openOrCreateDatabase(DB_NAME, MODE_PRIVATE,
> null);
> db.execSQL(".tables");
>
> I get this error:
>
> ERROR/Database(13071): Failure 1 (near ".": syntax error) on 0x1f3f60
> when preparing '.tables'.
>
> On Dec 1, 8:14 am, sathya subbiah  wrote:
> > Hi,
> >
> > Use execSQL<
> http://developer.android.com/reference/android/database/sqlite/SQLite..
> .>provided
> > by Android for executing SQL commands.
> >
> >
> >
> > On Tue, Dec 1, 2009 at 7:50 AM, dsukhram  wrote:
> > > Thanks for your reply. But I have looked at this class and I only see
> > > methods for creating,deleting or executing queries on a database. I
> > > don't see any methods for issuing a sqlite command. Maybe i'm blind
> > > but can you point out a method in this class that i would use?
> >
> > > thanks
> >
> > > On Nov 30, 4:04 pm, Dianne Hackborn  wrote:
> > > >http://developer.android.com/reference/android/database/sqlite/SQLite
> ..
> > > .,
> > > > java.lang.Object[])
> >
> > > > On Mon, Nov 30, 2009 at 12:37 PM, dsukhram 
> > > wrote:
> > > > > Well thats the question i'm asking. I've looked at a various
> classes
> > > > > under the android.database.sqlite package but I can't seem to find
> one
> > > > > to do what I want. Can you tell me which one I need to use?
> > > > > On Nov 30, 2:57 pm, Dianne Hackborn  wrote:
> > > > > > Why would you want to do that?  Use the SQLite APIs to execute
> > > whatever
> > > > > > operations you want on the database.
> >
> > > > > > On Mon, Nov 30, 2009 at 11:49 AM, dsukhram <
> duanesukh...@gmail.com>
> > > > > wrote:
> > > > > > > When my app loads up I need to import a bunch of records into
> its
> > > > > > > database.
> >
> > > > > > > How do I run the following sqlite3 command from my app?
> >
> > > > > > > sqlite3>.read /data/data//files/records.sql
> >
> > > > > > > --
> > > > > > > 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+unsubscr...@googlegroups.com
> 
> > > 
> 
> >
> > > > > 
> > > > > > > For more options, visit this group at
> > > > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > > > > --
> > > > > > Dianne Hackborn
> > > > > > Android framework engineer
> > > > > > hack...@android.com
> >
> > > > > > Note: please don't send private questions to me, as I don't have
> time
> > > to
> > > > > > provide private support, and so won't reply to such e-mails.  All
> > > such
> > > > > > questions should be posted on public forums, where I and others
> can
> > > see
> > > > > and
> > > > > > answer them.- Hide quoted text -
> >
> > > > > > - Show quoted text -
> >
> > > > > --
> > > > > 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+unsubscr...@googlegroups.com
> 
> > > 
> 
> >
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/android-developers?hl=en
> >
> > > > --
> > > > Dianne Hackborn
> > > > Android framework engineer
> > > > hack...@android.com
> >
> > > > Note: please don't send private questions to me, as I don't have time
> to
> > > > provide private support, and so won't reply to such e-mails.  All
> such
> > > > questions should be posted on public forums, where I and others can
> see
> > > and
> > > > answer them.
> >
> > > --
> > > 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+unsubscr...@googlegroups.com
> 
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en- Hide quoted
> text -
> >
> > - Show quoted text -
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android fr

Re: [android-developers] Re: running sqlite3 commands from app?

2009-12-01 Thread chad ziccardi

On Dec 1, 2009, at 9:32 AM, dsukhram wrote:

> When I try to run the '.tables' command by doing the following:
> 
> SQLiteDatabase db = this.openOrCreateDatabase(DB_NAME, MODE_PRIVATE,
> null);
> db.execSQL(".tables");
> 

Try this:
db.execSQL("SELECT name FROM sqlite_master where type='table' and name NOT LIKE 
'sqlite_%';");


-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en