SQLite "attach database" not working in Honeycomb

by Mark Carter » Mon, 14 Mar 2011 18:17:51 GMT


Sponsored Links
 My app makes extensive use of this:

sqldb.execSQL("ATTACH DATABASE ? AS mydb", new String[] { dbFile.getPath() 
});

where the dbFile is stored on External Storage.

The Honeycomb emulator confirms the File.exists() but when I query the 
database, it's as if the database hasn't been attached at all.

Also SQLiteDatabase.getAttachedDbs() only returns <"main", ":memory:"> - 
i.e. a single-item list.

The code works fine in 1.5 through to 2.3.

And I'm not the only one experiencing this: 
 http://stackoverflow.com/questions/5108964/attached-databases-in-honeycomb 

-- 



Re: SQLite "attach database" not working in Honeycomb

by Mark Carter » Tue, 15 Mar 2011 11:31:01 GMT


 A workaround has been posted on the Stackoverflow link.

I've filed a bug report here: 
 http://code.google.com/p/android/issues/detail?id=15499 

-- 


Sponsored Links


Re: SQLite "attach database" not working in Honeycomb

by Vasu Nori » Tue, 15 Mar 2011 17:33:10 GMT


 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.

files a bug to address this. thanks for posting this question. (also
answered this question on 
 http://stackoverflow.com/questions/5108964/attached-databases-in-honeycomb. 
again thanks for the pointer)




-- 



Other Threads

1. how to i check if an EditText is empty

using "if(someEditText.getText().toString == null) " doesnt work

im passing information from this editText into a database.  Ive
already limited it to 2 characters and numbers only in the xml file,
but i need to run a check to fill its defaults to 0 if nothing is
entered.  I could set its default to 0, but then my hint text would
show up.  Could someone give me a hand with this?
--~--~---------~--~----~------------~-------~--~----~

2. How to make a listview with selectable children stop scrolling on touch event?

As a work around to the issue where a list item isn't focusable if it
has a focusable child item (a comment by Romain Guy was that this was
intended behavior, for accessibility reasons) I simply filled the
listItem with two children, each of which is focusable -  There's
nowhere to directly touch on the listItem anymore, just it's
children.

For the most part this is a useable workaround, effectively invisible
to the user, except for one thing-  Although you can scroll by swiping
without issue, touching to *stop* the scroll no longer works-  I
imagine because the child item is capturing the touch event and not
passing it to the parent listitem, at least while the scroll is in
effect.

Is there a known workaround for this?  Perhaps someway to "pass the
baton" of the touch event back up to the parent listItem, or a way to
change my design?

BTW-  I know there's some built-in functonality for single/multiple
choice listviews (checkbox listviews) - That doesn't actually help in
my case.  The app is a contact list, and the row children are a
relativelayout (populated with contact info) and a clickable phone
icon (a one-touch dial for the contact), which needs to be visible or
invisible depending on whether the stored contact has a phone number.

--~--~---------~--~----~------------~-------~--~----~

3. Prevent scrollview from getting focus?

4. 50+ new Android devices coming - developers brace for impact

5. HTC Hero does not support colored LEDs (SDK way) - What can developers do in these cases? [Follow up from android-platform]

6. HTC Hero does not support colored LEDs (SDK way) - What can developers do in these cases? [Follow up from android-platform]

7. HTC Hero does not support colored LEDs (SDK way) - What can developers do in these cases? [Follow up from android-platform]