@capacitor-community/sqlite 5.7.3-3 → 5.7.4

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 CHANGED
@@ -3,6 +3,29 @@
3
3
  <p align="center"><strong><code>@capacitor-community/sqlite</code></strong></p>
4
4
  <br>
5
5
  <p align="center" style="font-size:50px;color:red"><strong>CAPACITOR 5</strong></p><br>
6
+ <br>
7
+ <!-- Note from the Owner - Start -->
8
+ <p align="center" style="font-size:50px;color:red"><strong>Note from the Owner</strong></p>
9
+ <!-- Note from the Owner - End -->
10
+ <br>
11
+ <!-- Message below Note from the Owner - Start -->
12
+ <p align="left" style="font-size:47px">Start --></p>
13
+ <br>
14
+ <p align="left">
15
+ I have been dedicated to developing and maintaining this plugin for many years since the inception of Ionic Capacitor. Now, at 73+ years old, and with my MacBook Pro becoming obsolete for running Capacitor 6 for iOS, I have made the decision to cease maintenance of the plugin. If anyone wishes to take ownership of this plugin, they are welcome to do so.
16
+ </p>
17
+ <br>
18
+ <p align="left">
19
+ It has been a great honor to be part of this development journey alongside the developer community. I am grateful to see many of you following me on this path and incorporating the plugin into your applications. Your comments and suggestions have motivated me to continuously improve it.
20
+ </p>
21
+ <br>
22
+ <p align="left">
23
+ I have made this decision due to several family-related troubles that require my full attention and time. Therefore, I will not be stepping back. Thank you to all of you for your support.
24
+ </p>
25
+ <br>
26
+ <p align="left" style="font-size:47px">End <--</p>
27
+ <!-- Message below Note from the Owner - End -->
28
+ <br>
6
29
 
7
30
  <p align="center">
8
31
  Capacitor community plugin for Native and Electron SQLite Databases.
@@ -18,7 +41,7 @@
18
41
  <a href="https://www.npmjs.com/package/@capacitor-community/sqlite"><img src="https://img.shields.io/npm/dw/@capacitor-community/sqlite?style=flat-square" /></a>
19
42
  <a href="https://www.npmjs.com/package/@capacitor-community/sqlite"><img src="https://img.shields.io/npm/v/@capacitor-community/sqlite?style=flat-square" /></a>
20
43
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
21
- <a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-44-orange?style=flat-square" /></a>
44
+ <a href="#contributors-"><img src="https://img.shields.io/badge/all%20contributors-45-orange?style=flat-square" /></a>
22
45
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
23
46
  </p>
24
47
 
@@ -416,6 +439,8 @@ lasher23"><img src="https://avatars.githubusercontent.com/u/24244618?v=4" width=
416
439
  mirsella"><img src="https://avatars.githubusercontent.com/u/45905567?v=4" width="50" height="50" /></a>
417
440
  <a href="https://github.com/SaintPepsi" title="
418
441
  SaintPepsi"><img src="https://avatars.githubusercontent.com/u/16056759?v=4" width="50" height="50" /></a>
442
+ <a href="https://github.com/l1ndch" title="
443
+ l1ndch"><img src="https://avatars.githubusercontent.com/u/170952278?v=4" width="50" height="50" /></a>
419
444
  </p>
420
445
 
421
446
 
