android


Android DB: Merging Two Databases Using SQL Dumps


I'm currently working on the database part of a project where I have to merge the contents of two databases and I would like to ask you if there exists a simple API method
within the Android API/SDK itself that dumps me a database to a SQL text file.
Actually I found no hint in the API documentation about such an implementation myself. And I really doubt there is a single line method somewhere buried behind the curtain.
However I've already made a workaround using the sqlite3 shell tools of Android Linux by invoking:
String[] cmd = {"/system/bin/sh", "-c", ..., "sqlite3 ..."};
Runtime.getRuntime().exec( cmd );
Where I have two choices, a) pipe it directly to an output file or b) write the file using BufferedOutputStream.
Nevertheless, most likely due to compatibility issues am I asking you of a more convenient way within the API itself, rather than using the critical shell trick within the App.
I am also pretty much interested in any fast & pretty clues about merging two databases using Android's database methods.
Thanks.
There's nothing built in to the API that will help you. You could query, and write the INSERT statements yourself. There's a blog entry (http://mgmblog.com/2009/02/06/export-an-android-sqlite-db-to-an-xml-file-on-the-sd-card/) , on building an XML file from the results of your query. A few tweaks, and you coule build your own dump file.
You don't say what kind of merge you need to do, but you might be able to use ORMLite, by doing something like override the equals method on your model objects to compare the records and/or combine data from certain fields (assuming the schema is the same), without having to write a lot of SQL.

Related Links

Facebook Phonegap plugin - Able to log in (it seems) but cannot get access token
Qt5.2 cannot show the viewfinder on android screen
Gradle assembleDebug and preDexDebug fail even for new project
animation pushed up when keyboard is visible
image display after second orientation change
Android Create image with ArrayList
Android RxJava, Non Blocking?
Implementing different libraries for different Android versions in one project
App connecting to internet in emulator but not in real device
Android: Use Imageview Coordinates inside imageview and not rhe raw coordinates
Android Virtual Device state is offline after saving to snapshot and starting again
How to remove Text from image (.jpg/png) in android
Activity's onDestroy is called instead of onResume when bringing the app to foreground from recent list
I want to open a activity class from my widget class
Google speech Api v1 not working?
TextView's corner becomes white when clicked

Categories

HOME
eclipse
design-patterns
telegram
formal-languages
powerpoint
jmx
rsa
jelastic
solaris
socket.io
replace
edge
nested-if
character
fabric.io
g++
little-proxy
dynatrace
docx
mongodb-csharp
azure-powershell
capistrano3
standards
easyphp
replication
ag
googlebot
href
maze
ms-access-web-app
has-and-belongs-to-many
progress-bar
genexus-sd
cppreference
scrollview
livelink
python-2.6
deltaspike
quickfixj
card.io
installscript
dm-script
reactivekit
demo
skylink
datacachefactory
facebook-social-plugins
builder
bluez
corruption
arules
pdf-conversion
d3-force-directed
shinobi
seek
preprocessor
mapinfo
dup
mediametadataretriever
nupic
crouton-os
concurrentmodification
java-money
dllimport
poppler
text-search
viola-jones
variadic-templates
cosine-similarity
mruby
linkedin-jsapi
raygun
alternate
tinyxml
radiant
file-not-found
decoupling
syndicationfeed
gwt-openlayers
mt4j
notorm
abstract-data-type
android-icons
iboutlet
josql
ilasm
isa-swizzling
android-holo-everywhere
google-floodlight
lr
collectionviewsource
zen
fail-fast-fail-early
perl5.12

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App