mirror of
https://gitee.com/shuto/cordova-plugin-dbcopy.git
synced 2024-10-06 09:42:06 +08:00
Added Plugin Usage
This commit is contained in:
parent
4e108357a1
commit
f42a584c44
38
README.md
38
README.md
@ -2,3 +2,41 @@ cordova-plugin-dbcopy
|
||||
=====================
|
||||
|
||||
Copy SQLite Database from assets(Android) or Resources(iOS) to App Directory
|
||||
|
||||
#####Note
|
||||
|
||||
If you are using this [SQlite Plugin](https://github.com/brodysoft/Cordova-SQLitePlugin), then do not give the .db extension to your file while pasting it. Since the plugin automatically appends the .db extension while opening the database.
|
||||
|
||||
For example, if you are database name is demo.db, then remove the .db extension and paste the file with a name "demo" only (without quotes".
|
||||
|
||||
**Android**
|
||||
|
||||
Put your sqlite database in the assets directory.
|
||||
|
||||
|
||||
**iOS**
|
||||
|
||||
Put your database in Resources directory and then Add it in to your Xcode Project.
|
||||
Right Click on the Resources directory, then click Add files.
|
||||
|
||||
**Code**
|
||||
In your JavaScript or HTML use the following method -
|
||||
|
||||
```
|
||||
function dbcopy()
|
||||
{
|
||||
window.plugins.sqlDB.copy("demo",copysuccess,copyerror);
|
||||
}
|
||||
|
||||
function copysuccess()
|
||||
{
|
||||
//open db and run your queries
|
||||
}
|
||||
|
||||
funtion copyerror()
|
||||
{
|
||||
//db already exists or problem in copying the db file. Check the Log.
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user