Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attached databases in Honeycomb

Has anyone ran into attached database issues with Honeycomb yet? My application uses attached databases (working on 1.5 through 2.3) using the statements:

...

String newDb = "/data/data/com.stuff.app/databases/mydata.db";

db.execSQL("attach database ? as newDb", new String[] {newDb});

String[] columns = MY_COL_NAMES;

String orderBy = DEFAULT_SORT_ORDER;

Cursor cursor = db.query("newDb.mydata", columns, null, null, null, null, orderBy);

...

This is working (1.5 through 2.3) regardless of the actual location of the sqlite database file (local or SD Card)...However, in Honeycomb, the db.query statement results in a "I/SqliteDatabaseCpp( 628): sqlite returned: error code = 1, msg = no such table: newDb.mydata ..."

I can manually attach the database from within sqlit3 by issuing the statement:

sqlite3>attach database '/data/data/com.stuff.app/databases/mydata.db' as newDb;

Any help resolving this would be greatly appreciated.

like image 610
Bill Avatar asked Mar 09 '26 10:03

Bill


1 Answers

in Honeycomb, using bindargs for 'Attach' sql statement doesn't seem to work.

try this instead: db.execSQL("attach database '" + newDb + "' as newDb");

this should work.

like image 106
Vasu Nori Avatar answered Mar 11 '26 02:03

Vasu Nori



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!