@capgo/capacitor-data-storage-sqlite 6.0.59 → 7.1.0
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/CapgoCapacitorDataStorageSqlite.podspec +2 -2
- package/Package.swift +30 -0
- package/README.md +724 -0
- package/android/build.gradle +11 -11
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/CapgoCapacitorDataStorageSqlite.java +290 -320
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/CapgoCapacitorDataStorageSqlitePlugin.java +373 -388
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/RetHandler.java +97 -97
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/Data.java +3 -3
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/Global.java +2 -2
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonStore.java +108 -110
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonTable.java +78 -80
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/ImportExportJson/JsonValue.java +62 -64
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/StorageDatabaseHelper.java +557 -624
- package/android/src/main/java/com/jeep/plugin/capacitor/capgocapacitordatastoragesqlite/cdssUtils/UtilsSQLCipher.java +103 -144
- package/dist/docs.json +0 -64
- package/dist/esm/definitions.d.ts +0 -19
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +5 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/web-utils/StorageDatabaseHelper.d.ts +2 -2
- package/dist/esm/web-utils/StorageDatabaseHelper.js +8 -8
- package/dist/esm/web-utils/StorageDatabaseHelper.js.map +1 -1
- package/dist/esm/web-utils/json-utils.js +15 -18
- package/dist/esm/web-utils/json-utils.js.map +1 -1
- package/dist/esm/web.d.ts +2 -3
- package/dist/esm/web.js +37 -44
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +56 -67
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +56 -67
- package/dist/plugin.js.map +1 -1
- package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/CapgoCapacitorDataStorageSqlitePlugin.swift +27 -10
- package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/StorageDatabaseHelper.swift +1 -1
- package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsFile.swift +1 -1
- package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsSQLCipher.swift +3 -3
- package/ios/Tests/CapgoCapacitorDataStorageSqlitePluginTests/CapacitorDataStorageSqlitePluginTests.swift +13 -0
- package/package.json +34 -38
- package/electron/dist/plugin.js +0 -1044
- package/electron/dist/plugin.js.map +0 -1
- package/ios/Plugin/CapgoCapacitorDataStorageSqlitePlugin.h +0 -10
- package/ios/Plugin/CapgoCapacitorDataStorageSqlitePlugin.m +0 -29
- package/ios/Plugin/Info.plist +0 -24
- package/readme.md +0 -210
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/CapgoCapacitorDataStorageSqlite.swift +0 -0
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Data.swift +0 -0
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Global.swift +0 -0
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/ImportExportJson/JsonStore.swift +0 -0
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/ReturnHandler.swift +0 -0
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/Blob.swift +0 -0
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsBinding.swift +0 -0
- /package/ios/{Plugin → Sources/CapgoCapacitorDataStorageSqlitePlugin}/Utils/UtilsEncryption.swift +0 -0
|
@@ -11,437 +11,422 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
11
11
|
@CapacitorPlugin(name = "CapgoCapacitorDataStorageSqlite")
|
|
12
12
|
public class CapgoCapacitorDataStorageSqlitePlugin extends Plugin {
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
private CapgoCapacitorDataStorageSqlite implementation;
|
|
15
|
+
private RetHandler rHandler = new RetHandler();
|
|
16
|
+
private Context context;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@PluginMethod
|
|
28
|
-
public void echo(PluginCall call) {
|
|
29
|
-
String value = call.getString("value");
|
|
30
|
-
|
|
31
|
-
JSObject ret = new JSObject();
|
|
32
|
-
ret.put("value", implementation.echo(value));
|
|
33
|
-
call.resolve(ret);
|
|
34
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* Load Method
|
|
20
|
+
* Load the context
|
|
21
|
+
*/
|
|
22
|
+
public void load() {
|
|
23
|
+
context = getContext();
|
|
24
|
+
implementation = new CapgoCapacitorDataStorageSqlite(context);
|
|
25
|
+
}
|
|
35
26
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
@PluginMethod
|
|
28
|
+
public void openStore(PluginCall call) {
|
|
29
|
+
String dbName = call.getString("database", "storage");
|
|
30
|
+
String tableName = call.getString("table", "storage_table");
|
|
31
|
+
Boolean encrypted = call.getBoolean("encrypted", false);
|
|
32
|
+
String secret = null;
|
|
33
|
+
String newsecret = null;
|
|
34
|
+
String inMode = null;
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
if (encrypted) {
|
|
37
|
+
inMode = call.getString("mode", "no-encryption");
|
|
38
|
+
if (
|
|
39
|
+
!inMode.equals("no-encryption") &&
|
|
40
|
+
!inMode.equals("encryption") &&
|
|
41
|
+
!inMode.equals("secret") &&
|
|
42
|
+
!inMode.equals("newsecret") &&
|
|
43
|
+
!inMode.equals("wrongsecret")
|
|
44
|
+
) {
|
|
45
|
+
String msg = "OpenStore: Error inMode must be in ['encryption','secret'," + "'newsecret']";
|
|
46
|
+
rHandler.retResult(call, null, msg);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
inMode = "no-encryption";
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
implementation.openStore(dbName, tableName, encrypted, inMode, 1);
|
|
54
|
+
rHandler.retResult(call, null, null);
|
|
55
|
+
return;
|
|
56
|
+
} catch (Exception e) {
|
|
57
|
+
String msg = "OpenStore: " + e.getMessage();
|
|
58
|
+
rHandler.retResult(call, null, msg);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
62
61
|
}
|
|
63
|
-
try {
|
|
64
|
-
implementation.openStore(dbName, tableName, encrypted, inMode, 1);
|
|
65
|
-
rHandler.retResult(call, null, null);
|
|
66
|
-
return;
|
|
67
|
-
} catch (Exception e) {
|
|
68
|
-
String msg = "OpenStore: " + e.getMessage();
|
|
69
|
-
rHandler.retResult(call, null, msg);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
62
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
@PluginMethod
|
|
64
|
+
public void closeStore(PluginCall call) {
|
|
65
|
+
if (!call.getData().has("database")) {
|
|
66
|
+
rHandler.retResult(call, false, "closeStore: Must provide a database");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
String dbName = call.getString("database");
|
|
70
|
+
try {
|
|
71
|
+
implementation.closeStore(dbName);
|
|
72
|
+
rHandler.retResult(call, null, null);
|
|
73
|
+
return;
|
|
74
|
+
} catch (Exception e) {
|
|
75
|
+
String msg = "Close: " + e.getMessage();
|
|
76
|
+
rHandler.retResult(call, null, msg);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
89
79
|
}
|
|
90
|
-
}
|
|
91
80
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
@PluginMethod
|
|
82
|
+
public void isStoreOpen(PluginCall call) {
|
|
83
|
+
boolean ret = false;
|
|
84
|
+
if (!call.getData().has("database")) {
|
|
85
|
+
rHandler.retResult(call, false, "IsStoreOpen: Must provide a database");
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
String dbName = call.getString("database");
|
|
89
|
+
try {
|
|
90
|
+
ret = implementation.isStoreOpen(dbName);
|
|
91
|
+
rHandler.retResult(call, ret, null);
|
|
92
|
+
return;
|
|
93
|
+
} catch (Exception e) {
|
|
94
|
+
String msg = "IsStoreOpen: " + e.getMessage();
|
|
95
|
+
rHandler.retResult(call, false, msg);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
98
|
}
|
|
99
|
-
String dbName = call.getString("database");
|
|
100
|
-
try {
|
|
101
|
-
ret = implementation.isStoreOpen(dbName);
|
|
102
|
-
rHandler.retResult(call, ret, null);
|
|
103
|
-
return;
|
|
104
|
-
} catch (Exception e) {
|
|
105
|
-
String msg = "IsStoreOpen: " + e.getMessage();
|
|
106
|
-
rHandler.retResult(call, false, msg);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
99
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
100
|
+
@PluginMethod
|
|
101
|
+
public void isStoreExists(PluginCall call) {
|
|
102
|
+
boolean ret = false;
|
|
103
|
+
if (!call.getData().has("database")) {
|
|
104
|
+
rHandler.retResult(call, false, "IsStoreExists: Must provide a database");
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
String dbName = call.getString("database");
|
|
108
|
+
try {
|
|
109
|
+
ret = implementation.isStoreExists(dbName);
|
|
110
|
+
rHandler.retResult(call, ret, null);
|
|
111
|
+
return;
|
|
112
|
+
} catch (Exception e) {
|
|
113
|
+
String msg = "IsStoreExists: " + e.getMessage();
|
|
114
|
+
rHandler.retResult(call, false, msg);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
127
117
|
}
|
|
128
|
-
}
|
|
129
118
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
119
|
+
@PluginMethod
|
|
120
|
+
public void set(PluginCall call) {
|
|
121
|
+
if (!call.getData().has("key")) {
|
|
122
|
+
rHandler.retResult(call, null, "Set: Must provide a key");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
String key = call.getString("key");
|
|
126
|
+
if (!call.getData().has("value")) {
|
|
127
|
+
rHandler.retResult(call, null, "Set: Must provide a value");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
String value = call.getString("value");
|
|
131
|
+
try {
|
|
132
|
+
implementation.set(key, value);
|
|
133
|
+
rHandler.retResult(call, null, null);
|
|
134
|
+
return;
|
|
135
|
+
} catch (Exception e) {
|
|
136
|
+
String msg = "Set: " + e.getMessage();
|
|
137
|
+
rHandler.retResult(call, null, msg);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
140
|
}
|
|
141
|
-
String value = call.getString("value");
|
|
142
|
-
try {
|
|
143
|
-
implementation.set(key, value);
|
|
144
|
-
rHandler.retResult(call, null, null);
|
|
145
|
-
return;
|
|
146
|
-
} catch (Exception e) {
|
|
147
|
-
String msg = "Set: " + e.getMessage();
|
|
148
|
-
rHandler.retResult(call, null, msg);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
141
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
142
|
+
@PluginMethod
|
|
143
|
+
public void get(PluginCall call) {
|
|
144
|
+
if (!call.getData().has("key")) {
|
|
145
|
+
rHandler.retValue(call, null, "Get: Must provide a key");
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
String key = call.getString("key");
|
|
149
|
+
try {
|
|
150
|
+
String value = implementation.get(key);
|
|
151
|
+
rHandler.retValue(call, value, null);
|
|
152
|
+
return;
|
|
153
|
+
} catch (Exception e) {
|
|
154
|
+
String msg = "Get: " + e.getMessage();
|
|
155
|
+
rHandler.retValue(call, null, msg);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
168
158
|
}
|
|
169
|
-
}
|
|
170
159
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
160
|
+
@PluginMethod
|
|
161
|
+
public void remove(PluginCall call) {
|
|
162
|
+
if (!call.getData().has("key")) {
|
|
163
|
+
rHandler.retResult(call, null, "Remove: Must provide a key");
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
String key = call.getString("key");
|
|
167
|
+
try {
|
|
168
|
+
implementation.remove(key);
|
|
169
|
+
rHandler.retResult(call, null, null);
|
|
170
|
+
return;
|
|
171
|
+
} catch (Exception e) {
|
|
172
|
+
String msg = "Remove: " + e.getMessage();
|
|
173
|
+
rHandler.retResult(call, null, msg);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
176
|
}
|
|
177
|
-
String key = call.getString("key");
|
|
178
|
-
try {
|
|
179
|
-
implementation.remove(key);
|
|
180
|
-
rHandler.retResult(call, null, null);
|
|
181
|
-
return;
|
|
182
|
-
} catch (Exception e) {
|
|
183
|
-
String msg = "Remove: " + e.getMessage();
|
|
184
|
-
rHandler.retResult(call, null, msg);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
177
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
178
|
+
@PluginMethod
|
|
179
|
+
public void clear(PluginCall call) {
|
|
180
|
+
try {
|
|
181
|
+
implementation.clear();
|
|
182
|
+
rHandler.retResult(call, null, null);
|
|
183
|
+
return;
|
|
184
|
+
} catch (Exception e) {
|
|
185
|
+
String msg = "Clear: " + e.getMessage();
|
|
186
|
+
rHandler.retResult(call, null, msg);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
199
189
|
}
|
|
200
|
-
}
|
|
201
190
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
191
|
+
@PluginMethod
|
|
192
|
+
public void iskey(PluginCall call) {
|
|
193
|
+
boolean ret = false;
|
|
194
|
+
if (!call.getData().has("key")) {
|
|
195
|
+
rHandler.retResult(call, false, "Iskey: Must provide a key");
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
String key = call.getString("key");
|
|
199
|
+
try {
|
|
200
|
+
ret = implementation.iskey(key);
|
|
201
|
+
rHandler.retResult(call, ret, null);
|
|
202
|
+
return;
|
|
203
|
+
} catch (Exception e) {
|
|
204
|
+
String msg = "Iskey: " + e.getMessage();
|
|
205
|
+
rHandler.retResult(call, false, msg);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
218
208
|
}
|
|
219
|
-
}
|
|
220
209
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
210
|
+
@PluginMethod
|
|
211
|
+
public void keys(PluginCall call) {
|
|
212
|
+
try {
|
|
213
|
+
String[] keyArray = implementation.keys();
|
|
214
|
+
JSObject ret = new JSObject();
|
|
215
|
+
ret.put("keys", new JSArray(keyArray));
|
|
216
|
+
rHandler.retJSObject(call, ret, null);
|
|
217
|
+
return;
|
|
218
|
+
} catch (Exception e) {
|
|
219
|
+
String msg = "Keys: " + e.getMessage();
|
|
220
|
+
rHandler.retJSObject(call, new JSObject(), msg);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
233
223
|
}
|
|
234
|
-
}
|
|
235
224
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
225
|
+
@PluginMethod
|
|
226
|
+
public void values(PluginCall call) {
|
|
227
|
+
try {
|
|
228
|
+
String[] valueArray = implementation.values();
|
|
229
|
+
JSObject ret = new JSObject();
|
|
230
|
+
ret.put("values", new JSArray(valueArray));
|
|
231
|
+
rHandler.retJSObject(call, ret, null);
|
|
232
|
+
return;
|
|
233
|
+
} catch (Exception e) {
|
|
234
|
+
String msg = "Values: " + e.getMessage();
|
|
235
|
+
rHandler.retJSObject(call, new JSObject(), msg);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
248
238
|
}
|
|
249
|
-
}
|
|
250
239
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
240
|
+
@PluginMethod
|
|
241
|
+
public void keysvalues(PluginCall call) {
|
|
242
|
+
try {
|
|
243
|
+
JSObject[] jsObjArray = implementation.keysvalues();
|
|
244
|
+
JSObject ret = new JSObject();
|
|
245
|
+
ret.put("keysvalues", new JSArray(jsObjArray));
|
|
246
|
+
rHandler.retJSObject(call, ret, null);
|
|
247
|
+
return;
|
|
248
|
+
} catch (Exception e) {
|
|
249
|
+
String msg = "KeysValues: " + e.getMessage();
|
|
250
|
+
rHandler.retJSObject(call, new JSObject(), msg);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
263
253
|
}
|
|
264
|
-
}
|
|
265
254
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
String msg = "Filtervalues: " + e.getMessage();
|
|
285
|
-
rHandler.retJSObject(call, new JSObject(), msg);
|
|
286
|
-
return;
|
|
255
|
+
@PluginMethod
|
|
256
|
+
public void filtervalues(PluginCall call) {
|
|
257
|
+
if (!call.getData().has("filter")) {
|
|
258
|
+
rHandler.retJSObject(call, new JSObject(), "Filtervalues: Must provide a filter");
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
String filter = call.getString("filter");
|
|
262
|
+
try {
|
|
263
|
+
String[] valueArray = implementation.filtervalues(filter);
|
|
264
|
+
JSObject ret = new JSObject();
|
|
265
|
+
ret.put("values", new JSArray(valueArray));
|
|
266
|
+
rHandler.retJSObject(call, ret, null);
|
|
267
|
+
return;
|
|
268
|
+
} catch (Exception e) {
|
|
269
|
+
String msg = "Filtervalues: " + e.getMessage();
|
|
270
|
+
rHandler.retJSObject(call, new JSObject(), msg);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
287
273
|
}
|
|
288
|
-
}
|
|
289
274
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
275
|
+
@PluginMethod
|
|
276
|
+
public void setTable(PluginCall call) {
|
|
277
|
+
if (!call.getData().has("table")) {
|
|
278
|
+
rHandler.retResult(call, false, "SetTable: Must provide a table");
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
String table = call.getString("table");
|
|
282
|
+
try {
|
|
283
|
+
implementation.setTable(table);
|
|
284
|
+
rHandler.retResult(call, null, null);
|
|
285
|
+
return;
|
|
286
|
+
} catch (Exception e) {
|
|
287
|
+
String msg = "SetTable: " + e.getMessage();
|
|
288
|
+
rHandler.retResult(call, null, msg);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
295
291
|
}
|
|
296
|
-
String table = call.getString("table");
|
|
297
|
-
try {
|
|
298
|
-
implementation.setTable(table);
|
|
299
|
-
rHandler.retResult(call, null, null);
|
|
300
|
-
return;
|
|
301
|
-
} catch (Exception e) {
|
|
302
|
-
String msg = "SetTable: " + e.getMessage();
|
|
303
|
-
rHandler.retResult(call, null, msg);
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
292
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
293
|
+
@PluginMethod
|
|
294
|
+
public void isTable(PluginCall call) {
|
|
295
|
+
boolean ret = false;
|
|
296
|
+
if (!call.getData().has("table")) {
|
|
297
|
+
rHandler.retResult(call, false, "IsTable: Must provide a table");
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
String table = call.getString("table");
|
|
301
|
+
try {
|
|
302
|
+
ret = implementation.isTable(table);
|
|
303
|
+
rHandler.retResult(call, ret, null);
|
|
304
|
+
return;
|
|
305
|
+
} catch (Exception e) {
|
|
306
|
+
String msg = "IsTable: " + e.getMessage();
|
|
307
|
+
rHandler.retResult(call, false, msg);
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
324
310
|
}
|
|
325
|
-
}
|
|
326
311
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
312
|
+
@PluginMethod
|
|
313
|
+
public void tables(PluginCall call) {
|
|
314
|
+
try {
|
|
315
|
+
String[] tableArray = implementation.tables();
|
|
316
|
+
JSObject ret = new JSObject();
|
|
317
|
+
ret.put("tables", new JSArray(tableArray));
|
|
318
|
+
rHandler.retJSObject(call, ret, null);
|
|
319
|
+
return;
|
|
320
|
+
} catch (Exception e) {
|
|
321
|
+
String msg = "Tables: " + e.getMessage();
|
|
322
|
+
rHandler.retJSObject(call, new JSObject(), msg);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
339
325
|
}
|
|
340
|
-
}
|
|
341
326
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
327
|
+
@PluginMethod
|
|
328
|
+
public void deleteTable(PluginCall call) {
|
|
329
|
+
if (!call.getData().has("table")) {
|
|
330
|
+
rHandler.retResult(call, null, "DeleteTable: Must provide a table");
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
String table = call.getString("table");
|
|
334
|
+
try {
|
|
335
|
+
implementation.deleteTable(table);
|
|
336
|
+
rHandler.retResult(call, null, null);
|
|
337
|
+
return;
|
|
338
|
+
} catch (Exception e) {
|
|
339
|
+
String msg = "DeleteTable: " + e.getMessage();
|
|
340
|
+
rHandler.retResult(call, null, msg);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
347
343
|
}
|
|
348
|
-
String table = call.getString("table");
|
|
349
|
-
try {
|
|
350
|
-
implementation.deleteTable(table);
|
|
351
|
-
rHandler.retResult(call, null, null);
|
|
352
|
-
return;
|
|
353
|
-
} catch (Exception e) {
|
|
354
|
-
String msg = "DeleteTable: " + e.getMessage();
|
|
355
|
-
rHandler.retResult(call, null, msg);
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
344
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
345
|
+
@PluginMethod
|
|
346
|
+
public void deleteStore(PluginCall call) {
|
|
347
|
+
if (!call.getData().has("database")) {
|
|
348
|
+
rHandler.retResult(call, null, "DeleteStore: Must provide a database");
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
String dbName = call.getString("database");
|
|
352
|
+
try {
|
|
353
|
+
implementation.deleteStore(dbName);
|
|
354
|
+
rHandler.retResult(call, null, null);
|
|
355
|
+
return;
|
|
356
|
+
} catch (Exception e) {
|
|
357
|
+
String msg = "DeleteStore: " + e.getMessage();
|
|
358
|
+
rHandler.retResult(call, null, msg);
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
375
361
|
}
|
|
376
|
-
}
|
|
377
362
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
363
|
+
/**
|
|
364
|
+
* IsJsonValid
|
|
365
|
+
* Check the validity of a given Json object
|
|
366
|
+
* @param call
|
|
367
|
+
*/
|
|
368
|
+
@PluginMethod
|
|
369
|
+
public void isJsonValid(PluginCall call) {
|
|
370
|
+
if (!call.getData().has("jsonstring")) {
|
|
371
|
+
String msg = "IsJsonValid: Must provide a Stringify Json Object";
|
|
372
|
+
rHandler.retResult(call, false, msg);
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
String parsingData = call.getString("jsonstring");
|
|
376
|
+
try {
|
|
377
|
+
Boolean res = implementation.isJsonValid(parsingData);
|
|
378
|
+
rHandler.retResult(call, res, null);
|
|
379
|
+
return;
|
|
380
|
+
} catch (Exception e) {
|
|
381
|
+
String msg = "isJsonValid: " + e.getMessage();
|
|
382
|
+
rHandler.retResult(call, false, msg);
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
389
385
|
}
|
|
390
|
-
String parsingData = call.getString("jsonstring");
|
|
391
|
-
try {
|
|
392
|
-
Boolean res = implementation.isJsonValid(parsingData);
|
|
393
|
-
rHandler.retResult(call, res, null);
|
|
394
|
-
return;
|
|
395
|
-
} catch (Exception e) {
|
|
396
|
-
String msg = "isJsonValid: " + e.getMessage();
|
|
397
|
-
rHandler.retResult(call, false, msg);
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
386
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
387
|
+
/**
|
|
388
|
+
* ImportFromJson Method
|
|
389
|
+
* Import from a given Json object
|
|
390
|
+
* @param call
|
|
391
|
+
*/
|
|
392
|
+
@PluginMethod
|
|
393
|
+
public void importFromJson(PluginCall call) {
|
|
394
|
+
JSObject retRes = new JSObject();
|
|
395
|
+
retRes.put("changes", Integer.valueOf(-1));
|
|
396
|
+
if (!call.getData().has("jsonstring")) {
|
|
397
|
+
String msg = "ImportFromJson: Must provide a Stringify Json Object";
|
|
398
|
+
rHandler.retChanges(call, retRes, msg);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
String parsingData = call.getString("jsonstring");
|
|
402
|
+
try {
|
|
403
|
+
JSObject res = implementation.importFromJson(parsingData);
|
|
404
|
+
rHandler.retChanges(call, res, null);
|
|
405
|
+
return;
|
|
406
|
+
} catch (Exception e) {
|
|
407
|
+
String msg = "ImportFromJson: " + e.getMessage();
|
|
408
|
+
rHandler.retChanges(call, retRes, msg);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
425
411
|
}
|
|
426
|
-
}
|
|
427
412
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
413
|
+
/**
|
|
414
|
+
* ExportToJson Method
|
|
415
|
+
* Export the database to Json Object
|
|
416
|
+
* @param call
|
|
417
|
+
*/
|
|
418
|
+
@PluginMethod
|
|
419
|
+
public void exportToJson(PluginCall call) {
|
|
420
|
+
JSObject retObj = new JSObject();
|
|
436
421
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
422
|
+
try {
|
|
423
|
+
JSObject res = implementation.exportToJson();
|
|
424
|
+
rHandler.retJsonObject(call, res, null);
|
|
425
|
+
return;
|
|
426
|
+
} catch (Exception e) {
|
|
427
|
+
String msg = "ExportToJson: " + e.getMessage();
|
|
428
|
+
rHandler.retJsonObject(call, retObj, msg);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
445
431
|
}
|
|
446
|
-
}
|
|
447
432
|
}
|