@capacitor-community/sqlite 4.1.0-2 → 4.1.0-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -164
- package/electron/dist/plugin.js +6 -28
- package/electron/dist/plugin.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,121 +26,41 @@
|
|
|
26
26
|
| ----------------- | ----------------------------------------- | ------ |
|
|
27
27
|
| Quéau Jean Pierre | [jepiqueau](https://github.com/jepiqueau) | |
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
- [changelog]https://github.com/capacitor-community/sqlite/blob/master/changelog.md
|
|
36
|
-
|
|
37
|
-
The test has been achieved on:
|
|
38
|
-
|
|
39
|
-
- a [Ionic/Angular app](https://github.com/jepiqueau/angular-sqlite-app-starter)
|
|
40
|
-
|
|
41
|
-
- a [Ionic/React app](https://github.com/jepiqueau/react-sqlite-app-starter)
|
|
42
|
-
|
|
43
|
-
- a [Ionic/Vue app](https://github.com/jepiqueau/vue-sqlite-app-starter)
|
|
44
|
-
|
|
45
|
-
- a [React Vite app](https://github.com/jepiqueau/react-vite-sqlite-app)
|
|
29
|
+
To install:
|
|
30
|
+
```
|
|
31
|
+
npm install @capacitor-community/sqlite
|
|
32
|
+
npx cap sync
|
|
33
|
+
```
|
|
46
34
|
|
|
47
|
-
|
|
35
|
+
## More Reading:
|
|
48
36
|
|
|
49
|
-
-
|
|
37
|
+
- [Releases](https://github.com/capacitor-community/sqlite/blob/master/info_releases.md)
|
|
38
|
+
- [Changelog](https://github.com/capacitor-community/sqlite/blob/master/CHANGELOG.md)
|
|
39
|
+
- [Issues](https://github.com/capacitor-community/sqlite/issues)
|
|
40
|
+
- [Capacitor documentation](https://capacitorjs.com/docs/)
|
|
41
|
+
- [Datatypes In SQLite Version 3](https://www.sqlite.org/datatype3.html)
|
|
50
42
|
|
|
51
|
-
- a [SolidJS Vite app](https://github.com/jepiqueau/capacitor-solid-sqlite)
|
|
52
43
|
|
|
53
|
-
##
|
|
44
|
+
## Web Quirks
|
|
54
45
|
|
|
55
46
|
The plugin follows the guidelines from the `Capacitor Team`,
|
|
56
47
|
|
|
57
48
|
- [Capacitor Browser Support](https://capacitorjs.com/docs/v3/web#browser-support)
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## Installation
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
npm install @capacitor-community/sqlite
|
|
65
|
-
npm run build
|
|
66
|
-
npx cap add android
|
|
67
|
-
npx cap add ios
|
|
68
|
-
npx cap add @capacitor-community/electron
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
and do when you update
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npx cap sync
|
|
75
|
-
npx cap sync @capacitor-community/electron
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Web
|
|
50
|
+
Meaning that it will not work in IE11 without additional JavaScript transformations, e.g. with [Babel](https://babeljs.io/).
|
|
51
|
+
You'll need the usual capacitor/android/react npm script to build and copy the assets folder.
|
|
79
52
|
|
|
80
53
|
#### For Angular framework
|
|
81
54
|
|
|
82
|
-
-
|
|
55
|
+
- Copy manually the file `sql-wasm.wasm` from `node_modules/sql.js/dist/sql-wasm.wasm` to the `src/assets` folder of YOUR_APP
|
|
83
56
|
|
|
84
57
|
#### For Vue & React frameworks
|
|
85
58
|
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
### IOS
|
|
89
|
-
|
|
90
|
-
- on iOS, no further steps needed.
|
|
91
|
-
|
|
92
|
-
### Android
|
|
93
|
-
|
|
94
|
-
- On Android, no further steps needed.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### Electron
|
|
98
|
-
|
|
99
|
-
- On Electron, go to the Electron folder of YOUR_APPLICATION
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
cd electron
|
|
103
|
-
npm install --save sqlite3
|
|
104
|
-
npm install --save jszip
|
|
105
|
-
npm install --save-dev @types/sqlite3
|
|
106
|
-
npm run build
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## Build & Run
|
|
59
|
+
- Copy manually the file `sql-wasm.wasm` from `node_modules/sql.js/dist/sql-wasm.wasm` to the `public/assets` folder of YOUR_APP
|
|
110
60
|
|
|
111
|
-
|
|
112
|
-
npm run build
|
|
113
|
-
npx cap copy
|
|
114
|
-
npx cap copy web
|
|
115
|
-
npx cap copy @capacitor-community/electron
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### Web
|
|
119
|
-
- Angular
|
|
120
|
-
```
|
|
121
|
-
ionic serve
|
|
122
|
-
```
|
|
123
|
-
- Vue
|
|
124
|
-
```
|
|
125
|
-
npm run serve
|
|
126
|
-
```
|
|
127
|
-
- React
|
|
128
|
-
```
|
|
129
|
-
npm run start
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### IOS
|
|
61
|
+
## Android Quirks
|
|
133
62
|
|
|
134
|
-
|
|
135
|
-
npx cap open ios
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Android
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
-
npx cap open android
|
|
142
|
-
```
|
|
143
|
-
In case you get the following error:
|
|
63
|
+
In case you get the following error when building your app in Android Studio:
|
|
144
64
|
`x files found with path 'build-data.properties'.`
|
|
145
65
|
You can you add the following code to `app/build.gradle`:
|
|
146
66
|
```
|
|
@@ -148,28 +68,25 @@ You can you add the following code to `app/build.gradle`:
|
|
|
148
68
|
exclude 'build-data.properties'
|
|
149
69
|
}
|
|
150
70
|
```
|
|
151
|
-
See [#301](https://github.com/capacitor-community/sqlite/issues/301) and [SO](https://stackoverflow.com/questions/63291529/how-to-fix-more-than-one-file-was-found-with-os-independent-path-build-data-pro
|
|
152
|
-
|
|
153
|
-
### Electron
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
npx cap open @capacitor-community/electron
|
|
157
|
-
```
|
|
71
|
+
See [#301](https://github.com/capacitor-community/sqlite/issues/301) and [SO question](https://stackoverflow.com/questions/63291529/how-to-fix-more-than-one-file-was-found-with-os-independent-path-build-data-pro) for more information.
|
|
158
72
|
|
|
159
|
-
##
|
|
73
|
+
## Electron Quirks
|
|
160
74
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
## Issues
|
|
75
|
+
- On Electron, go to the Electron folder of YOUR_APPLICATION
|
|
164
76
|
|
|
165
|
-
|
|
77
|
+
```bash
|
|
78
|
+
cd electron
|
|
79
|
+
npm install --save sqlite3
|
|
80
|
+
npm install --save jszip
|
|
81
|
+
npm install --save-dev @types/sqlite3
|
|
82
|
+
```
|
|
166
83
|
|
|
84
|
+
## IOS Quirks
|
|
167
85
|
|
|
168
|
-
|
|
86
|
+
- on iOS, no further steps needed.
|
|
169
87
|
|
|
170
|
-
No configuration required for this plugin
|
|
171
88
|
|
|
172
|
-
## Supported
|
|
89
|
+
## Supported Methods by Platform
|
|
173
90
|
|
|
174
91
|
| Name | Android | iOS | Electron | Web |
|
|
175
92
|
| :-------------------------- | :------ | :-- | :------- | :-- |
|
|
@@ -218,62 +135,54 @@ No configuration required for this plugin
|
|
|
218
135
|
| isNCDatabase | ✅ | ✅ | ❌ | ❌ |
|
|
219
136
|
| transaction | ✅ | ✅ | ✅ | ✅ |
|
|
220
137
|
|
|
221
|
-
## Supported SQLite Types
|
|
222
|
-
|
|
223
|
-
-[Datatypes In SQLite Version 3](https://www.sqlite.org/datatype3.html)
|
|
224
138
|
|
|
225
|
-
## Documentation
|
|
139
|
+
## Documentation & APIs
|
|
226
140
|
|
|
227
|
-
|
|
141
|
+
- [API](https://github.com/capacitor-community/sqlite/blob/master/docs/API.md)
|
|
228
142
|
|
|
229
|
-
- [
|
|
143
|
+
- [API Connection Wrapper](https://github.com/capacitor-community/sqlite/blob/master/docs/APIConnection.md)
|
|
230
144
|
|
|
231
|
-
- [
|
|
145
|
+
- [API DB Connection Wrapper](https://github.com/capacitor-community/sqlite/blob/master/docs/APIDBConnection.md)
|
|
232
146
|
|
|
233
|
-
- [
|
|
147
|
+
- [Import-Export Json](https://github.com/capacitor-community/sqlite/blob/master/docs/ImportExportJson.md)
|
|
234
148
|
|
|
235
|
-
- [
|
|
149
|
+
- [Upgrade Database Version](https://github.com/capacitor-community/sqlite/blob/master/docs/UpgradeDatabaseVersion.md)
|
|
236
150
|
|
|
237
|
-
- [
|
|
151
|
+
- [Migrating Cordova Databases](https://github.com/capacitor-community/sqlite/blob/master/docs/MigratingCordovaDatabases.md)
|
|
238
152
|
|
|
239
|
-
- [
|
|
153
|
+
- [Type ORM](https://github.com/capacitor-community/sqlite/blob/master/docs/TypeORM-Usage.md)
|
|
240
154
|
|
|
241
|
-
- [
|
|
155
|
+
- [Web Usage](https://github.com/capacitor-community/sqlite/blob/master/docs/Web-Usage.md)
|
|
242
156
|
|
|
243
|
-
- [
|
|
157
|
+
- [Non Conformed Databases](https://github.com/capacitor-community/sqlite/blob/master/docs/NonConformedDatabases.md)
|
|
244
158
|
|
|
245
|
-
- [
|
|
159
|
+
- [Biometric Authentication](https://github.com/capacitor-community/sqlite/blob/master/docs/Biometric-Authentication.md)
|
|
246
160
|
|
|
247
|
-
- [Biometric_Authentication](https://github.com/capacitor-community/sqlite/blob/master/docs/Biometric-Authentication.md)
|
|
248
161
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
- [Ionic/Angular_Usage_Documentation](https://github.com/capacitor-community/sqlite/blob/master/docs/Ionic-Angular-Usage.md)
|
|
252
|
-
|
|
253
|
-
- [Ionic/React_Usage_Documentation](https://github.com/capacitor-community/sqlite/blob/master/docs/Ionic-React-Usage.md)
|
|
254
|
-
|
|
255
|
-
- [Ionic/Vue_Usage_Documentation](https://github.com/capacitor-community/sqlite/blob/master/docs/Ionic-Vue-Usage.md)
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
## Applications demonstrating the use of the plugin
|
|
162
|
+
## Applications demonstrating the use of the plugin and related documentation
|
|
259
163
|
|
|
260
164
|
### Ionic/Angular
|
|
261
165
|
|
|
166
|
+
- [Ionic/Angular Usage Documentation](https://github.com/capacitor-community/sqlite/blob/master/docs/Ionic-Angular-Usage.md)
|
|
167
|
+
|
|
262
168
|
- [angular-sqlite-app-starter](https://github.com/jepiqueau/angular-sqlite-app-starter)
|
|
263
169
|
|
|
264
170
|
- [angular-sqlite-synchronize-app](https://github.com/jepiqueau/angular-sqlite-synchronize-app)
|
|
265
171
|
|
|
266
172
|
### Ionic/React
|
|
267
173
|
|
|
174
|
+
- [Ionic/React Usage Documentation](https://github.com/capacitor-community/sqlite/blob/master/docs/Ionic-React-Usage.md)
|
|
175
|
+
|
|
268
176
|
- [react-sqlite-app-starter](https://github.com/jepiqueau/react-sqlite-app-starter)
|
|
269
177
|
|
|
270
178
|
### React+Vite
|
|
271
179
|
|
|
272
180
|
- [react-vite-sqlite-app](https://github.com/jepiqueau/react-vite-sqlite-app)
|
|
273
181
|
|
|
274
|
-
|
|
275
182
|
### Ionic/Vue
|
|
276
183
|
|
|
184
|
+
- [Ionic/Vue Usage Documentation](https://github.com/capacitor-community/sqlite/blob/master/docs/Ionic-Vue-Usage.md)
|
|
185
|
+
|
|
277
186
|
- [vue-sqlite-app-starter](https://github.com/jepiqueau/vue-sqlite-app-starter)
|
|
278
187
|
|
|
279
188
|
### Vue
|
|
@@ -288,10 +197,9 @@ No configuration required for this plugin
|
|
|
288
197
|
|
|
289
198
|
- [solidjs-vite-sqlite-app](https://github.com/jepiqueau/capacitor-solid-sqlite)
|
|
290
199
|
|
|
200
|
+
### Vue TypeORM app
|
|
291
201
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
- [see capacitor documentation](https://capacitor.ionicframework.com/docs/getting-started/with-ionic)
|
|
202
|
+
- [vue-typeorm-app](https://github.com/jepiqueau/vue-typeorm-app)
|
|
295
203
|
|
|
296
204
|
|
|
297
205
|
## Dependencies
|
|
@@ -309,28 +217,27 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
309
217
|
<!-- prettier-ignore-start -->
|
|
310
218
|
<!-- markdownlint-disable -->
|
|
311
219
|
<p align="center">
|
|
312
|
-
<a href="https://github.com/jepiqueau"><img src="https://github.com/jepiqueau.png?size=100" width="50" height="50"
|
|
313
|
-
<a href="https://github.com/paulantoine2"><img src="https://github.com/paulantoine2.png?size=100" width="50" height="50" /></a>
|
|
314
|
-
<a href="https://github.com/karyfars"><img src="https://github.com/karyfars.png?size=100" width="50" height="50" /></a>
|
|
315
|
-
<a href="https://github.com/chriswep"><img src="https://github.com/chriswep.png?size=100" width="50" height="50" /></a>
|
|
316
|
-
<a href="https://github.com/nirajhinge"><img src="https://github.com/nirajhinge.png?size=100" width="50" height="50" /></a>
|
|
317
|
-
<a href="https://github.com/digaus"><img src="https://github.com/digaus.png?size=100" width="50" height="50" /></a>
|
|
318
|
-
<a href="https://github.com/IT-MikeS"><img src="https://github.com/IT-MikeS.png?size=100" width="50" height="50" /></a>
|
|
319
|
-
<a href="https://github.com/peakcool"><img src="https://github.com/peakcool.png?size=100" width="50" height="50" /></a>
|
|
320
|
-
<a href="https://github.com/gion-andri"><img src="https://github.com/gion-andri.png?size=100" width="50" height="50" /></a>
|
|
321
|
-
<a href="https://github.com/robingenz"><img src="https://github.com/robingenz.png?size=100" width="50" height="50" /></a>
|
|
322
|
-
<a href="https://github.com/dewald-els"><img src="https://github.com/dewald-els.png?size=100" width="50" height="50" /></a>
|
|
323
|
-
<a href="https://github.com/joewoodhouse"><img src="https://github.com/joewoodhouse.png?size=100" width="50" height="50" /></a>
|
|
324
|
-
<a href="https://github.com/ptasheq"><img src="https://github.com/ptasheq.png?size=100" width="50" height="50" /></a>
|
|
325
|
-
<a href="https://github.com/victorybiz"><img src="https://github.com/victorybiz.png?size=100" width="50" height="50" /></a>
|
|
326
|
-
<a href="https://github.com/tobiasmuecksch"><img src="https://github.com/tobiasmuecksch.png?size=100" width="50" height="50" /></a>
|
|
327
|
-
<a href="https://github.com/dragermrb"><img src="https://github.com/dragermrb.png?size=100" width="50" height="50" /></a>
|
|
328
|
-
<a href="https://github.com/iamcco"><img src="https://github.com/iamcco.png?size=100" width="50" height="50" /></a>
|
|
329
|
-
<a href="https://github.com/eltociear"><img src="https://github.com/eltociear.png?size=100" width="50" height="50" /></a>
|
|
330
|
-
<a href="https://github.com/
|
|
331
|
-
<a href="https://github.com/
|
|
332
|
-
<a href="https://github.com/
|
|
333
|
-
<a href="https://github.com/rdlabo"><img src="https://github.com/rdlabo.png?size=100" width="50" height="50" /></a>
|
|
220
|
+
<a href="https://github.com/jepiqueau" title="jepiqueau"><img src="https://github.com/jepiqueau.png?size=100" width="50" height="50"/></a>
|
|
221
|
+
<a href="https://github.com/paulantoine2" title="paulantoine2"><img src="https://github.com/paulantoine2.png?size=100" width="50" height="50" alt=""/></a>
|
|
222
|
+
<a href="https://github.com/karyfars" title="karyfars"><img src="https://github.com/karyfars.png?size=100" width="50" height="50" /></a>
|
|
223
|
+
<a href="https://github.com/chriswep" title="chriswep"><img src="https://github.com/chriswep.png?size=100" width="50" height="50" /></a>
|
|
224
|
+
<a href="https://github.com/nirajhinge" title="nirajhinge"><img src="https://github.com/nirajhinge.png?size=100" width="50" height="50" /></a>
|
|
225
|
+
<a href="https://github.com/digaus" title="digaus"><img src="https://github.com/digaus.png?size=100" width="50" height="50" /></a>
|
|
226
|
+
<a href="https://github.com/IT-MikeS" title="IT-MikeS"><img src="https://github.com/IT-MikeS.png?size=100" width="50" height="50" /></a>
|
|
227
|
+
<a href="https://github.com/peakcool" title="peakcool"><img src="https://github.com/peakcool.png?size=100" width="50" height="50" /></a>
|
|
228
|
+
<a href="https://github.com/gion-andri" title="gion-andri"><img src="https://github.com/gion-andri.png?size=100" width="50" height="50" /></a>
|
|
229
|
+
<a href="https://github.com/robingenz" title="robingenz"><img src="https://github.com/robingenz.png?size=100" width="50" height="50" /></a>
|
|
230
|
+
<a href="https://github.com/dewald-els" title="dewald-els"><img src="https://github.com/dewald-els.png?size=100" width="50" height="50" /></a>
|
|
231
|
+
<a href="https://github.com/joewoodhouse" title="joewoodhouse"><img src="https://github.com/joewoodhouse.png?size=100" width="50" height="50" /></a>
|
|
232
|
+
<a href="https://github.com/ptasheq" title="ptasheq"><img src="https://github.com/ptasheq.png?size=100" width="50" height="50" /></a>
|
|
233
|
+
<a href="https://github.com/victorybiz" title="victorybiz"><img src="https://github.com/victorybiz.png?size=100" width="50" height="50" /></a>
|
|
234
|
+
<a href="https://github.com/tobiasmuecksch" title="tobiasmuecksch"><img src="https://github.com/tobiasmuecksch.png?size=100" width="50" height="50" /></a>
|
|
235
|
+
<a href="https://github.com/dragermrb" title="dragermrb"><img src="https://github.com/dragermrb.png?size=100" width="50" height="50" /></a>
|
|
236
|
+
<a href="https://github.com/iamcco" title="iamcco"><img src="https://github.com/iamcco.png?size=100" width="50" height="50" /></a>
|
|
237
|
+
<a href="https://github.com/eltociear" title="eltociear"><img src="https://github.com/eltociear.png?size=100" width="50" height="50" /></a>
|
|
238
|
+
<a href="https://github.com/antoniovlx" title="antoniovlx"><img src="https://github.com/antoniovlx.png?size=100" width="50" height="50" /></a>
|
|
239
|
+
<a href="https://github.com/HarelM" title="HarelM"><img src="https://github.com/HarelM.png?size=100" width="50" height="50" /></a>
|
|
240
|
+
<a href="https://github.com/rdlabo" title="rdlabo"><img src="https://github.com/rdlabo.png?size=100" width="50" height="50" /></a>
|
|
334
241
|
</p>
|
|
335
242
|
|
|
336
243
|
<!-- markdownlint-enable -->
|
package/electron/dist/plugin.js
CHANGED
|
@@ -43,10 +43,6 @@ class UtilsSQLite {
|
|
|
43
43
|
password: string,*/) {
|
|
44
44
|
const msg = 'OpenOrCreateDatabase: ';
|
|
45
45
|
// open sqlite3 database
|
|
46
|
-
/* const mDB: any = new this.JSQlite.Database(pathDB, {
|
|
47
|
-
verbose: console.log,
|
|
48
|
-
});
|
|
49
|
-
*/
|
|
50
46
|
const mDB = new this.SQLite3.Database(pathDB, {
|
|
51
47
|
verbose: console.log,
|
|
52
48
|
});
|
|
@@ -345,9 +341,7 @@ class UtilsSQLite {
|
|
|
345
341
|
if (trimStmt === 'DELETE FROM' &&
|
|
346
342
|
stmt.toLowerCase().includes('WHERE'.toLowerCase())) {
|
|
347
343
|
const whereStmt = `${stmt.trim()};`;
|
|
348
|
-
console.log(`in utilsSQLite execute whereStmt ${whereStmt}`);
|
|
349
344
|
const rStmt = await this.deleteSQL(mDB, whereStmt, []);
|
|
350
|
-
console.log(`in utilsSQLite execute rStmt ${rStmt}`);
|
|
351
345
|
resArr.push(rStmt);
|
|
352
346
|
}
|
|
353
347
|
else {
|
|
@@ -356,7 +350,6 @@ class UtilsSQLite {
|
|
|
356
350
|
}
|
|
357
351
|
sqlStmt = resArr.join(';');
|
|
358
352
|
}
|
|
359
|
-
console.log(`in utilsSQLite execute sqlStmt ${sqlStmt}`);
|
|
360
353
|
await this.execDB(mDB, sqlStmt);
|
|
361
354
|
changes = (await this.dbChanges(mDB)) - initChanges;
|
|
362
355
|
return Promise.resolve(changes);
|
|
@@ -448,7 +441,6 @@ class UtilsSQLite {
|
|
|
448
441
|
async runExec(db, stmt, values = []) {
|
|
449
442
|
return new Promise((resolve, reject) => {
|
|
450
443
|
if (values != null && values.length > 0) {
|
|
451
|
-
console.log(`in runExec stmt: ${stmt} values: ${values}`);
|
|
452
444
|
db.run(stmt, values, (err) => {
|
|
453
445
|
if (err) {
|
|
454
446
|
console.log(`in runExec err1: ${JSON.stringify(err)}`);
|
|
@@ -512,7 +504,6 @@ class UtilsSQLite {
|
|
|
512
504
|
.substring('DELETE FROM'.length)
|
|
513
505
|
.trim();
|
|
514
506
|
sqlStmt = `UPDATE ${tableName} SET sql_deleted = 1 ${clauseStmt}`;
|
|
515
|
-
console.log(`in deleteSQL sqlStmt: ${sqlStmt}`);
|
|
516
507
|
// Find REFERENCES if any and update the sql_deleted column
|
|
517
508
|
await this.findReferencesAndUpdate(db, tableName, clauseStmt, values);
|
|
518
509
|
}
|
|
@@ -537,31 +528,24 @@ class UtilsSQLite {
|
|
|
537
528
|
return;
|
|
538
529
|
}
|
|
539
530
|
const tableNameWithRefs = references.pop();
|
|
540
|
-
console.log(`references: ${references}`);
|
|
541
|
-
console.log(`tableNameWithRefs: ${tableNameWithRefs}`);
|
|
542
531
|
for (const refe of references) {
|
|
543
532
|
// get the tableName of the reference
|
|
544
533
|
const refTable = await this.getReferenceTableName(refe);
|
|
545
534
|
if (refTable.length <= 0) {
|
|
546
535
|
continue;
|
|
547
536
|
}
|
|
548
|
-
console.log(`refTable: ${refTable}`);
|
|
549
537
|
// get the with references columnName
|
|
550
538
|
const withRefsNames = await this.getWithRefsColumnName(refe);
|
|
551
|
-
console.log(`withRefsNames: ${withRefsNames}`);
|
|
552
539
|
if (withRefsNames.length <= 0) {
|
|
553
540
|
continue;
|
|
554
541
|
}
|
|
555
542
|
// get the referenced columnName
|
|
556
543
|
const colNames = await this.getReferencedColumnName(refe);
|
|
557
|
-
console.log(`colNames: ${colNames}`);
|
|
558
544
|
if (colNames.length <= 0) {
|
|
559
545
|
continue;
|
|
560
546
|
}
|
|
561
547
|
// update the where clause
|
|
562
548
|
const uWhereStmt = await this.updateWhere(whereStmt, withRefsNames, colNames);
|
|
563
|
-
console.log(`whereStmt: ${whereStmt}`);
|
|
564
|
-
console.log(`uWhereStmt: ${uWhereStmt}`);
|
|
565
549
|
if (uWhereStmt.length <= 0) {
|
|
566
550
|
continue;
|
|
567
551
|
}
|
|
@@ -571,31 +555,22 @@ class UtilsSQLite {
|
|
|
571
555
|
updTableName = refTable;
|
|
572
556
|
updColNames = withRefsNames;
|
|
573
557
|
}
|
|
574
|
-
console.log(`updTableName: ${updTableName}`);
|
|
575
|
-
console.log(`updColNames: ${updColNames}`);
|
|
576
558
|
//update sql_deleted for this reference
|
|
577
559
|
const stmt = 'UPDATE ' + updTableName + ' SET sql_deleted = 1 ' + uWhereStmt;
|
|
578
|
-
console.log(`stmt: ${stmt}`);
|
|
579
|
-
console.log(`values: ${values}`);
|
|
580
560
|
if (values != null && values.length > 0) {
|
|
581
561
|
const mVal = await this.replaceUndefinedByNull(values);
|
|
582
562
|
let arrVal = whereStmt.split('?');
|
|
583
563
|
if (arrVal[arrVal.length - 1] === ';')
|
|
584
564
|
arrVal = arrVal.slice(0, -1);
|
|
585
|
-
console.log(`arrVal: ${arrVal}`);
|
|
586
565
|
const selValues = [];
|
|
587
566
|
for (const [j, val] of arrVal.entries()) {
|
|
588
|
-
console.log(`j: ${j} val: ${val}`);
|
|
589
567
|
for (const updVal of updColNames) {
|
|
590
568
|
const idxVal = val.indexOf(updVal);
|
|
591
|
-
console.log(`updVal: ${updVal} idxVal ${idxVal}`);
|
|
592
569
|
if (idxVal > -1) {
|
|
593
570
|
selValues.push(mVal[j]);
|
|
594
571
|
}
|
|
595
572
|
}
|
|
596
573
|
}
|
|
597
|
-
console.log(`*** stmt: ${selValues}`);
|
|
598
|
-
console.log(`*** selValues: ${selValues}`);
|
|
599
574
|
await db.run(stmt, selValues);
|
|
600
575
|
}
|
|
601
576
|
else {
|
|
@@ -2808,10 +2783,13 @@ class UtilsFile {
|
|
|
2808
2783
|
*/
|
|
2809
2784
|
getAssetsDatabasesPath() {
|
|
2810
2785
|
let retPath = '';
|
|
2811
|
-
const
|
|
2812
|
-
const webDir = JSON.parse(rawdata).webDir;
|
|
2786
|
+
const webDir = this.capConfig.webDir;
|
|
2813
2787
|
const dir = webDir === 'www' ? 'src' : 'public';
|
|
2814
|
-
|
|
2788
|
+
let mAppPath = this.appPath;
|
|
2789
|
+
if (this.Path.basename(this.appPath) === "electron") {
|
|
2790
|
+
mAppPath = this.Path.dirname(this.appPath);
|
|
2791
|
+
}
|
|
2792
|
+
retPath = this.Path.resolve(mAppPath, dir, 'assets', 'databases');
|
|
2815
2793
|
return retPath;
|
|
2816
2794
|
}
|
|
2817
2795
|
/**
|