Skip to content
This repository was archived by the owner on Jul 7, 2022. It is now read-only.

Commit 57ad66d

Browse files
committed
Update to support migrate
1 parent 88c5368 commit 57ad66d

File tree

5 files changed

+37
-16
lines changed

5 files changed

+37
-16
lines changed

demo/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
If you want to test the Encryption or Commercial features in the demo app; then drop the plugins in the root of the github folder, and then do:
44

55
### Commercial:
6-
`tns plugin add ../nativescript-commercial-1.3.0.tgz` in this folder.
6+
`tns plugin add ../nativescript-commercial-1.3.2.tgz` in this folder.
77

88
### Encryption:
9-
`tns plugin add ../nativescript-encryption-1.3.0.tgz` in this folder.
9+
`tns plugin add ../nativescript-encryption-1.3.1.tgz` in this folder.
1010

1111
## Developed by
1212
[![MasterTech](https://plugins.nativescript.rocks/i/mtns.png)](https://plugins.nativescript.rocks/mastertech-nstudio)
@@ -21,4 +21,6 @@ The [commercial version](http://nativescript.tools/product/10) comes with the fo
2121
- Prepared statements
2222
- Multilevel transaction support
2323
- Encryption
24-
- **Multi-threading**
24+
- Multi-threading
25+
- Encrypted Drivers is using latest SQLite that fixes multiple CVE's
26+

demo/app/main-page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ exports.pageLoaded = function(args) {
3838
if (!sqlite.exists(dbname)) {
3939
sqlite.copyDatabase(dbname);
4040
}
41-
new sqlite(dbname, {key: 'testing', multithreading: !!sqlite.HAS_COMMERCIAL}, function(err, dbConnection) {
41+
new sqlite(dbname, {key: 'testing', multithreading: !!sqlite.HAS_COMMERCIAL, migrate: true}, function(err, dbConnection) {
4242
if (err) {
4343
console.log(err, err.stack);
4444
}

demo/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
{
1+
{
22
"nativescript": {
33
"id": "org.nativescript.demo",
44
"tns-android": {
5-
"version": "5.1.0"
5+
"version": "5.2.1"
66
},
77
"tns-ios": {
8-
"version": "5.1.0"
8+
"version": "5.2.0"
99
}
1010
},
11-
"description": "NativeScript Application",
12-
"license": "SEE LICENSE IN <your-license-filename>",
11+
"description": "SQLite Demo Application",
12+
"license": "MIT",
1313
"repository": "<fill-your-repository-here>",
1414
"dependencies": {
15+
"nativescript-sqlite": "file:../src",
1516
"nativescript-theme-core": "~1.0.4",
16-
"tns-core-modules": "~5.1.0",
17-
"nativescript-sqlite": "file:..\\src"
17+
"tns-core-modules": "^5.2.2"
1818
},
1919
"devDependencies": {
20-
"nativescript-dev-webpack": "~0.19.0"
20+
"nativescript-dev-webpack": "^0.20.2"
2121
},
22-
"readme": "NativeScript Application"
22+
"readme": "SQLite Demo Application"
2323
}

demo/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ module.exports = env => {
207207
{ from: { glob: "fonts/**" } },
208208
{ from: { glob: "**/*.jpg" } },
209209
{ from: { glob: "**/*.png" } },
210+
{ from: { glob: "**/*.sqlite" } },
210211
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
211212
// Generate a bundle starter script and activate it in package.json
212213
new nsWebpack.GenerateBundleStarterPlugin([

src/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ a section that looks like so:
8282
{ from: "**/*.png" },
8383
```
8484
85-
Add a new line `{from: "**/*.sqlite"}` so that it will pick up your sqlite file while bundling the application.
85+
Add a new line `{ from: { glob: "**/*.sqlite" } },` so that it will pick up your sqlite file while bundling the application.
8686
8787
In addition if you are not using the Commercial or Encrypted plugin; you would need to add:
8888
@@ -135,7 +135,8 @@ If you are planning on shipping a database with the application; drop the file i
135135
* options
136136
* "readOnly", which if set to true will make the db read only when it opens it
137137
* "key", used for using/opening encrypted databases (See Encryption at bottom of document)
138-
* "multithreading", enable background multitasking. All SQL is ran on a background worker thread.
138+
* "multithreading", enable background multitasking. All SQL is ran on a background worker thread.
139+
* "migrate", migrates a Encrypted Sql database from v3 to the new v4. If you are a new user you do not need to set this flag as new created databases will already be in v4. If you are upgrading a app that used v1.3.0 or earlier of NS-Sqlite-Encrypted; then you will probably want to set this flag to true.
139140
* (optional) callback (error, db): db is the fully OPEN database object that allows interacting with the db.
140141
* RETURNS: promise of the DB object
141142
@@ -361,7 +362,24 @@ To enable commercial: `tns plugin add nativescript-sqlite-commercial-1.2.0.tgz`
361362
Pass the encryption key into database open function using the `options.key` and it will be applied. Please note the database itself MUST be created with encryption to use encryption. So if you create a plain database, you can not retroactively add encryption to it.
362363
If you pass a blank (**""**) empty key, then it will treat it as no key. But, it will still use the encrypted driver in case you need certain features from the more modern sqlite driver; but don't need encryption.
363364
364-
Note: Enabling/Compiling in the encryption driver adds about 3 megs to the size to the application APK on android and about 2 megs to a iOS application.
365+
Note: Enabling/Compiling in the encryption driver adds about 3 megs to the size to the application APK on android and about 2 megs to a iOS application.
366+
367+
#### Encryption Upgrade
368+
There is a NEW upgrade option you can pass to the database constructor. if you were using an older version (1.3.0 or earlier) of this NS-Sqlite-Encryption.
369+
* "migrate", migrates a Encrypted Sql database from v3 to the new v4. If you are a new user you do not need to set this flag as new created databases will already be in v4. If you are upgrading a app that used v1.3.0 or earlier of NS-Sqlite-Encrypted; then you will probably want to set this flag to true.
370+
371+
#### iOS Encryption Notes
372+
373+
If you see `SQLCipher does not seem to be linked into the application`
374+
375+
Sometimes iOS decides it really wants to bring in the native SQLite over the encrypted version.
376+
A couple things you can try:
377+
- Delete some files that aren't needed when using encryption that might bring in the standard sqlite plugin.
378+
- `rm node_modules/nativescript-sqlite/platforms/ios/build.xcconfig`
379+
- `rm node_modules/nativescript-sqlite/platforms/ios/module.modulemap`
380+
- Then `tns platform clean ios`
381+
382+
365383
366384
### Multitasking / Multithreading
367385
The commercial version supports putting all SQL access into a background thread, so your UI doesn't freeze while doing data access. To enable; just pass in {multithreading: true} as an option when creating a new Sqlite connection.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy