sql issue

Put your problem here if it does not fit any of the other categories.

sql issue

Postby saif_zeenwala » Fri Nov 20, 2009 12:26 pm

hi guys

I am newbe to android and working on making generalised class for sql interaction

I got stuck in data retieval from database.

So far i amusing this method

Cursor ocursor = db.query(DATABASE_TABLE, columns, null, null, null, null, null);

which retrurns me cursor for retrieveing data from database

as i have mentioned above I want to make it generalised so i want schema of table from where i m retrieveing values.

is there any way to do so

suppose my table is having two columns

1) name of string type
2) age of int type

is there any way to get the data type of above mentioned table columns.

this is very urgent
please help
Junior Developer
Junior Developer
Posts: 15
Joined: Mon Nov 02, 2009 7:40 am


Postby nmc » Fri Nov 20, 2009 6:54 pm

A quick forum-search would have revealed this answer:
Getting the tablenames:
select name from sqlite_master where type='table'

Getting the structure of a table:
select sql from sqlite_master where name='<NameOfTheTable>'
Senior Developer
Senior Developer
Posts: 154
Joined: Thu Nov 27, 2008 8:30 pm
Location: Germany


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 4 guests