@@ -345,6 +345,7 @@ public class ExportToJson {
345
345
  String sc = s.replaceAll("\n", "").trim();
346
346
  String[] row = sc.trim().split(" ", 2);
347
347
  JsonColumn jsonRow = new JsonColumn();
348
+ String uppercasedValue = row[0].toUpperCase(); // Define uppercasedValue
348
349
  int oPar;
349
350
  int cPar;
350
351
  switch (row[0].toUpperCase()) {
@@ -356,11 +357,12 @@ public class ExportToJson {
356
357
  row[1] = sc.substring(cPar + 2);
357
358
  jsonRow.setForeignkey(row[0]);
358
359
  }
359
- case "PRIMARY" -> {
360
+ case "PRIMARY", "UNIQUE" -> {
361
+ String prefix = uppercasedValue.equals("PRIMARY") ? "CPK_" : "CUN_";
360
362
  oPar = sc.indexOf("(");
361
363
  cPar = sc.indexOf(")");
362
364
  String pk = sc.substring(oPar + 1, cPar);
363
- row[0] = "CPK_" + pk.replaceAll("§", "_");
365
+ row[0] = prefix + pk.replaceAll("§", "_");
364
366
  row[0] = row[0].replaceAll("_ ", "_");
365
367
  row[1] = sc.substring(0, cPar + 1);
366
368
  jsonRow.setConstraint(row[0]);
@@ -1676,14 +1676,13 @@ class UtilsSQLite {
1676
1676
  let mVal = [];
1677
1677
  if (mValues.length > 0) {
1678
1678
  mVal = this.replaceUndefinedByNull(mValues);
1679
- }
1680
- else {
1681
- const findVals = sqlStmt.match(/\?/gi);
1682
- const nbValues = findVals ? findVals.length : 0;
1683
- for (let i = 0; i < nbValues; i++) {
1684
- mVal.push(null);
1685
- }
1686
- }
1679
+ } /* else {
1680
+ const findVals = sqlStmt.match(/\?/gi);
1681
+ const nbValues = findVals ? findVals.length : 0;
1682
+ for (let i = 0; i < nbValues; i++) {
1683
+ mVal.push(null);
1684
+ }
1685
+ }*/
1687
1686
  const ret = this.runExec(mDB, sqlStmt, mVal, returnMode);
1688
1687
  if (ret.values != null) {
1689
1688
  result.values = ret.values;
@@ -3627,37 +3626,45 @@ class ExportToJson {
3627
3626
  row[0] = scht.substring(0, scht.indexOf(' '));
3628
3627
  row[1] = scht.substring(scht.indexOf(' ') + 1);
3629
3628
  const jsonRow = {};
3630
- if (row[0].toUpperCase() === 'FOREIGN') {
3631
- const oPar = scht.indexOf('(');
3632
- const cPar = scht.indexOf(')');
3633
- const fk = scht.substring(oPar + 1, cPar);
3634
- const fknames = fk.split('§');
3635
- row[0] = fknames.join(',');
3636
- row[0] = row[0].replace(/, /g, ',');
3637
- row[1] = scht.substring(cPar + 2);
3638
- jsonRow['foreignkey'] = row[0];
3639
- }
3640
- else if (row[0].toUpperCase() === 'PRIMARY') {
3641
- const oPar = scht.indexOf('(');
3642
- const cPar = scht.indexOf(')');
3643
- const pk = scht.substring(oPar + 1, cPar);
3644
- const pknames = pk.split('§');
3645
- row[0] = 'CPK_' + pknames.join('_');
3646
- row[0] = row[0].replace(/_ /g, '_');
3647
- row[1] = scht;
3648
- jsonRow['constraint'] = row[0];
3649
- }
3650
- else if (row[0].toUpperCase() === 'CONSTRAINT') {
3651
- const tRow = [];
3652
- const row1t = row[1].trim();
3653
- tRow[0] = row1t.substring(0, row1t.indexOf(' '));
3654
- tRow[1] = row1t.substring(row1t.indexOf(' ') + 1);
3655
- row[0] = tRow[0];
3656
- jsonRow['constraint'] = row[0];
3657
- row[1] = tRow[1];
3658
- }
3659
- else {
3660
- jsonRow['column'] = row[0];
3629
+ switch (row[0].toUpperCase()) {
3630
+ case 'FOREIGN': {
3631
+ const oPar = scht.indexOf('(');
3632
+ const cPar = scht.indexOf(')');
3633
+ const fk = scht.substring(oPar + 1, cPar);
3634
+ const fknames = fk.split('§');
3635
+ row[0] = fknames.join(',');
3636
+ row[0] = row[0].replace(/, /g, ',');
3637
+ row[1] = scht.substring(cPar + 2);
3638
+ jsonRow['foreignkey'] = row[0];
3639
+ break;
3640
+ }
3641
+ case 'PRIMARY':
3642
+ case 'UNIQUE': {
3643
+ const prefix = row[0].toUpperCase() === 'PRIMARY' ? 'CPK_' : 'CUN_';
3644
+ const oPar = scht.indexOf('(');
3645
+ const cPar = scht.indexOf(')');
3646
+ const pk = scht.substring(oPar + 1, cPar);
3647
+ const pknames = pk.split('§');
3648
+ row[0] = prefix + pknames.join('_');
3649
+ row[0] = row[0].replace(/_ /g, '_');
3650
+ row[1] = scht;
3651
+ jsonRow['constraint'] = row[0];
3652
+ break;
3653
+ }
3654
+ case 'CONSTRAINT': {
3655
+ const tRow = [];
3656
+ const row1t = row[1].trim();
3657
+ tRow[0] = row1t.substring(0, row1t.indexOf(' '));
3658
+ tRow[1] = row1t.substring(row1t.indexOf(' ') + 1);
3659
+ row[0] = tRow[0];
3660
+ jsonRow['constraint'] = row[0];
3661
+ row[1] = tRow[1];
3662
+ break;
3663
+ }
3664
+ default: {
3665
+ jsonRow['column'] = row[0];
3666
+ break;
3667
+ }
3661
3668
  }
3662
3669
  jsonRow['value'] = row[1].replace(/§/g, ',');
3663
3670
  schema.push(jsonRow);