I'm trying to open a database passed from a intent, when I try to open the DB it will return the DB path instead of the DB self, so when I try to perform SQLite commands it wont work
URI uri = (Uri) getIntent().getExtras().get(Intent.EXTRA_STREAM);
SQLiteDatabase oldDB = SQLiteDatabase.openDatabase(uri.getPath(), null, 1);
database.selectTable(oldDB)
//select table from old DB
selectTable(SQLiteDatabase oldDB){
database.execSQL("SELECT * FROM " +
oldDB +
".table1"
}
will result in error: SELECT * FROM SQLiteDatabase: /mnt/sdcard/path/to/database.db.table1 I need to get the actual Database "SELECT * FROM nameOfDatabase.table1"
Aucun commentaire:
Enregistrer un commentaire