[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread guishenl...@gmail.com
I've solved this problem by: public final static String SQL_GET_ALL_TABLES = "SELECT name FROM " + "sqlite_master WHERE type='table' ORDER BY name"; Cursor cur = dataBase.rawQuery(this.SQL_GET_ALL_TABLES, null); The table names can be obtained from cur. Thank all the people abov

[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread Marco Nelissen
If the database was created by you, shouldn't you already know which tables are in it? On Tue, Jul 28, 2009 at 6:18 PM, guishenl...@gmail.com < guishenl...@gmail.com> wrote: > > I want to get the tables programmatically not in the command line. And > the database is created by myself not the cont

[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread guishenl...@gmail.com
I have tried the method given by Mark in the following way: public final static String SQL_GET_ALL_TABLES = "SELECT name FROM " + "sqlite_master WHERE type='table' ORDER BY name"; dataBase.execSQL(this.SQL_GET_ALL_TABLES, tablenames); But I got exception while running dataBase.ex

[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread Mark Murphy
guishenl...@gmail.com wrote: > I want to get the tables programmatically not in the command line. And > the database is created by myself not the contact database. http://www.sqlite.org/faq.html#q7 "So to get a list of all tables in the database, use the following SELECT command: SELECT nam

[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread guishenl...@gmail.com
I want to get the tables programmatically not in the command line. And the database is created by myself not the contact database. Could you give me some example code? Thank you very much in advance! On 7月28日, 下午9时46分, "Yusuf T. Mobile" wrote: > It depends if you want all the tables programmatic

[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread Yusuf T. Mobile
It depends if you want all the tables programmatically or if you can do it in the command line. Sujay's answer was from the command line. So starting a few steps back, you type: > adb shell # cd /data/data # cd com.android.providers.contacts # cd databases # sqlite3 contacts.db SQLite version 3.

[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread guishenl...@gmail.com
Thank you for answering! But I didn't catch your real meaning. Could you give me some exact code to show your point? On 7月28日, 下午3时25分, Sujay Krishna Suresh wrote: > .tables is the sql instruction to retrieve all the tables in the db. > try executing it asa sql statement with rawQuery. > > On Tu

[android-developers] Re: How to get all table names in SQL database

2009-07-28 Thread Sujay Krishna Suresh
.tables is the sql instruction to retrieve all the tables in the db. try executing it asa sql statement with rawQuery. On Tue, Jul 28, 2009 at 12:45 PM, guishenl...@gmail.com < guishenl...@gmail.com> wrote: > > Hi all, > I'm working at an application about SQLite database. I have > inserted