I think I have created an sqllite database with android but every time I go to do an insert it claims a column does not exist. How can I view the schema and is the onCreate method called on object creation?
You can do it with code. Sqlite has a table called "sqlite_master " which holds the schema information.
/**
* Get all table Details from the sqlite_master table in Db.
*
* @return An ArrayList of table details.
*/
public ArrayList<String[]> getDbTableDetails() {
Cursor c = db.rawQuery(
"SELECT name FROM sqlite_master WHERE type='table'", null);
ArrayList<String[]> result = new ArrayList<String[]>();
int i = 0;
result.add(c.getColumnNames());
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
String[] temp = new String[c.getColumnCount()];
for (i = 0; i < temp.length; i++) {
temp[i] = c.getString(i);
}
result.add(temp);
}
return result;
}
A more simple way is to run it on the emulator .
Open
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With