Comments (3)
Hi,
If you read here - https://developer.android.com/reference/android/database/sqlite/SQLiteOpenHelper
SQLiteOpenHelper requires to open the db in readable or writable format first before performing an action first. I do not remember why exactly I try to open the database before copying it, rather than directly copying it to native location.
I will create one test copy of the plugin which just copy the db whenever I get time.
from cordova-plugin-dbcopy.
As near as I can tell, dbcopy is not aware of sqlite-storage. I am using sqlite-storage to control access to the databases (open, close, delete etc). dbcopy is just being used to copy from the location where the database is downloaded to, to the location where the databases are stored. The advantage of dbcopy is that it figures out the location of the databases. Prior to the copy, I close and delete the file using sqlite-storage.
I figured out what was happening by using the built in Android database classes (androidDatabaseImplementation: 2). When using this implementation three files are created in the database directory when the database is opened.
-rw------- 1 u0_a81 u0_a81 69632 2018-06-19 17:40 Code.db
-rw------- 1 u0_a81 u0_a81 32768 2018-06-19 17:40 Code.db-shm
-rw------- 1 u0_a81 u0_a81 412032 2018-06-19 17:40 Code.db-wal
After using copyDbFromStorage, I noticed the same three files being created. sqllite-storage is not aware of the database being opened so I cannot use it to close the database. When I open the database using sqllite-storage, the database appears to be empty (although on the file system, the size does not change). As soon as I close the database, the file is truncated.
I guess an alternate possibility is to close the database after the copy. If I get a chance I will try that today.
Thanks.
from cordova-plugin-dbcopy.
@bryans99 Yes, thats a good observation, closing the database after opening in the plugin might do the trick. Let me see if I can quickly do it.
from cordova-plugin-dbcopy.
Related Issues (20)
- copyDbFromStorage: DB Not Present in www folder HOT 2
- Copy from a different folder HOT 3
- Issue when building Android for ionic HOT 2
- copyDbFromStorage seems to fail for Android 9 HOT 4
- I can't insert or update after copied HOT 1
- Build error in v 2.1.0 HOT 4
- Phonegap build failed with latest version (2.1.1) HOT 8
- copying on a usb storage HOT 1
- copyDbFromStorage copy Db to wrong path in Android 9 HOT 4
- customize output file name HOT 1
- What's error code: 400? HOT 2
- Issue on Android 9 *AFTER* succesfull copy on device HOT 1
- Playstore shows crashed Apps
- Ionic 4 problem copy database.db HOT 3
- Error during installation of plugin HOT 1
- error during plugin installation
- copy to device storage
- showing database already exists HOT 1
- Does sqliteDbCopy run on Capacitor? error:400 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-dbcopy.