alsmanager_lib 1.0.28 → 1.0.30

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.
Files changed (2) hide show
  1. package/lib/modules.js +1752 -275
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -15,6 +15,21 @@ function getConnectorsByIdDeviceMySQL(id_device) {
15
15
  return query;
16
16
  }
17
17
 
18
+ function getConnectorsByIdDevice(db_used, id_device) {
19
+ var query = "";
20
+ if (db_used) {
21
+ switch (db_used) {
22
+ case 'SQLITE':
23
+ query = getConnectorsByIdDeviceSQLite(id_device);
24
+ break;
25
+ case 'MYSQL':
26
+ query = getConnectorsByIdDeviceMySQL(id_device);
27
+ break;
28
+ }
29
+ }
30
+ return query;
31
+ }
32
+
18
33
  function getConnectorByIdSQLite(id_conn) {
19
34
  var query = "select dc.id, dc.conn_type, dc.conn_protocol, dc.conn_number, dc.conn_verse from device_connectors dc ";
20
35
  query += "where dc.id = " + id_conn;
@@ -26,6 +41,20 @@ function getConnectorByIdMySQL() {
26
41
  query += "where dc.id = :id_conn";
27
42
  return query;
28
43
  }
44
+ function getConnectorById(db_used, id_conn) {
45
+ var query = "";
46
+ if (db_used) {
47
+ switch (db_used) {
48
+ case 'SQLITE':
49
+ query = getConnectorByIdSQLite(id_conn);
50
+ break;
51
+ case 'MYSQL':
52
+ query = getConnectorByIdMySQL();
53
+ break;
54
+ }
55
+ }
56
+ return query;
57
+ }
29
58
 
30
59
 
31
60
  function insertConnectorSQLite(id_device, conn_obj) {
@@ -40,7 +69,20 @@ function insertConnectorMySQL(id_device, conn_obj) {
40
69
  query += "(:id_device, :tipo, :protocollo, :numero, :verso)";
41
70
  return query;
42
71
  }
43
-
72
+ function insertConnector(db_used, id_device, conn_obj) {
73
+ var query = "";
74
+ if (db_used) {
75
+ switch (db_used) {
76
+ case 'SQLITE':
77
+ query = insertConnectorSQLite(id_device, conn_obj);
78
+ break;
79
+ case 'MYSQL':
80
+ query = insertConnectorMySQL(id_device, conn_obj);
81
+ break;
82
+ }
83
+ }
84
+ return query;
85
+ }
44
86
  function updateConnectorSQLite(id_device, conn_obj) {
45
87
  var query = "update device_connectors "
46
88
  query += "set id_device = " + id_device + ", ";
@@ -61,7 +103,20 @@ function updateConnectorMySQL(id_device, conn_obj) {
61
103
  query += "conn_verse = :verso ";
62
104
  query += "where id = :id_conn";
63
105
  }
64
-
106
+ function updateConnector(db_used, id_device, conn_obj) {
107
+ var query = "";
108
+ if (db_used) {
109
+ switch (db_used) {
110
+ case 'SQLITE':
111
+ query = updateConnectorSQLite(id_device, conn_obj);
112
+ break;
113
+ case 'MYSQL':
114
+ query = updateConnectorMySQL(id_device, conn_obj);
115
+ break;
116
+ }
117
+ }
118
+ return query;
119
+ }
65
120
 
66
121
  function removeConnectorSQLite(id_device, conn_obj) {
67
122
  var query = "delete from device_connectors ";
@@ -74,7 +129,20 @@ function removeConnectorMySQL() {
74
129
  query += "where id = :id_conn";
75
130
  return query;
76
131
  }
77
-
132
+ function removeConnector(db_used, id_device, conn_obj) {
133
+ var query = "";
134
+ if (db_used) {
135
+ switch (db_used) {
136
+ case 'SQLITE':
137
+ query = removeConnectorSQLite(id_device, conn_obj);
138
+ break;
139
+ case 'MYSQL':
140
+ query = removeConnectorMySQL();
141
+ break;
142
+ }
143
+ }
144
+ return query;
145
+ }
78
146
  //End Manage connectors
79
147
  // Manage Storage
80
148
  function getStorageByIdDeviceSQLite(id_device) {
@@ -90,6 +158,20 @@ function getStorageByIdDeviceMySQL(id_device) {
90
158
  query += "where id_device = :id_device";
91
159
  return query;
92
160
  }
161
+ function getStorageByIdDevice(db_used, id_device) {
162
+ var query = "";
163
+ if (db_used) {
164
+ switch (db_used) {
165
+ case 'SQLITE':
166
+ query = getStorageByIdDeviceSQLite(id_device);
167
+ break;
168
+ case 'MYSQL':
169
+ query = getStorageByIdDeviceMySQL(id_device);
170
+ break;
171
+ }
172
+ }
173
+ return query;
174
+ }
93
175
 
94
176
  function getStorageByIdSQLite(id_storage) {
95
177
  var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available from device_storages ";
@@ -103,6 +185,21 @@ function getStorageByIdMySQL() {
103
185
  return query;
104
186
  }
105
187
 
188
+ function getStorageById(db_user, id_storage) {
189
+ var query = "";
190
+ if (db_used) {
191
+ switch (db_used) {
192
+ case 'SQLITE':
193
+ query = getStorageByIdSQLite(id_storage);
194
+ break;
195
+ case 'MYSQL':
196
+ query = getStorageByIdMySQL();
197
+ break;
198
+ }
199
+ }
200
+ return query;
201
+ }
202
+
106
203
  function insertStorageSQLite(id_device, storage_obj) {
107
204
  var query = "insert into device_storages (id_device, storage_type, storage_size_unit, storage_totsize, storage_available) values ";
108
205
  query += "(" + id_device + ", " + storage_obj.tipo + ", '" + storage_obj.unita + "'," + storage_obj.dimensione + ", " + storage_obj.dim_disponibile + ")";
@@ -115,6 +212,21 @@ function insertStorageMySQL(id_device, storage_obj) {
115
212
  return query;
116
213
  }
117
214
 
215
+ function insertStorage(db_used, id_device, storage_obj) {
216
+ var query = "";
217
+ if (db_used) {
218
+ switch (db_used) {
219
+ case 'SQLITE':
220
+ query = insertStorageSQLite(id_device, storage_obj);
221
+ break;
222
+ case 'MYSQL':
223
+ query = insertStorageMySQL(id_device, storage_obj);
224
+ break;
225
+ }
226
+ }
227
+ return query;
228
+ }
229
+
118
230
  function updateStorageSQLite(id_device, storage_obj) {
119
231
  var query = "update device_storages "
120
232
  query += "set id_device = " + id_device + ", ";
@@ -137,6 +249,20 @@ function updateStorageMySQL(id_device, storage_obj) {
137
249
  return query;
138
250
  }
139
251
 
252
+ function updateStorage(db_used, id_device, storage_obj) {
253
+ var query = "";
254
+ if (db_used) {
255
+ switch (db_used) {
256
+ case 'SQLITE':
257
+ query = updateStorageSQLite(id_device, storage_obj);
258
+ break;
259
+ case 'MYSQL':
260
+ query = updateStorageMySQL(id_device, storage_obj);
261
+ break;
262
+ }
263
+ }
264
+ return query;
265
+ }
140
266
  function removeStorageSQLite(id_device, storage_obj) {
141
267
  var query = "delete from device_storages ";
142
268
  query += "where id = " + storage_obj.id;
@@ -148,6 +274,21 @@ function removeStorageMySQL(id_device, storage_obj) {
148
274
  query += "where id = id_storage";
149
275
  return query;
150
276
  }
277
+ function removeStorage(db_used, id_device, storage_obj) {
278
+ var query = "";
279
+ var db_used = global.get("db_used");
280
+ if (db_used) {
281
+ switch (db_used) {
282
+ case 'SQLITE':
283
+ query = removeStorageSQLite(id_device, storage_obj);
284
+ break;
285
+ case 'MYSQL':
286
+ query = removeStorageMySQL(id_device, storage_obj);
287
+ break;
288
+ }
289
+ }
290
+ return query;
291
+ }
151
292
 
152
293
  //End Manage Storage
153
294
  // Manage Network
@@ -161,6 +302,21 @@ function getNetworkByIdDeviceMySQL(id_device) {
161
302
  query += "where dn.id_device = :id_device";
162
303
  return query;
163
304
  }
305
+ function getNetworkByIdDevice(db_used, id_device) {
306
+ var query = "";
307
+ if (db_used) {
308
+ switch (db_used) {
309
+ case 'SQLITE':
310
+ query = getNetworkByIdDeviceSQLite(id_device);
311
+ break;
312
+ case 'MYSQL':
313
+ query = getNetworkByIdDeviceMySQL(id_device);
314
+ break;
315
+ }
316
+ }
317
+ return query;
318
+ }
319
+
164
320
  function getNetworkByIdSQLite(id_network) {
165
321
  var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
166
322
  query += "where id = " + id_network;
@@ -171,7 +327,20 @@ function getNetworkByIdMySQL() {
171
327
  query += "where id = :id_network";
172
328
  return query;
173
329
  }
174
-
330
+ function getNetworkById(db_used, id_network) {
331
+ var query = "";
332
+ if (db_used) {
333
+ switch (db_used) {
334
+ case 'SQLITE':
335
+ query = getNetworkByIdSQLite(id_network);
336
+ break;
337
+ case 'MYSQL':
338
+ query = getNetworkByIdMySQL();
339
+ break;
340
+ }
341
+ }
342
+ return query;
343
+ }
175
344
  function insertNetworkSQLite(id_device, network_obj) {
176
345
  var query = "insert into device_networks (id_device, net_type, mac_address, ipv4_static, ipv6_static) values ";
177
346
  query += "(" + id_device + ", '" + network_obj.tipo + "', '" + network_obj.mac_address + "', '" + network_obj.ipv4_static + "', '" + network_obj.ipv6_static + "')";
@@ -182,6 +351,20 @@ function insertNetworkMySQL(id_device, network_obj) {
182
351
  query += "(:id_device, :tipo, :mac_address, :ipv4_static, :ipv6_static)";
183
352
  return query;
184
353
  }
354
+ function insertNetwork(db_used, id_device, network_obj) {
355
+ var query = "";
356
+ if (db_used) {
357
+ switch (db_used) {
358
+ case 'SQLITE':
359
+ query = insertNetworkSQLite(id_device, network_obj);
360
+ break;
361
+ case 'MYSQL':
362
+ query = insertNetworkMySQL(id_device, network_obj);
363
+ break;
364
+ }
365
+ }
366
+ return query;
367
+ }
185
368
  function updateNetworkSQLite(id_device, network_obj) {
186
369
  var query = "update device_networks "
187
370
  query += "set id_device = " + id_device + ", ";
@@ -202,6 +385,20 @@ function updateNetworkMySQL(id_device, network_obj) {
202
385
  query += "where id = :id_network";
203
386
  return query;
204
387
  }
388
+ function updateNetwork(db_used, d_device, network_obj) {
389
+ var query = "";
390
+ if (db_used) {
391
+ switch (db_used) {
392
+ case 'SQLITE':
393
+ query = updateNetworkSQLite(id_device, network_obj);
394
+ break;
395
+ case 'MYSQL':
396
+ query = updateNetworkMySQL(id_device, network_obj);
397
+ break;
398
+ }
399
+ }
400
+ return query;
401
+ }
205
402
  function removeNetworkSQLite(id_device, network_obj) {
206
403
  var query = "delete from device_networks ";
207
404
  query += "where id = " + network_obj.id;
@@ -212,6 +409,20 @@ function removeNetworkMySQL(id_device, network_obj) {
212
409
  query += "where id = :id_network";
213
410
  return query;
214
411
  }
412
+ function removeNetwork(db_used, id_device, network_obj) {
413
+ var query = "";
414
+ if (db_used) {
415
+ switch (db_used) {
416
+ case 'SQLITE':
417
+ query = removeNetworkSQLite(id_device, network_obj);
418
+ break;
419
+ case 'MYSQL':
420
+ query = removeNetworkMySQL(id_device, network_obj);
421
+ break;
422
+ }
423
+ }
424
+ return query;
425
+ }
215
426
  //End Manage Network
216
427
  // Manage AddOns
217
428
  function getAddOnByIdDeviceSQLite(id_device) {
@@ -226,6 +437,20 @@ function getAddOnByIdDeviceMySQL(id_device) {
226
437
  query += "where da.id_device = :id_device";
227
438
  return query;
228
439
  }
440
+ function getAddOnByIdDevice(db_used, id_device) {
441
+ var query = "";
442
+ if (db_used) {
443
+ switch (db_used) {
444
+ case 'SQLITE':
445
+ query = getAddOnByIdDeviceSQLite(id_device);
446
+ break;
447
+ case 'MYSQL':
448
+ query = getAddOnByIdDeviceMySQL(id_device);
449
+ break;
450
+ }
451
+ }
452
+ return query;
453
+ }
229
454
  function getAddOnByIdSQLite(id_addon) {
230
455
  var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
231
456
  query += "where id = " + id_addon;
@@ -236,6 +461,20 @@ function getAddOnByIdMySQL() {
236
461
  query += "where id = :id_addon";
237
462
  return query;
238
463
  }
464
+ function getAddOnById(id_addon) {
465
+ var query = "";
466
+ if (db_used) {
467
+ switch (db_used) {
468
+ case 'SQLITE':
469
+ query = getAddOnByIdSQLite(id_addon);
470
+ break;
471
+ case 'MYSQL':
472
+ query = getAddOnByIdMySQL();
473
+ break;
474
+ }
475
+ }
476
+ return query;
477
+ }
239
478
  function insertAddOnSQLite(id_device, addon_obj) {
240
479
  var query = "insert into device_addons (id_device, addon_type, maker, model, description) values ";
241
480
  query += "(" + id_device + ", " + addon_obj.addon_type + ", '" + addon_obj.maker + "', '" + addon_obj.model + "', '" + addon_obj.description + "')";
@@ -246,7 +485,20 @@ function insertAddOnMySQL(id_device, addon_obj) {
246
485
  query += "(:id_device, :addon_type, :maker, :model, :description) ";
247
486
  return query;
248
487
  }
249
-
488
+ function insertAddOn(db_used, id_device, addon_obj) {
489
+ var query = "";
490
+ if (db_used) {
491
+ switch (db_used) {
492
+ case 'SQLITE':
493
+ query = insertAddOnSQLite(id_device, addon_obj);
494
+ break;
495
+ case 'MYSQL':
496
+ query = insertAddOnMySQL(id_device, addon_obj);
497
+ break;
498
+ }
499
+ }
500
+ return query;
501
+ }
250
502
  function updateAddOnSQLite(id_device, addon_obj) {
251
503
  var query = "update device_addons "
252
504
  query += "set id_device = " + id_device + ", ";
@@ -267,7 +519,20 @@ function updateAddOnMySQL(id_device, addon_obj) {
267
519
  query += "where id = :id_addon";
268
520
  return query;
269
521
  }
270
-
522
+ function updateAddOn(db_used, id_device, addon_obj) {
523
+ var query = "";
524
+ if (db_used) {
525
+ switch (db_used) {
526
+ case 'SQLITE':
527
+ query = updateAddOnSQLite(id_device, addon_obj);
528
+ break;
529
+ case 'MYSQL':
530
+ query = updateAddOnMySQL(id_device, addon_obj);
531
+ break;
532
+ }
533
+ }
534
+ return query;
535
+ }
271
536
  function removeAddOnSQLite(id_device, addon_obj) {
272
537
  var query = "delete from device_addons ";
273
538
  query += "where id = " + addon_obj.id;
@@ -276,6 +541,21 @@ function removeAddOnMySQL(id_device, addon_obj) {
276
541
  var query = "delete from device_addons ";
277
542
  query += "where id = id_addon";
278
543
  }
544
+
545
+ function removeAddOn(db_used, id_device, addon_obj) {
546
+ var query = "";
547
+ if (db_used) {
548
+ switch (db_used) {
549
+ case 'SQLITE':
550
+ query = removeAddOnSQLite(id_device, addon_obj);
551
+ break;
552
+ case 'MYSQL':
553
+ query = removeAddOnMySQL(id_device, addon_obj);
554
+ break;
555
+ }
556
+ }
557
+ return query;
558
+ }
279
559
  //End Manage AddOns
280
560
  //Manage PC Properties
281
561
  function existsPCPropertiesSQLite(id_device) {
@@ -289,7 +569,20 @@ function existsPCPropertiesMySQL(id_device) {
289
569
  query += "where id_device = :id_device";
290
570
  return query;
291
571
  }
292
-
572
+ function existsPCProperties(db_used, id_device) {
573
+ var query = "";
574
+ if (db_used) {
575
+ switch (db_used) {
576
+ case 'SQLITE':
577
+ query = existsPCPropertiesSQLite(id_device);
578
+ break;
579
+ case 'MYSQL':
580
+ query = existsPCPropertiesMySQL(id_device);
581
+ break;
582
+ }
583
+ }
584
+ return query;
585
+ }
293
586
  function getPCPropertiesSQLite(id_device) {
294
587
  var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
295
588
  query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
@@ -309,7 +602,22 @@ function getPCPropertiesMySQL(id_device) {
309
602
  query += "from devices d ";
310
603
  query += "left join device_pc dp on d.id = dp.id_device ";
311
604
  query += "where d.id = :id_device";
605
+ return query;
606
+ }
312
607
 
608
+ function getPCProperties(db_used, id_device) {
609
+ var query = "";
610
+ if (db_used) {
611
+ switch (db_used) {
612
+ case 'SQLITE':
613
+ query = getPCPropertiesSQLite(id_device);
614
+ break;
615
+ case 'MYSQL':
616
+ query = getPCPropertiesSQLite(id_device);
617
+ break;
618
+ }
619
+ }
620
+ return query;
313
621
  }
314
622
  function createPCPropertiesMySQLObj(id_device, dev_prop) {
315
623
  var obj = {};
@@ -338,6 +646,21 @@ function insertPCPropertiesMySQL() {
338
646
  var query = "insert into device_pc (id_device, pc_name, OS, OS_version, OS_arch, CPU, CPU_arch, RAM_GB, video_card, smartboard_ready, note, da_properties) values ";
339
647
  query += "(:id_device, :pc_name, :os, :os_version, :os_arch, :cpu, :cpu_arch, :ram_size, :video_card, :smartboard_ready, :note, :da_properties)";
340
648
  }
649
+ function insertPCProperties(db_used, id_device, dev_prop) {
650
+ var query = "";
651
+ if (db_used) {
652
+ switch (db_used) {
653
+ case 'SQLITE':
654
+ query = insertPCPropertiesSQLite(id_device, dev_prop);
655
+ break;
656
+ case 'MYSQL':
657
+ query = insertPCPropertiesMySQL();
658
+ break;
659
+ }
660
+ }
661
+ return query;
662
+ }
663
+
341
664
  function updatePCPropertiesSQLite(id_device, dev_prop) {
342
665
  var query = "update device_pc set ";
343
666
  query += "id_device = " + id_device + ", ";
@@ -359,7 +682,20 @@ function updatePCPropertiesSQLite(id_device, dev_prop) {
359
682
  function updatePCPropertiesMySQL() {
360
683
 
361
684
  }
362
-
685
+ function updatePCProperties(db_used, id_device, dev_prop) {
686
+ var query = "";
687
+ if (db_used) {
688
+ switch (db_used) {
689
+ case 'SQLITE':
690
+ query = updatePCPropertiesSQLite(id_device, dev_prop);
691
+ break;
692
+ case 'MYSQL':
693
+ query = updatePCPropertiesMySQL();
694
+ break;
695
+ }
696
+ }
697
+ return query;
698
+ }
363
699
  //End Manage PC Properties
364
700
  // Manage Display Part Properties
365
701
  function getDisplayPartPropertiesSQLite(id_device) {
@@ -379,6 +715,21 @@ function getDisplayPartPropertiesMySQL(id_device) {
379
715
  return query;
380
716
  }
381
717
 
718
+ function getDisplayPartProperties(db_used, id_device) {
719
+ var query = "";
720
+ if (db_used) {
721
+ switch (db_used) {
722
+ case 'SQLITE':
723
+ query = getDisplayPartPropertiesSQLite(id_device);
724
+ break;
725
+ case 'MYSQL':
726
+ query = getDisplayPartPropertiesMySQL(id_device);
727
+ break;
728
+ }
729
+ }
730
+ return query;
731
+ }
732
+
382
733
  function existsDisplayPartPropertiesSQLite(id_device) {
383
734
  var query = "select count(*) from display_part ";
384
735
  query += "where id_device = " + id_device;
@@ -387,6 +738,21 @@ function existsDisplayPartPropertiesMySQL(id_device) {
387
738
  var query = "select count(*) from display_part ";
388
739
  query += "where id_device = :id_device";
389
740
  }
741
+ function existsDisplayPartProperties(db_used, id_device) {
742
+ var query = "";
743
+ if (db_used) {
744
+ switch (db_used) {
745
+ case 'SQLITE':
746
+ query = existsDisplayPartPropertiesSQLite(id_device);
747
+ break;
748
+ case 'MYSQL':
749
+ query = existsDisplayPartPropertiesMySQL(id_device);
750
+ break;
751
+ }
752
+ }
753
+ return query;
754
+ }
755
+
390
756
  function insertDisplayPartPropertiesSQLite(id_device, dev_prop) {
391
757
  var query = "insert into display_part (id_device, touch, size_inch, format, tecnology, is_removable) values ";
392
758
  query += "(" + id_device + ", " + dev_prop.touch + ", " + dev_prop.size + ", '" + dev_prop.format + "', '" + dev_prop.technology + "', " + dev_prop.is_removable + ")";
@@ -396,6 +762,21 @@ function insertDisplayPartPropertiesMySQL() {
396
762
  var query = "insert into display_part (id_device, touch, size_inch, format, tecnology, is_removable) values ";
397
763
  query += "(:id_device, :touch, :size, :format, :technology, :is_removable)";
398
764
  }
765
+ function insertDisplayPartProperties(db_used, id_device, dev_prop) {
766
+ var query = "";
767
+ if (db_used) {
768
+ switch (db_used) {
769
+ case 'SQLITE':
770
+ query = insertDisplayPartPropertiesSQLite(id_device, dev_prop);
771
+ break;
772
+ case 'MYSQL':
773
+ query = insertDisplayPartPropertiesMySQL();
774
+ break;
775
+ }
776
+ }
777
+ return query;
778
+ }
779
+
399
780
  function updateDisplayPartPropertiesSQLite(id_device, dev_prop) {
400
781
  var query = "update display_part set ";
401
782
  query += "id_device = " + id_device + ", ";
@@ -415,6 +796,22 @@ function updateDisplayPartPropertiesMySQL() {
415
796
  query += "format = :format, ";
416
797
  query += "technology = :tecnology ";
417
798
  query += "where id_device = :id_device";
799
+ return query;
800
+ }
801
+
802
+ function updateDisplayPartProperties(db_used, id_device, dev_prop) {
803
+ var query = "";
804
+ if (db_used) {
805
+ switch (db_used) {
806
+ case 'SQLITE':
807
+ query = updateDisplayPartPropertiesSQLite(id_device, dev_prop);
808
+ break;
809
+ case 'MYSQL':
810
+ query = updateDisplayPartPropertiesMySQL();
811
+ break;
812
+ }
813
+ }
814
+ return query;
418
815
  }
419
816
  // End Manage Display Part Properties
420
817
  // Manage Display Properties
@@ -429,6 +826,21 @@ function existsDisplayPropertiesMySQL(id_device) {
429
826
  query += "where id_device = :id_device";
430
827
  return query;
431
828
  }
829
+ function existsDisplayProperties(db_used, id_device) {
830
+ var query = "";
831
+ if (db_used) {
832
+ switch (db_used) {
833
+ case 'SQLITE':
834
+ query = existsDisplayPropertiesSQLite(id_device);
835
+ break;
836
+ case 'MYSQL':
837
+ query = existsDisplayPropertiesMySQL(id_device);
838
+ break;
839
+ }
840
+ }
841
+ return query;
842
+ }
843
+
432
844
  function getDisplayPropertiesSQLite(id_device) {
433
845
  var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
434
846
  query += "dm.size_inch as Dimensione, dm.format as Formato, dm.technology as Tecnologia, dm.touch as Touch ";
@@ -445,7 +857,20 @@ function getDisplayPropertiesMySQL(id_device) {
445
857
  query += "where d.id = :id_device";
446
858
  return query;
447
859
  }
448
-
860
+ function getDisplayProperties(db_used, id_device) {
861
+ var query = "";
862
+ if (db_used) {
863
+ switch (db_used) {
864
+ case 'SQLITE':
865
+ query = getDisplayPropertiesSQLite(id_device);
866
+ break;
867
+ case 'MYSQL':
868
+ query = getDisplayPropertiesMySQL(id_device);
869
+ break;
870
+ }
871
+ }
872
+ return query;
873
+ }
449
874
  function createDisplayPropertiesMySQLObj(id_device, dev_prop) {
450
875
  var obj = {};
451
876
  obj.id_device = id_device;
@@ -467,6 +892,21 @@ function insertDisplayPropertiesMySQL() {
467
892
  query += "(:id_device, :touch, :size, :format, :technology)";
468
893
  return query;
469
894
  }
895
+ function insertDisplayProperties(db_used, id_device, dev_prop) {
896
+ var query = "";
897
+ if (db_used) {
898
+ switch (db_used) {
899
+ case 'SQLITE':
900
+ query = insertDisplayPropertiesSQLite(id_device, dev_prop);
901
+ break;
902
+ case 'MYSQL':
903
+ query = insertDisplayPropertiesMySQL();
904
+ break;
905
+ }
906
+ }
907
+ return query;
908
+ }
909
+
470
910
  function updateDisplayPropertiesSQLite(id_device, dev_prop) {
471
911
  var query = "update device_monitor set ";
472
912
  query += "id_device = " + id_device + ", ";
@@ -487,6 +927,21 @@ function updateDisplayPropertiesMySQL() {
487
927
  query += "technology = :tecnology ";
488
928
  query += "where id_device = :id_device";
489
929
  }
930
+
931
+ function updateDisplayProperties(db_used, id_device, dev_prop) {
932
+ var query = "";
933
+ if (db_used) {
934
+ switch (db_used) {
935
+ case 'SQLITE':
936
+ query = updateDisplayPropertiesSQLite(id_device, dev_prop);
937
+ break;
938
+ case 'MYSQL':
939
+ query = updateDisplayPropertiesMySQL();
940
+ break;
941
+ }
942
+ }
943
+ return query;
944
+ }
490
945
  // End Manage Display Properties
491
946
 
492
947
 
@@ -624,7 +1079,20 @@ function getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR,
624
1079
  query += " order by id";
625
1080
  return query;
626
1081
  }
627
-
1082
+ function getDevicesSelect(db_used, search_type, inv_code, dev_type, marca, is_PNRR, dev_status, id_dev_exclude) {
1083
+ var query = "";
1084
+ if (db_used) {
1085
+ switch (db_used) {
1086
+ case 'SQLITE':
1087
+ query = getDevicesSelectSQLite(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, id_dev_exclude);
1088
+ break;
1089
+ case 'MYSQL':
1090
+ query = getDevicesSelectMySQL(search_type, inv_code, dev_type, marca, is_PNRR, dev_status, id_dev_exclude);
1091
+ break;
1092
+ }
1093
+ }
1094
+ return query;
1095
+ }
628
1096
  // End Device select
629
1097
  // Device Select by site
630
1098
  function getDevicesSelectBySiteSQLite(id_site) {
@@ -672,7 +1140,20 @@ function getDevicesSelectBySiteMySQL(id_site) {
672
1140
  query += "and sites.id = :id_site";
673
1141
  return query;
674
1142
  }
675
-
1143
+ function getDevicesSelectBySite(db_used, id_site) {
1144
+ var query = "";
1145
+ if (db_used) {
1146
+ switch (db_used) {
1147
+ case 'SQLITE':
1148
+ query = getDevicesSelectBySiteSQLite(id_site);
1149
+ break;
1150
+ case 'MYSQL':
1151
+ query = getDevicesSelectBySiteMySQL(id_site);
1152
+ break;
1153
+ }
1154
+ }
1155
+ return query;
1156
+ }
676
1157
  //End Device Select by site
677
1158
  // Device per plesso
678
1159
  function getDevicesSelectByPlaceSQLite(id_place) {
@@ -720,6 +1201,20 @@ function getDevicesSelectByPlaceMySQL(id_place) {
720
1201
  query += "and sites.id_place = :id_place";
721
1202
  return query;
722
1203
  }
1204
+ function getDevicesSelectByPlace(db_used, id_place) {
1205
+ var query = "";
1206
+ if (db_used) {
1207
+ switch (db_used) {
1208
+ case 'SQLITE':
1209
+ query = getDevicesSelectByPlaceSQLite(id_place);
1210
+ break;
1211
+ case 'MYSQL':
1212
+ query = getDevicesSelectByPlaceMySQL(id_place);
1213
+ break;
1214
+ }
1215
+ }
1216
+ return query;
1217
+ }
723
1218
 
724
1219
 
725
1220
  // End device per plesso
@@ -744,6 +1239,21 @@ function getDevicesCounterBySiteMySQL(id_site) {
744
1239
  return query;
745
1240
  }
746
1241
 
1242
+ function getDevicesCounterBySite(db_used, id_site) {
1243
+ var query = "";
1244
+ if (db_used) {
1245
+ switch (db_used) {
1246
+ case 'SQLITE':
1247
+ query = getDevicesCounterBySiteSQLite(id_site);
1248
+ break;
1249
+ case 'MYSQL':
1250
+ query = getDevicesCounterBySiteMySQL(id_site);
1251
+ break;
1252
+ }
1253
+ }
1254
+ return query;
1255
+ }
1256
+
747
1257
  //End Count Devices by Site
748
1258
  // Count Devices by Place
749
1259
  function getDevicesCounterByPlaceSQLite(id_place) {
@@ -766,6 +1276,20 @@ function getDevicesCounterByPlaceMySQL(id_place) {
766
1276
  return query;
767
1277
  }
768
1278
 
1279
+ function getDevicesCounterByPlace(db_used, id_place) {
1280
+ var query = "";
1281
+ if (db_used) {
1282
+ switch (db_used) {
1283
+ case 'SQLITE':
1284
+ query = alsmgr.getDevicesCounterByPlaceSQLite(id_place);
1285
+ break;
1286
+ case 'MYSQL':
1287
+ query = alsmgr.getDevicesCounterByPlaceMySQL(id_place);
1288
+ break;
1289
+ }
1290
+ }
1291
+ return query;
1292
+ }
769
1293
  //End Count Devices by Place
770
1294
  //Get Related Devices
771
1295
  function getDevicesSelectByRelatedSQLite(id_device) {
@@ -807,7 +1331,20 @@ function getDevicesSelectByRelatedMySQL(id_device) {
807
1331
  query += "where ds.id_maindevice = :id_device";
808
1332
  return query;
809
1333
  }
810
-
1334
+ function getDevicesSelectByRelated(db_used, id_device) {
1335
+ var query = "";
1336
+ if (db_used) {
1337
+ switch (db_used) {
1338
+ case 'SQLITE':
1339
+ query = getDevicesSelectByRelatedSQLite(id_device);
1340
+ break;
1341
+ case 'MYSQL':
1342
+ query = getDevicesSelectByRelatedMySQL(id_device);
1343
+ break;
1344
+ }
1345
+ }
1346
+ return query;
1347
+ }
811
1348
  //End Get Related Devices
812
1349
  //Get Device by Id
813
1350
  function queryDeviceByIdSQLite(id_device) {
@@ -828,6 +1365,21 @@ function queryDeviceByIdMySQL(id_device) {
828
1365
  query += "where d.id = :id_device";
829
1366
  return query;
830
1367
  }
1368
+ function queryDeviceById(db_used, id_device) {
1369
+ var query = "";
1370
+ var db_used = global.get("db_used");
1371
+ if (db_used) {
1372
+ switch (db_used) {
1373
+ case 'SQLITE':
1374
+ query = queryDeviceByIdSQLite(id_device);
1375
+ break;
1376
+ case 'MYSQL':
1377
+ query = queryDeviceByIdMySQL(id_device);
1378
+ break;
1379
+ }
1380
+ }
1381
+ return query;
1382
+ }
831
1383
  //End Get Device by Id
832
1384
  //Get Device by Identificativo
833
1385
  function queryDeviceByIdentificativoSQLite(identificativo) {
@@ -855,6 +1407,20 @@ function queryDeviceByIdentificativoMySQL(identificativo) {
855
1407
  query += "d.inv_tn_number = :identificativo)";
856
1408
  return query;
857
1409
  }
1410
+ function queryDeviceByIdentificativo(db_used, identificativo) {
1411
+ var query = "";
1412
+ if (db_used) {
1413
+ switch (db_used) {
1414
+ case 'SQLITE':
1415
+ query = queryDeviceByIdentificativoSQLite(identificativo);
1416
+ break;
1417
+ case 'MYSQL':
1418
+ query = queryDeviceByIdentificativoMySQL(identificativo);
1419
+ break;
1420
+ }
1421
+ }
1422
+ return query;
1423
+ }
858
1424
  //End Get Device by Identificativo
859
1425
 
860
1426
 
@@ -896,6 +1462,20 @@ function queryDeviceStatusMySQL(id_device, date_ref) {
896
1462
  }
897
1463
  return query;
898
1464
  }
1465
+ function queryDeviceStatus(db_used, id_device, date_ref) {
1466
+ var query = "";
1467
+ if (db_used) {
1468
+ switch (db_used) {
1469
+ case 'SQLITE':
1470
+ query = queryDeviceStatusSQLite(id_device, date_ref);
1471
+ break;
1472
+ case 'MYSQL':
1473
+ query = queryDeviceStatusMySQL(id_device, date_ref);
1474
+ break;
1475
+ }
1476
+ }
1477
+ return query;
1478
+ }
899
1479
  //End Get Device Status
900
1480
  // Insert device status
901
1481
  function updateDeviceStatusSQLite(id_device) {
@@ -908,6 +1488,21 @@ function updateDeviceStatusMySQL(id_device) {
908
1488
  query += "where id_device = :id_device and date_status = (select max(date_status) from device_usage where id_device = :id_device)";
909
1489
  return query;
910
1490
  }
1491
+ function updateDeviceStatus(db_used, id_device) {
1492
+ var query = "";
1493
+ if (db_used) {
1494
+ switch (db_used) {
1495
+ case 'SQLITE':
1496
+ query = updateDeviceStatusSQLite(id_device);
1497
+ break;
1498
+ case 'MYSQL':
1499
+ query = updateDeviceStatusMySQL(id_device);
1500
+ break;
1501
+ }
1502
+ }
1503
+ return query;
1504
+ }
1505
+
911
1506
  // end manage updateDevicesStatus
912
1507
  // Manage insertDeviceStatus
913
1508
  function insertDeviceStatusSQLite(id_device, dev_status, start_date) {
@@ -940,7 +1535,20 @@ function insertDeviceStatusMySQL(id_device, dev_status, start_date) {
940
1535
  query += ")";
941
1536
  return query;
942
1537
  }
943
-
1538
+ function insertDeviceStatus(db_used, id_device, dev_status, start_date) {
1539
+ var query = "";
1540
+ if (db_used) {
1541
+ switch (db_used) {
1542
+ case 'SQLITE':
1543
+ query = insertDeviceStatusSQLite(id_device, dev_status, start_date);
1544
+ break;
1545
+ case 'MYSQL':
1546
+ query = insertDeviceStatusMySQL(id_device, dev_status, start_date);
1547
+ break;
1548
+ }
1549
+ }
1550
+ return query;
1551
+ }
944
1552
  //end insert device status
945
1553
 
946
1554
 
@@ -1007,6 +1615,21 @@ function insertDeviceMySQL() {
1007
1615
  query += ")";
1008
1616
  return query;
1009
1617
  }
1618
+ function insertDevice(db_used, deviceObj) {
1619
+ var query = "";
1620
+ if (db_used) {
1621
+ switch (db_used) {
1622
+ case 'SQLITE':
1623
+ query = insertDeviceSQLite(deviceObj);
1624
+ break;
1625
+ case 'MYSQL':
1626
+ query = insertDeviceMySQL();
1627
+ break;
1628
+ }
1629
+ }
1630
+ return query;
1631
+ }
1632
+
1010
1633
  //End Insert Device
1011
1634
  //Update Device
1012
1635
  function updateDeviceSQLite(deviceObj) {
@@ -1072,6 +1695,23 @@ function updateDeviceMySQL() {
1072
1695
  return query;
1073
1696
  }
1074
1697
 
1698
+ function updateDevice(db_used, deviceObj) {
1699
+ var query = "";
1700
+ if (db_used) {
1701
+ switch (db_used) {
1702
+ case 'SQLITE':
1703
+ query = updateDeviceSQLite(deviceObj);
1704
+ break;
1705
+ case 'MYSQL':
1706
+ query = updateDeviceMySQL();
1707
+ break;
1708
+ }
1709
+ }
1710
+ return query;
1711
+ }
1712
+
1713
+
1714
+
1075
1715
  function getDeviceMySQLPayload(dev) {
1076
1716
  var payloadObj = {};
1077
1717
  if (dev) {
@@ -1105,20 +1745,6 @@ function getDeviceMySQLPayload(dev) {
1105
1745
  if (dev.note) {
1106
1746
  retValue.note = dev.note;
1107
1747
  }
1108
- /*
1109
- payloadObj = {
1110
- "inv_ict3_number": String(retValue.inventario).trim(),
1111
- "inv_tn_number": String(retValue.inv_comune).trim(),
1112
- "inv_pnrr_number": String(retValue.PNRR).trim(),
1113
- "inv_tndigit_number": String(retValue).inv_tndigit.trim(),
1114
- "type": String(retValue.type).trim(),
1115
- "manifacturer": String(retValue.marca).trim(),
1116
- "model": String(retValue.modello).trim(),
1117
- "serial_no": String(retValue.serial_no).trim(),
1118
- "note": String(retValue.note).trim(),
1119
- "id_device": dev.id
1120
- };
1121
- */
1122
1748
  payloadObj = {
1123
1749
  "inventario": retValue.inventario.trim(),
1124
1750
  "inv_comune": retValue.inv_comune.trim(),
@@ -1148,6 +1774,20 @@ function removeDeviceMySQL() {
1148
1774
  query += "where id = :id_device";
1149
1775
  return query;
1150
1776
  }
1777
+ function removeDevice(db_used, id_device) {
1778
+ var query = "";
1779
+ if (db_used) {
1780
+ switch (db_used) {
1781
+ case 'SQLITE':
1782
+ query = removeDeviceSQLite(id_device);
1783
+ break;
1784
+ case 'MYSQL':
1785
+ query = removeDeviceMySQL();
1786
+ break;
1787
+ }
1788
+ }
1789
+ return query;
1790
+ }
1151
1791
 
1152
1792
  //End remove device
1153
1793
  //Get Last Id
@@ -1158,7 +1798,20 @@ function queryLastDeviceIdSQLite() {
1158
1798
  function queryLastDeviceIdMySQL() {
1159
1799
  return "SELECT AUTO_INCREMENT - 1 as CurrentId FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ALS' AND TABLE_NAME = 'devices'";
1160
1800
  }
1161
-
1801
+ function queryLastDeviceId(db_used) {
1802
+ var query = "";
1803
+ if (db_used) {
1804
+ switch (db_used) {
1805
+ case 'SQLITE':
1806
+ query = queryLastDeviceIdSQLite();
1807
+ break;
1808
+ case 'MYSQL':
1809
+ query = queryLastDeviceIdMySQL();
1810
+ break;
1811
+ }
1812
+ }
1813
+ return query;
1814
+ }
1162
1815
  //End Get Last Id
1163
1816
  //Get Devices for Combo
1164
1817
  function getDevicesSelectComboSQLite(categoria, id_dev_exclude, with_properties) {
@@ -1222,7 +1875,20 @@ function getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties)
1222
1875
  query += "order by d.inv_ict3_number";
1223
1876
  return query;
1224
1877
  }
1225
-
1878
+ function getDevicesSelectCombo(db_used, categoria, id_dev_exclude, with_properties) {
1879
+ var query = "";
1880
+ if (db_used) {
1881
+ switch (db_used) {
1882
+ case 'SQLITE':
1883
+ query = getDevicesSelectComboSQLite(categoria, id_dev_exclude, with_properties);
1884
+ break;
1885
+ case 'MYSQL':
1886
+ query = getDevicesSelectComboMySQL(categoria, id_dev_exclude, with_properties);
1887
+ break;
1888
+ }
1889
+ }
1890
+ return query;
1891
+ }
1226
1892
  //End get devices for combo
1227
1893
  // Get device by site combo
1228
1894
  function getDevicesSelectBySiteComboSQLite(id_site) {
@@ -1259,6 +1925,21 @@ function getDevicesSelectBySiteComboMySQL(id_site) {
1259
1925
  query += "order by d.inv_ict3_number";
1260
1926
  return query;
1261
1927
  }
1928
+
1929
+ function getDevicesSelectBySiteCombo(db_used, id_site) {
1930
+ var query = "";
1931
+ if (db_used) {
1932
+ switch (db_used) {
1933
+ case 'SQLITE':
1934
+ query = getDevicesSelectBySiteComboSQLite(id_site);
1935
+ break;
1936
+ case 'MYSQL':
1937
+ query = getDevicesSelectBySiteComboMySQL(id_site);
1938
+ break;
1939
+ }
1940
+ }
1941
+ return query;
1942
+ }
1262
1943
  //end Get device by site Combo
1263
1944
 
1264
1945
  //Write Device properties
@@ -1273,7 +1954,20 @@ function writeDevicePropertiesMySQL() {
1273
1954
  query += ":id_device, :raw_data)";
1274
1955
  return query;
1275
1956
  }
1276
-
1957
+ function writeDeviceProperties(db_used, id_device, raw_data) {
1958
+ var query = "";
1959
+ if (db_used) {
1960
+ switch (db_used) {
1961
+ case 'SQLITE':
1962
+ query = writeDevicePropertiesSQLite(id_device, raw_data);
1963
+ break;
1964
+ case 'MYSQL':
1965
+ query = writeDevicePropertiesMySQL();
1966
+ break;
1967
+ }
1968
+ }
1969
+ return query;
1970
+ }
1277
1971
  //End Write Device properties
1278
1972
  //Read Device properties
1279
1973
  function readDevicePropertiesSQLite(id_device) {
@@ -1283,9 +1977,24 @@ function readDevicePropertiesSQLite(id_device) {
1283
1977
  }
1284
1978
 
1285
1979
  function readDevicePropertiesMySQL() {
1286
- return "";
1980
+ var query = "select raw_properties from device_properties ";
1981
+ query += "where id_device = :id_device";
1982
+ return query;
1983
+ }
1984
+ function readDeviceProperties(db_used, id_device) {
1985
+ var query = "";
1986
+ if (db_used) {
1987
+ switch (db_used) {
1988
+ case 'SQLITE':
1989
+ query = readDevicePropertiesSQLite(id_device);
1990
+ break;
1991
+ case 'MYSQL':
1992
+ query = readDevicePropertiesMySQL();
1993
+ break;
1994
+ }
1995
+ }
1996
+ return query;
1287
1997
  }
1288
-
1289
1998
  //End Read Device properties
1290
1999
 
1291
2000
  // Get Devices with properties
@@ -1310,6 +2019,21 @@ function getDevicesWithPropertiesSQLite(id_device) {
1310
2019
  function getDevicesWithPropertiesMySQL(id_device) {
1311
2020
 
1312
2021
  }
2022
+ function getDevicesWithProperties(db_used, id_device) {
2023
+ var query = "";
2024
+ if (db_used) {
2025
+ switch (db_used) {
2026
+ case 'SQLITE':
2027
+ query = getDevicesWithPropertiesSQLite(id_device);
2028
+ break;
2029
+ case 'MYSQL':
2030
+ query = getDevicesWithPropertiesMySQL(id_device);
2031
+ break;
2032
+ }
2033
+ }
2034
+ return query;
2035
+ }
2036
+
1313
2037
  // End get devices with properties
1314
2038
  // Get Beni Acquisiti...
1315
2039
  function getBeniAcquisitiSQLite(table_name, is_pnrr, is_dismissione) {
@@ -1435,7 +2159,20 @@ function getBeniAcquisitiMySQL(table_name, is_pnrr, is_dismissione) {
1435
2159
  let result = query.replace("TAB_NAME", table_name);
1436
2160
  return result;
1437
2161
  }
1438
-
2162
+ function getBeniAcquisiti(db_used, tab_name, is_pnrr, is_dismissione) {
2163
+ var query = "";
2164
+ if (db_used) {
2165
+ switch (db_used) {
2166
+ case 'SQLITE':
2167
+ query = getBeniAcquisitiSQLite(tab_name, is_pnrr, is_dismissione);
2168
+ break;
2169
+ case 'MYSQL':
2170
+ query = getBeniAcquisitiMySQL(tab_name, is_pnrr, is_dismissione);
2171
+ break;
2172
+ }
2173
+ }
2174
+ return query;
2175
+ }
1439
2176
  //End get beni acquisiti
1440
2177
  //Manage sets
1441
2178
  function getSetInfoByIdSetSQLite(id_Set) {
@@ -1450,7 +2187,20 @@ function getSetInfoByIdSetMySQL(id_set) {
1450
2187
  query += "where idset = :id_set";
1451
2188
  return query;
1452
2189
  }
1453
-
2190
+ function getSetInfoByIdSet(db_used, id_set) {
2191
+ var query = "";
2192
+ if (db_used) {
2193
+ switch (db_used) {
2194
+ case 'SQLITE':
2195
+ query = getSetInfoByIdSetSQLite(id_set);
2196
+ break;
2197
+ case 'MYSQL':
2198
+ query = getSetInfoByIdSetMySQL(id_set);
2199
+ break;
2200
+ }
2201
+ }
2202
+ return query;
2203
+ }
1454
2204
  function getSetInfoByIdDeviceSQLite(id_device) {
1455
2205
  var query = "select idset, id_maindevice, id_relateddevice, id_conn_out, id_conn_in, id_adapter from device_set ";
1456
2206
  query += "where id_maindevice = " + id_device;
@@ -1462,7 +2212,20 @@ function getSetInfoByIdDeviceMySQL(id_device) {
1462
2212
  query += "where id_maindevice = :id_device";
1463
2213
  return query;
1464
2214
  }
1465
-
2215
+ function getSetInfoByIdDevice(db_used, id_device) {
2216
+ var query = "";
2217
+ if (db_used) {
2218
+ switch (db_used) {
2219
+ case 'SQLITE':
2220
+ query = getSetInfoByIdDeviceSQLite(id_device);
2221
+ break;
2222
+ case 'MYSQL':
2223
+ query = getSetInfoByIdDeviceMySQL(id_device);
2224
+ break;
2225
+ }
2226
+ }
2227
+ return query;
2228
+ }
1466
2229
  function insertSetInfoSQLite(id_device, id_device_col) {
1467
2230
  var query = "";
1468
2231
  if (id_device > 0 && id_device_col > 0) {
@@ -1489,7 +2252,35 @@ function insertSetInfoInverseSQLite(id_device, id_device_col) {
1489
2252
  function insertSetInfoInverseMySQL(id_device, id_device_col) {
1490
2253
  return insertSetInfoMySQL(id_device_col, id_device);
1491
2254
  }
2255
+ function insertSetInfo(db_used, id_device, id_device_col) {
2256
+ var query = "";
2257
+ if (db_used) {
2258
+ switch (db_used) {
2259
+ case 'SQLITE':
2260
+ query = insertSetInfoSQLite(id_device, id_device_col);
2261
+ break;
2262
+ case 'MYSQL':
2263
+ query = insertSetInfoMySQL(id_device, id_device_col);
2264
+ break;
2265
+ }
2266
+ }
2267
+ return query;
2268
+ }
1492
2269
 
2270
+ function insertSetInfoInverse(db_used, id_device, id_device_col) {
2271
+ var query = "";
2272
+ if (db_used) {
2273
+ switch (db_used) {
2274
+ case 'SQLITE':
2275
+ query = insertSetInfoSQLite(id_device_col, id_device);
2276
+ break;
2277
+ case 'MYSQL':
2278
+ query = insertSetInfoMySQL(id_device_col, id_device);
2279
+ break;
2280
+ }
2281
+ }
2282
+ return query;
2283
+ }
1493
2284
 
1494
2285
  function removeSetInfoSQLite(id_device, id_device_col) {
1495
2286
  var query = "";
@@ -1509,6 +2300,20 @@ function removeSetInfoMySQL(id_device, id_device_col) {
1509
2300
  return query;
1510
2301
  }
1511
2302
 
2303
+ function removeSetInfo(db_used, id_device, id_device_col) {
2304
+ var query = "";
2305
+ if (db_used) {
2306
+ switch (db_used) {
2307
+ case 'SQLITE':
2308
+ query = removeSetInfoSQLite(id_device, id_device_col);
2309
+ break;
2310
+ case 'MYSQL':
2311
+ query = removeSetInfoMySQL(id_device, id_device_col);
2312
+ break;
2313
+ }
2314
+ }
2315
+ return query;
2316
+ }
1512
2317
 
1513
2318
  function setInfoObj(set_info) {
1514
2319
  var obj = {};
@@ -1541,6 +2346,20 @@ function updateSetInfoMySQL() {
1541
2346
  return query;
1542
2347
  }
1543
2348
 
2349
+ function updateSetInfo(db_used, set_info) {
2350
+ var query = "";
2351
+ if (db_used) {
2352
+ switch (db_used) {
2353
+ case 'SQLITE':
2354
+ query = updateSetInfoSQLite(set_info);
2355
+ break;
2356
+ case 'MYSQL':
2357
+ query = updateSetInfoMySQL();
2358
+ break;
2359
+ }
2360
+ }
2361
+ return query;
2362
+ }
1544
2363
 
1545
2364
  //
1546
2365
  function selectSetsByIdDeviceSQLite(id_device) {
@@ -1555,7 +2374,20 @@ function selectSetsByIdDeviceMySQL(id_device) {
1555
2374
  query += "where ds.id_maindevice = :id_device";
1556
2375
  return query;
1557
2376
  }
1558
-
2377
+ function selectSetsByIdDevice(db_used, id_device) {
2378
+ var query = "";
2379
+ if (db_used) {
2380
+ switch (db_used) {
2381
+ case 'SQLITE':
2382
+ query = selectSetsByIdDeviceSQLite(id_device);
2383
+ break;
2384
+ case 'MYSQL':
2385
+ query = selectSetsByIdDeviceMySQL(id_device);
2386
+ break;
2387
+ }
2388
+ }
2389
+ return query;
2390
+ }
1559
2391
  //End manage sets
1560
2392
 
1561
2393
 
@@ -1583,6 +2415,20 @@ function getNetworksOnDeviceMySQL(id_device) {
1583
2415
  query += "where dn.id_device = :id_device";
1584
2416
  return query;
1585
2417
  }
2418
+ function getNetworksOnDevice(db_used, id_device) {
2419
+ var query = "";
2420
+ if (db_used) {
2421
+ switch (db_used) {
2422
+ case 'SQLITE':
2423
+ query = getNetworksOnDeviceSQLite(id_device);
2424
+ break;
2425
+ case 'MYSQL':
2426
+ query = getNetworksOnDeviceMySQL(id_device);
2427
+ break;
2428
+ }
2429
+ }
2430
+ return query;
2431
+ }
1586
2432
  //end Get Network on device
1587
2433
  //
1588
2434
  function getImportedPropertiesByIdDeviceSQLite(id_device) {
@@ -1595,6 +2441,20 @@ function getImportedPropertiesByIdDeviceMySQL(id_device) {
1595
2441
  query += "where dp.id_device = :id_device";
1596
2442
  return query;
1597
2443
  }
2444
+ function getImportedPropertiesByIdDevice(db_used, id_device) {
2445
+ var query = "";
2446
+ if (db_used) {
2447
+ switch (db_used) {
2448
+ case 'SQLITE':
2449
+ query = getImportedPropertiesByIdDeviceSQLite(id_device);
2450
+ break;
2451
+ case 'MYSQL':
2452
+ query = getImportedPropertiesByIdDeviceMySQL(id_device);
2453
+ break;
2454
+ }
2455
+ }
2456
+ return query;
2457
+ }
1598
2458
  //
1599
2459
 
1600
2460
  function queryDeviceTypes() {
@@ -1641,6 +2501,20 @@ function getDevicesNotAllocatedComboMySQL() {
1641
2501
  query += "order by d.inv_ict3_number";
1642
2502
  return query;
1643
2503
  }
2504
+ function getDevicesNotAllocatedCombo(db_used) {
2505
+ var query = "";
2506
+ if (db_used) {
2507
+ switch (db_used) {
2508
+ case 'SQLITE':
2509
+ query = getDevicesNotAllocatedComboSQLite();
2510
+ break;
2511
+ case 'MYSQL':
2512
+ query = getDevicesNotAllocatedComboMySQL();
2513
+ break;
2514
+ }
2515
+ }
2516
+ return query;
2517
+ }
1644
2518
  // End getDevicesNotAllocatedCombo
1645
2519
  // Define getDevicesAllocatedCombo
1646
2520
  function getDevicesAllocatedComboSQLite(id_site, id_place) {
@@ -1679,7 +2553,20 @@ function getDevicesAllocatedComboMySQL(id_site, id_place) {
1679
2553
  query += "order by d.inv_ict3_number";
1680
2554
  return query;
1681
2555
  }
1682
-
2556
+ function getDevicesAllocatedCombo(db_used, id_site, id_place) {
2557
+ var query = "";
2558
+ if (db_used) {
2559
+ switch (db_used) {
2560
+ case 'SQLITE':
2561
+ query = getDevicesAllocatedComboSQLite(id_site, id_place);
2562
+ break;
2563
+ case 'MYSQL':
2564
+ query = getDevicesAllocatedComboMySQL(id_site, id_place);
2565
+ break;
2566
+ }
2567
+ }
2568
+ return query;
2569
+ }
1683
2570
  // End getDevicesAllocatedCombo
1684
2571
 
1685
2572
  //end of source
@@ -1949,6 +2836,21 @@ function queryCloseGestioneDeviceMySQL(id_gestione, id_device, id_gestore) {
1949
2836
  query += "and date_start < CURDATE()";
1950
2837
  return query;
1951
2838
  }
2839
+ function queryCloseGestioneDevice(db_used,id_gestione) {
2840
+ var query = "";
2841
+ if (db_used) {
2842
+ switch (db_used) {
2843
+ case 'SQLITE':
2844
+ query = queryCloseGestioneDeviceSQLite(id_gestione);
2845
+ break;
2846
+ case 'MYSQL':
2847
+ query = queryCloseGestioneDeviceMySQL(id_gestione);
2848
+ break;
2849
+ }
2850
+ }
2851
+ return query;
2852
+ }
2853
+
1952
2854
 
1953
2855
 
1954
2856
  function queryFornitoriGestoriCombo()
@@ -1974,6 +2876,21 @@ function queryInsertGestioneDeviceMySQL(id_device, id_gestore) {
1974
2876
  return query;
1975
2877
  }
1976
2878
 
2879
+ function queryInsertGestioneDevice(db_used, id_device, id_gestore) {
2880
+ var query = "";
2881
+ if (db_used) {
2882
+ switch (db_used) {
2883
+ case 'SQLITE':
2884
+ query = queryInsertGestioneDeviceSQLite(id_device, id_gestore);
2885
+ break;
2886
+ case 'MYSQL':
2887
+ query = queryInsertGestioneDeviceMySQL(id_device, id_gestore);
2888
+ break;
2889
+ }
2890
+ }
2891
+ return query;
2892
+ }
2893
+
1977
2894
  function querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione, date_ref) {
1978
2895
 
1979
2896
  }
@@ -1985,6 +2902,22 @@ function querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione, date
1985
2902
  return query;
1986
2903
  }
1987
2904
 
2905
+
2906
+ function querySelectExistsGestioneDeviceByIds(db_used,id_device, id_gestione) {
2907
+ var query = "";
2908
+ if (db_used) {
2909
+ switch (db_used) {
2910
+ case 'SQLITE':
2911
+ query = querySelectExistsGestioneDeviceByIdsSQLite(id_device, id_gestione);
2912
+ break;
2913
+ case 'MYSQL':
2914
+ query = querySelectExistsGestioneDeviceByIdsMySQL(id_device, id_gestione);
2915
+ break;
2916
+ }
2917
+ }
2918
+ return query;
2919
+ }
2920
+
1988
2921
  function querySelectGestioniDeviceByIdDeviceSQLite(id_device, date_ref) {
1989
2922
  var query = "select gf.name as Denominazione, contact_phone as Telefono, contact_email as Email from device_gestioni dg ";
1990
2923
  query += "inner join gestori_fornitori gf on gf.id = dg.id_gestione ";
@@ -2026,7 +2959,20 @@ function querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref) {
2026
2959
  query += " order by date_start desc"
2027
2960
  return query;
2028
2961
  }
2029
-
2962
+ function querySelectGestioniDeviceByIdDevice(db_used,id_device, date_ref) {
2963
+ var query = "";
2964
+ if (db_used) {
2965
+ switch (db_used) {
2966
+ case 'SQLITE':
2967
+ query = querySelectGestioniDeviceByIdDeviceSQLite(id_device, date_ref);
2968
+ break;
2969
+ case 'MYSQL':
2970
+ query = querySelectGestioniDeviceByIdDeviceMySQL(id_device, date_ref);
2971
+ break;
2972
+ }
2973
+ }
2974
+ return query;
2975
+ }
2030
2976
 
2031
2977
  function queryConsegneSQLite(data_da, data_a, data_filter) {
2032
2978
  var query = "SELECT id, data_richiesta as Richiesta, data_consegna as Consegna, richiedente_adulto as Adulto, richiedente_alunno as Alunno, richiedente_genitore as Genitore, is_home as Casa, note as Note from consegne";
@@ -2088,7 +3034,20 @@ function queryConsegneMySQL(data_da, data_a, data_filter) {
2088
3034
 
2089
3035
  return query;
2090
3036
  }
2091
-
3037
+ function queryConsegne(db_used,data_da, data_a, data_filter) {
3038
+ var query = "";
3039
+ if (db_used) {
3040
+ switch (db_used) {
3041
+ case 'SQLITE':
3042
+ query = queryConsegneSQLite(data_da, data_a, data_filter);
3043
+ break;
3044
+ case 'MYSQL':
3045
+ query = queryConsegneMySQL(data_da, data_a, data_filter);
3046
+ break;
3047
+ }
3048
+ }
3049
+ return query;
3050
+ }
2092
3051
 
2093
3052
  function queryConsegnaByIdSQLite(id_consegna) {
2094
3053
  var query = "SELECT id, id_place, id_site, data_richiesta, data_consegna, data_rientro, ";
@@ -2107,8 +3066,21 @@ function queryConsegnaByIdMySQL(id_consegna) {
2107
3066
  query += " where id = :id_consegna";
2108
3067
  return query;
2109
3068
  }
3069
+ function queryConsegnaById(db_used,id_consegna) {
3070
+ var query = "";
3071
+ if (db_used) {
3072
+ switch (db_used) {
3073
+ case 'SQLITE':
3074
+ query = queryConsegnaByIdSQLite(id_consegna);
3075
+ break;
3076
+ case 'MYSQL':
3077
+ query = queryConsegnaByIdMySQL(id_consegna);
3078
+ break;
3079
+ }
3080
+ }
3081
+ return query;
3082
+ }
2110
3083
 
2111
-
2112
3084
  function queryConsegneByIdDeviceSQLite(id_device) {
2113
3085
  var query = "select c.data_consegna as Consegna, ";
2114
3086
  query += "case ";
@@ -2141,6 +3113,21 @@ function queryConsegneByIdDeviceMySQL(id_device) {
2141
3113
  return query;
2142
3114
  }
2143
3115
 
3116
+ function queryConsegneByIdDevice(db_used, id_device) {
3117
+ var query = "";
3118
+ if (db_used) {
3119
+ switch (db_used) {
3120
+ case 'SQLITE':
3121
+ query = queryConsegneByIdDeviceSQLite(id_device);
3122
+ break;
3123
+ case 'MYSQL':
3124
+ query = queryConsegneByIdDeviceMySQL(id_device);
3125
+ break;
3126
+ }
3127
+ }
3128
+ return query;
3129
+ }
3130
+
2144
3131
 
2145
3132
  function queryDeviceStatusCombo() {
2146
3133
  var query = "SELECT id, name from status_description order by id";
@@ -2178,6 +3165,22 @@ function queryInterventoByIdMySQL(id_interv) {
2178
3165
  return query;
2179
3166
  }
2180
3167
 
3168
+ function queryInterventoById(db_used,id_interv) {
3169
+ var query = "";
3170
+ if (db_used) {
3171
+ switch (db_used) {
3172
+ case 'SQLITE':
3173
+ query = queryInterventoByIdSQLite(id_interv);
3174
+ break;
3175
+ case 'MYSQL':
3176
+ query = queryInterventoByIdSQLite(id_interv);
3177
+ break;
3178
+ }
3179
+ }
3180
+ return query;
3181
+ }
3182
+
3183
+
2181
3184
 
2182
3185
  // Device intervento
2183
3186
  function insertDeviceInterventoSQLite(id_intervento, id_device, note) {
@@ -2190,6 +3193,20 @@ function insertDeviceInterventoMySQL(id_intervento, id_device, note) {
2190
3193
  query += "values (:id_intervento, :id_device, :note)";
2191
3194
  return query;
2192
3195
  }
3196
+ function insertDeviceIntervento(db_used,id_intervento, id_device, note) {
3197
+ var query = "";
3198
+ if (db_used) {
3199
+ switch (db_used) {
3200
+ case 'SQLITE':
3201
+ query = insertDeviceInterventoSQLite(id_intervento, id_device, note);
3202
+ break;
3203
+ case 'MYSQL':
3204
+ query = insertDeviceInterventoMySQL(id_intervento, id_device, note);
3205
+ break;
3206
+ }
3207
+ }
3208
+ return query;
3209
+ }
2193
3210
  // Update
2194
3211
  function updateDeviceInterventoSQLite(id_dev_interv, id_device, note) {
2195
3212
  var query = "update device_interventi set ";
@@ -2205,6 +3222,20 @@ function updateDeviceInterventoMySQL(id_dev_interv, id_device, note) {
2205
3222
  query += "where id = :id_dev_interv";
2206
3223
  return query;
2207
3224
  }
3225
+ function updateDeviceIntervento(db_used, id_dev_interv, id_device, note) {
3226
+ var query = "";
3227
+ if (db_used) {
3228
+ switch (db_used) {
3229
+ case 'SQLITE':
3230
+ query = updateDeviceInterventoSQLite(id_dev_interv, id_device, note);
3231
+ break;
3232
+ case 'MYSQL':
3233
+ query = updateDeviceInterventoMySQL(id_dev_interv, id_device, note);
3234
+ break;
3235
+ }
3236
+ }
3237
+ return query;
3238
+ }
2208
3239
  // Remove
2209
3240
  function removeDeviceInterventoSQLite(id_dev_interv) {
2210
3241
  var query = "delete from device_interventi ";
@@ -2216,6 +3247,20 @@ function removeDeviceInterventoMySQL(id_intervento, id_device, note) {
2216
3247
  query += "values (:id_intervento, :id_device, :note)";
2217
3248
  return query;
2218
3249
  }
3250
+ function removeDeviceIntervento(db_used, id_intervento, id_device, note) {
3251
+ var query = "";
3252
+ if (db_used) {
3253
+ switch (db_used) {
3254
+ case 'SQLITE':
3255
+ query = insertDeviceInterventoSQLite(id_intervento, id_device, note);
3256
+ break;
3257
+ case 'MYSQL':
3258
+ query = insertDeviceInterventoMySQL(id_intervento, id_device, note);
3259
+ break;
3260
+ }
3261
+ }
3262
+ return query;
3263
+ }
2219
3264
  //End device intervento
2220
3265
 
2221
3266
 
@@ -2347,7 +3392,20 @@ function insertConsegnaMySQL(consegnaObj) {
2347
3392
  return query;
2348
3393
  }
2349
3394
 
2350
-
3395
+ function insertConsegna(db_used, consegna){
3396
+ var query = "";
3397
+ if (db_used) {
3398
+ switch (db_used) {
3399
+ case 'SQLITE':
3400
+ query = insertConsegnaSQLite(consegna);
3401
+ break;
3402
+ case 'MYSQL':
3403
+ query = insertConsegnaMySQL(consegna);
3404
+ break;
3405
+ }
3406
+ }
3407
+ return query;
3408
+ }
2351
3409
 
2352
3410
  function updateConsegnaSQLite(consegna) {
2353
3411
  var query = "";
@@ -2405,6 +3463,21 @@ function updateConsegnaMySQL(consegna) {
2405
3463
  return query;
2406
3464
  }
2407
3465
 
3466
+ function updateConsegna(db_used, consegna) {
3467
+ var query = "";
3468
+ var db_used = global.get("db_used");
3469
+ if (db_used) {
3470
+ switch (db_used) {
3471
+ case 'SQLITE':
3472
+ query = updateConsegnaSQLite(consegna);
3473
+ break;
3474
+ case 'MYSQL':
3475
+ query = updateConsegnaMySQL(consegna);
3476
+ break;
3477
+ }
3478
+ }
3479
+ return query;
3480
+ }
2408
3481
 
2409
3482
  function removeConsegnaSQLite(id_consegna) {
2410
3483
  var query = "update consegne";
@@ -2420,6 +3493,20 @@ function removeConsegnaMySQL(id_consegna) {
2420
3493
  return query;
2421
3494
  }
2422
3495
 
3496
+ function removeConsegna(db_used,id_consegna) {
3497
+ var query = "";
3498
+ if (db_used) {
3499
+ switch (db_used) {
3500
+ case 'SQLITE':
3501
+ query = removeConsegnaSQLite(id_consegna);
3502
+ break;
3503
+ case 'MYSQL':
3504
+ query = removeConsegnaMySQL(id_consegna);
3505
+ break;
3506
+ }
3507
+ }
3508
+ return query;
3509
+ }
2423
3510
 
2424
3511
  function queryLastConsegnaIdSQLite() {
2425
3512
  return "select seq as id from sqlite_sequence where name = 'consegne'";
@@ -2427,7 +3514,20 @@ function queryLastConsegnaIdSQLite() {
2427
3514
  function queryLastConsegnaIdMySQL() {
2428
3515
  return "SELECT AUTO_INCREMENT - 1 as CurrentId FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'ALS' AND TABLE_NAME = 'consegne'";
2429
3516
  }
2430
-
3517
+ function queryLastConsegnaId(db_used) {
3518
+ var query = "";
3519
+ if (db_used) {
3520
+ switch (db_used) {
3521
+ case 'SQLITE':
3522
+ query = queryLastConsegnaIdSQLite();
3523
+ break;
3524
+ case 'MYSQL':
3525
+ query = queryLastConsegnaIdMySQL();
3526
+ break;
3527
+ }
3528
+ }
3529
+ return query;
3530
+ }
2431
3531
 
2432
3532
  //get connection types
2433
3533
  function getConnectionTypesSQLite() {
@@ -2438,6 +3538,20 @@ function getConnectionTypesMySQL() {
2438
3538
  var query = "select id, conn_type from connection_types";
2439
3539
  return query;
2440
3540
  }
3541
+ function getConnectionTypes(db_used) {
3542
+ var query = "";
3543
+ if (db_used) {
3544
+ switch (db_used) {
3545
+ case 'SQLITE':
3546
+ query = getConnectionTypesSQLite();
3547
+ break;
3548
+ case 'MYSQL':
3549
+ query = getConnectionTypesMySQL();
3550
+ break;
3551
+ }
3552
+ }
3553
+ return query;
3554
+ }
2441
3555
  //end get connection types
2442
3556
  //get connection protocols
2443
3557
  function getConnectionProtocolsSQLite() {
@@ -2448,6 +3562,20 @@ function getConnectionProtocolsMySQL() {
2448
3562
  var query = "select id, name from connection_protocols";
2449
3563
  return query;
2450
3564
  }
3565
+ function getConnectionProtocols(db_used) {
3566
+ var query = "";
3567
+ if (db_used) {
3568
+ switch (db_used) {
3569
+ case 'SQLITE':
3570
+ query = getConnectionProtocolsSQLite();
3571
+ break;
3572
+ case 'MYSQL':
3573
+ query = getConnectionProtocolsMySQL();
3574
+ break;
3575
+ }
3576
+ }
3577
+ return query;
3578
+ }
2451
3579
  //end get connection protocols
2452
3580
  //Get Storage types
2453
3581
  function getStorageTypesSQLite() {
@@ -2458,6 +3586,20 @@ function getStorageTypesMySQL() {
2458
3586
  var query = "select id, name from storage_types order by exp_order";
2459
3587
  return query;
2460
3588
  }
3589
+ function getStorageTypes(db_used) {
3590
+ var query = "";
3591
+ if (db_used) {
3592
+ switch (db_used) {
3593
+ case 'SQLITE':
3594
+ query = getStorageTypesSQLite();
3595
+ break;
3596
+ case 'MYSQL':
3597
+ query = getStorageTypesMySQL();
3598
+ break;
3599
+ }
3600
+ }
3601
+ return query;
3602
+ }
2461
3603
  //end get storage types
2462
3604
 
2463
3605
 
@@ -2476,6 +3618,20 @@ function getAdapterTypesMySQL() {
2476
3618
 
2477
3619
  return query;
2478
3620
  }
3621
+ function getAdapterTypes(db_used) {
3622
+ var query = "";
3623
+ if (db_used) {
3624
+ switch (db_used) {
3625
+ case 'SQLITE':
3626
+ query = getAdapterTypesSQLite();
3627
+ break;
3628
+ case 'MYSQL':
3629
+ query = getAdapterTypesMySQL();
3630
+ break;
3631
+ }
3632
+ }
3633
+ return query;
3634
+ }
2479
3635
  //end get adapter types
2480
3636
 
2481
3637
  function getLaboratorioByIdSiteSQLite(id_site, id_place) {
@@ -2532,6 +3688,20 @@ function getLaboratorioByIdSiteMySQL(id_site, id_place) {
2532
3688
  query += "order by pl.Bancata asc, pl.num_pos desc ";
2533
3689
  return query;
2534
3690
  }
3691
+ function getLaboratorioByIdSite(db_used,id_site, id_place) {
3692
+ var query = "";
3693
+ if (db_used) {
3694
+ switch (db_used) {
3695
+ case 'SQLITE':
3696
+ query = getLaboratorioByIdSiteSQLite(id_site, id_place);
3697
+ break;
3698
+ case 'MYSQL':
3699
+ query = getLaboratorioByIdSiteMySQL(id_site, id_place);
3700
+ break;
3701
+ }
3702
+ }
3703
+ return query;
3704
+ }
2535
3705
  // Manage categories
2536
3706
  function getCategories() {
2537
3707
  var query = "select DISTINCT categoria from categorie_device ";
@@ -2548,6 +3718,22 @@ function assignCategoryFromDBMySQL(dev_type) {
2548
3718
  query += "where tipo = :dev_type";
2549
3719
  return query;
2550
3720
  }
3721
+
3722
+ function assignCategoryFromDB(db_used,dev_type) {
3723
+ var query = "";
3724
+ if (db_used) {
3725
+ switch (db_used) {
3726
+ case 'SQLITE':
3727
+ query = assignCategoryFromDBSQLite(dev_type);
3728
+ break;
3729
+ case 'MYSQL':
3730
+ query = assignCategoryFromDBMySQL(dev_type);
3731
+ break;
3732
+ }
3733
+ }
3734
+ return query;
3735
+ }
3736
+
2551
3737
  // end manage categories
2552
3738
  function getBeniConsumoByIdDeviceSQLite(id_device) {
2553
3739
  var query = "select Tipo, Marca, Modello from beniconsumo bc ";
@@ -2565,6 +3751,21 @@ function getBeniConsumoByIdDeviceMySQL(id_device) {
2565
3751
  return query;
2566
3752
  }
2567
3753
 
3754
+ function getBeniConsumoByIdDevice(db_used,id_device) {
3755
+ var query = "";
3756
+ if (db_used) {
3757
+ switch (db_used) {
3758
+ case 'SQLITE':
3759
+ query = getBeniConsumoByIdDeviceSQLite(id_device);
3760
+ break;
3761
+ case 'MYSQL':
3762
+ query = getBeniConsumoByIdDeviceMySQL(id_device);
3763
+ break;
3764
+ }
3765
+ }
3766
+ return query;
3767
+ }
3768
+
2568
3769
  //Manage dismissioni
2569
3770
  function selectDismissioniByYearSQLite(sel_year) {
2570
3771
  var query = "select id, data, descrizione from dismissioni ";
@@ -2641,6 +3842,7 @@ function insertDismissioneMySQL(data, descrizione, is_closed) {
2641
3842
  return query;
2642
3843
  }
2643
3844
 
3845
+
2644
3846
  function insertDismissione(db_used, data, descrizione, is_closed) {
2645
3847
  var query = "";
2646
3848
  if (db_used) {
@@ -3322,6 +4524,20 @@ function getCategoriesByIdDeviceMySQL(id_device) {
3322
4524
  query += "where d.id = :id_device";
3323
4525
  return query;
3324
4526
  }
4527
+ function getCategoriesByIdDevice(db_used,id_device) {
4528
+ var query = "";
4529
+ if (db_used) {
4530
+ switch (db_used) {
4531
+ case 'SQLITE':
4532
+ query = getCategoriesByIdDeviceSQLite(id_device);
4533
+ break;
4534
+ case 'MYSQL':
4535
+ query = getCategoriesByIdDeviceMySQL(id_device);
4536
+ break;
4537
+ }
4538
+ }
4539
+ return query;
4540
+ }
3325
4541
  //End Get Categories by IdDevice
3326
4542
  //Get details by type
3327
4543
  function queryDetailsByIdDeviceSQLite(id_device) {
@@ -3336,7 +4552,20 @@ function queryDetailsByIdDeviceMySQL(id_device) {
3336
4552
  query += "where d.id = :id_device";
3337
4553
  return query;
3338
4554
  }
3339
-
4555
+ function queryDetailsByIdDevice(db_used,id_device) {
4556
+ var query = "";
4557
+ if (db_used) {
4558
+ switch (db_used) {
4559
+ case 'SQLITE':
4560
+ query = queryDetailsByIdDeviceSQLite(id_device);
4561
+ break;
4562
+ case 'MYSQL':
4563
+ query = queryDetailsByIdDeviceMySQL(id_device);
4564
+ break;
4565
+ }
4566
+ }
4567
+ return query;
4568
+ }
3340
4569
  //End Get details by type
3341
4570
  // Define getConnectionSetById
3342
4571
  function getConnectionSetByIdSQLite(id_conn_set) {
@@ -3346,6 +4575,21 @@ function getConnectionSetByIdSQLite(id_conn_set) {
3346
4575
  }
3347
4576
  function getConnectionSetByIdMySQL(id_conn_set) {
3348
4577
 
4578
+ }
4579
+ function getConnectionSetById(db_used, id_conn_set) {
4580
+ var query = "";
4581
+ if (db_used) {
4582
+ switch (db_used) {
4583
+ case 'SQLITE':
4584
+ query = getConnectionSetByIdSQLite(id_conn_set);
4585
+ break;
4586
+ case 'MYSQL':
4587
+ query = getConnectionSetByIdMySQL(id_conn_set);
4588
+ break;
4589
+ }
4590
+ }
4591
+ return query;
4592
+
3349
4593
  }
3350
4594
  // End define getConnectionSetById
3351
4595
  // Define getConnectionByIdSet
@@ -3376,6 +4620,20 @@ function getConnectionByIdSetMySQL(id_set) {
3376
4620
  query += "left join connection_types ac2 on at.adapt_type_out = ac2.id ";
3377
4621
  query += "where id_set = :id_set";
3378
4622
  }
4623
+ function getConnectionByIdSet(db_used, id_set) {
4624
+ var query = "";
4625
+ if (db_used) {
4626
+ switch (db_used) {
4627
+ case 'SQLITE':
4628
+ query = getConnectionByIdSetSQLite(id_set);
4629
+ break;
4630
+ case 'MYSQL':
4631
+ query = getConnectionByIdSetMySQL(id_set);
4632
+ break;
4633
+ }
4634
+ }
4635
+ return query;
4636
+ }
3379
4637
  //End Define getConnectionByIdSet
3380
4638
  // Define updateConnectionSet
3381
4639
  function updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter) {
@@ -3397,6 +4655,20 @@ function updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapt
3397
4655
  }
3398
4656
  function updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter) {
3399
4657
 
4658
+ }
4659
+ function updateConnectionSet(db_used, id_set, id_conn_set, id_conn, verse, id_adapter) {
4660
+ var query = "";
4661
+ if (db_used) {
4662
+ switch (db_used) {
4663
+ case 'SQLITE':
4664
+ query = updateConnectionSetSQLite(id_set, id_conn_set, id_conn, verse, id_adapter);
4665
+ break;
4666
+ case 'MYSQL':
4667
+ query = updateConnectionSetMySQL(id_set, id_conn_set, id_conn, verse, id_adapter);
4668
+ break;
4669
+ }
4670
+ }
4671
+ return query;
3400
4672
  }
3401
4673
  // end define updateConnectionSet
3402
4674
  // Define insertConnectionSet
@@ -3410,6 +4682,20 @@ function insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter) {
3410
4682
  }
3411
4683
  function insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter) {
3412
4684
 
4685
+ }
4686
+ function insertConnectionSet(db_used, id_set, id_conn, verse, id_adapter) {
4687
+ var query = "";
4688
+ if (db_used) {
4689
+ switch (db_used) {
4690
+ case 'SQLITE':
4691
+ query = insertConnectionSetSQLite(id_set, id_conn, verse, id_adapter);
4692
+ break;
4693
+ case 'MYSQL':
4694
+ query = insertConnectionSetMySQL(id_set, id_conn, verse, id_adapter);
4695
+ break;
4696
+ }
4697
+ }
4698
+ return query;
3413
4699
  }
3414
4700
  // end define insertConnectionSet
3415
4701
  // Define removeConnectionSet
@@ -3422,6 +4708,21 @@ function removeConnectionSetSQLite(id_set, id_conn_set) {
3422
4708
  function removeConnectionSetMySQL(id_set, id_conn_set, id_conn, id_adapter, verse) {
3423
4709
 
3424
4710
  }
4711
+ function removeConnectionSet(db_used, id_set, id_conn_set) {
4712
+ var query = "";
4713
+ if (db_used) {
4714
+ switch (db_used) {
4715
+ case 'SQLITE':
4716
+ query = removeConnectionSetSQLite(id_set, id_conn_set);
4717
+ break;
4718
+ case 'MYSQL':
4719
+ query = removeConnectionSetMySQL(id_set, id_conn_set);
4720
+ break;
4721
+ }
4722
+ }
4723
+ return query;
4724
+ }
4725
+
3425
4726
  // end define removeConnectionSet
3426
4727
  // Code added here will be run once
3427
4728
  // whenever the node is started.
@@ -3453,6 +4754,20 @@ function getBeneConsumoUsatoMySQL(id_device, id_bene) {
3453
4754
  query += "where db.id_bene = :id_bene and db.id_device = :id_device";
3454
4755
  return query;
3455
4756
  }
4757
+ function getBeneConsumoUsato(db_used, id_device, id_bene) {
4758
+ var query = "";
4759
+ if (db_used) {
4760
+ switch (db_used) {
4761
+ case 'SQLITE':
4762
+ query = removeConnectionSetSQLite(id_device, id_bene);
4763
+ break;
4764
+ case 'MYSQL':
4765
+ query = removeConnectionSetMySQL(id_device, id_bene);
4766
+ break;
4767
+ }
4768
+ }
4769
+ return query;
4770
+ }
3456
4771
  //
3457
4772
  function getBeneConsumoByIdSQLite(id_bene) {
3458
4773
  var query = "select id, tipo, marca, modello, quantitativo from beniconsumo ";
@@ -3464,6 +4779,20 @@ function getBeneConsumoByIdMySQL(id_bene) {
3464
4779
  query += "where id :id_bene";
3465
4780
  return query;
3466
4781
  }
4782
+ function getBeneConsumoById(db_used, id_bene) {
4783
+ var query = "";
4784
+ if (db_used) {
4785
+ switch (db_used) {
4786
+ case 'SQLITE':
4787
+ query = getBeneConsumoByIdSQLite(id_bene);
4788
+ break;
4789
+ case 'MYSQL':
4790
+ query = getBeneConsumoByIdMySQL(id_bene);
4791
+ break;
4792
+ }
4793
+ }
4794
+ return query;
4795
+ }
3467
4796
  //
3468
4797
  function insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
3469
4798
  var query = "insert into device_beniconsumo (id_device, id_bene, numero) values ";
@@ -3475,6 +4804,20 @@ function insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
3475
4804
  query += "(:id_device, :id_bene, :numero)";
3476
4805
  return query;
3477
4806
  }
4807
+ function insertBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
4808
+ var query = "";
4809
+ if (db_used) {
4810
+ switch (db_used) {
4811
+ case 'SQLITE':
4812
+ query = insertBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
4813
+ break;
4814
+ case 'MYSQL':
4815
+ query = insertBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
4816
+ break;
4817
+ }
4818
+ }
4819
+ return query;
4820
+ }
3478
4821
  //
3479
4822
  function updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero) {
3480
4823
  var query = "update device_beniconsumo ";
@@ -3488,6 +4831,20 @@ function updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero) {
3488
4831
  query += "where id_device = :id_device and id_bene = :id_bene";
3489
4832
  return query;
3490
4833
  }
4834
+ function updateBeneConsumoAbbinato(db_used,id_device, id_bene, numero) {
4835
+ var query = "";
4836
+ if (db_used) {
4837
+ switch (db_used) {
4838
+ case 'SQLITE':
4839
+ query = updateBeneConsumoAbbinatoSQLite(id_device, id_bene, numero);
4840
+ break;
4841
+ case 'MYSQL':
4842
+ query = updateBeneConsumoAbbinatoMySQL(id_device, id_bene, numero);
4843
+ break;
4844
+ }
4845
+ }
4846
+ return query;
4847
+ }
3491
4848
  //
3492
4849
  function existBeneAbbinatoSQLite(id_device, id_bene) {
3493
4850
  var query = "select count(id_device) as numero from device_beniconsumo ";
@@ -3499,6 +4856,20 @@ function existBeneAbbinatoMySQL(id_device, id_bene) {
3499
4856
  query += "where id_device :id_device and id_bene = :id_bene";
3500
4857
  return query;
3501
4858
  }
4859
+ function existBeneAbbinato(db_used, id_device, id_bene) {
4860
+ var query = "";
4861
+ if (db_used) {
4862
+ switch (db_used) {
4863
+ case 'SQLITE':
4864
+ query = existBeneAbbinatoSQLite(id_device, id_bene);
4865
+ break;
4866
+ case 'MYSQL':
4867
+ query = existBeneAbbinatoMySQL(id_device, id_bene);
4868
+ break;
4869
+ }
4870
+ }
4871
+ return query;
4872
+ }
3502
4873
  // end of source
3503
4874
 
3504
4875
 
@@ -3858,7 +5229,20 @@ function removeDeviceSiteSQLite(id_site, id_place, id_device) {
3858
5229
  function removeDeviceSiteMySQL(id_site, id_place, id_device) {
3859
5230
 
3860
5231
  }
3861
-
5232
+ function removeDeviceSite(db_used,id_site, id_place, id_device) {
5233
+ var query = "";
5234
+ if (db_used) {
5235
+ switch (db_used) {
5236
+ case 'SQLITE':
5237
+ query = removeDeviceSiteSQLite(id_site, id_place, id_device);
5238
+ break;
5239
+ case 'MYSQL':
5240
+ query = removeDeviceSiteMySQL(id_site, id_place, id_device);
5241
+ break;
5242
+ }
5243
+ }
5244
+ return query;
5245
+ }
3862
5246
 
3863
5247
  function updateDeviceSiteSQLite(id_device) {
3864
5248
  var query = "update device_site set date_out = date('now','-1 day') ";
@@ -3870,6 +5254,20 @@ function updateDeviceSiteMySQL(id_device) {
3870
5254
  query += "where id_device = :id_device and date_in = (select max(date_in) from device_site where id_device = :id_device)";
3871
5255
  return query;
3872
5256
  }
5257
+ function updateDeviceSite(db_used,id_device) {
5258
+ var query = "";
5259
+ if (db_used) {
5260
+ switch (db_used) {
5261
+ case 'SQLITE':
5262
+ query = updateDeviceSiteSQLite(id_device);
5263
+ break;
5264
+ case 'MYSQL':
5265
+ query = updateDeviceSiteMySQL(id_device);
5266
+ break;
5267
+ }
5268
+ }
5269
+ return query;
5270
+ }
3873
5271
  // end manage updateDevicesSite
3874
5272
  // Manage insertDeviceSite
3875
5273
  function insertDeviceSiteSQLite(id_device, id_place, id_site, start_date) {
@@ -3904,6 +5302,20 @@ function insertDeviceSiteMySQL(id_device, id_place, id_site, start_date) {
3904
5302
  query += ")";
3905
5303
  return query;
3906
5304
  }
5305
+ function insertDeviceSite(db_used,id_device, id_place, id_site, start_date) {
5306
+ var query = "";
5307
+ if (db_used) {
5308
+ switch (db_used) {
5309
+ case 'SQLITE':
5310
+ query = insertDeviceSiteSQLite(id_device, id_place, id_site, start_date);
5311
+ break;
5312
+ case 'MYSQL':
5313
+ query = insertDeviceSiteMySQL(id_device, id_place, id_site, start_date);
5314
+ break;
5315
+ }
5316
+ }
5317
+ return query;
5318
+ }
3907
5319
  // end manage updateDevicesSite
3908
5320
  //Get Sites for Combo
3909
5321
  function getSitesSelectComboSQLite(id_place, tipo_aula) {
@@ -3947,7 +5359,20 @@ function getSitesSelectComboMySQL(id_place, tipo_aula) {
3947
5359
  query += "order by p.name, s.floor, sd.name ";
3948
5360
  return query;
3949
5361
  }
3950
-
5362
+ function getSitesSelectCombo(db_used,id_place, tipo_aula) {
5363
+ var query = "";
5364
+ if (db_used) {
5365
+ switch (db_used) {
5366
+ case 'SQLITE':
5367
+ query = getSitesSelectComboSQLite(id_place, tipo_aula);
5368
+ break;
5369
+ case 'MYSQL':
5370
+ query = getSitesSelectComboMySQL(id_place, tipo_aula);
5371
+ break;
5372
+ }
5373
+ }
5374
+ return query;
5375
+ }
3951
5376
  //End get sites for combo
3952
5377
  //Get Sites by Id
3953
5378
  function getSiteByIdSQLite(id_site) {
@@ -3967,7 +5392,20 @@ function getSiteByIdMySQL(id_site) {
3967
5392
  query += "and s.id = :id_site";
3968
5393
  return query;
3969
5394
  }
3970
-
5395
+ function getSiteById(db_used,id_site) {
5396
+ var query = "";
5397
+ if (db_used) {
5398
+ switch (db_used) {
5399
+ case 'SQLITE':
5400
+ query = getSiteByIdSQLite(id_site);
5401
+ break;
5402
+ case 'MYSQL':
5403
+ query = getSiteByIdMySQL(id_site);
5404
+ break;
5405
+ }
5406
+ }
5407
+ return query;
5408
+ }
3971
5409
  //End get site by id
3972
5410
  // Get Labs from Place
3973
5411
  function querySitesLabSQLite(id_place) {
@@ -3983,7 +5421,20 @@ function querySitesLabMySQL(id_place) {
3983
5421
  query += "where s.id_place = :id_place ";
3984
5422
  query += "and s.id in (select id_site from postazione_lab where id_place = :id_place) ";
3985
5423
  }
3986
-
5424
+ function querySitesLab(db_used,id_place) {
5425
+ var query = "";
5426
+ if (db_used) {
5427
+ switch (db_used) {
5428
+ case 'SQLITE':
5429
+ query = querySitesLabSQLite(id_place);
5430
+ break;
5431
+ case 'MYSQL':
5432
+ query = querySitesLabMySQL(id_place);
5433
+ break;
5434
+ }
5435
+ }
5436
+ return query;
5437
+ }
3987
5438
  //end get labs from place
3988
5439
  //Define removeSiteBySet
3989
5440
  function removeSiteBySetSQLite(id_device) {
@@ -4004,6 +5455,20 @@ function removeSiteBySetMySQL(id_device) {
4004
5455
  query += ")";
4005
5456
  return query;
4006
5457
  }
5458
+ function removeSiteBySet(db_used, id_device) {
5459
+ var query = "";
5460
+ if (db_used) {
5461
+ switch (db_used) {
5462
+ case 'SQLITE':
5463
+ query = removeSiteBySetSQLite(id_device);
5464
+ break;
5465
+ case 'MYSQL':
5466
+ query = emoveSiteBySetMySQL(id_device);
5467
+ break;
5468
+ }
5469
+ }
5470
+ return query;
5471
+ }
4007
5472
  //End define removeSiteBySet
4008
5473
 
4009
5474
  // Define updateSiteBySet
@@ -4020,6 +5485,20 @@ function updateSiteBySetMySQL(id_device) {
4020
5485
  query += "where dt.id_maindevice = :id_device)";
4021
5486
  return query;
4022
5487
  }
5488
+ function updateSiteBySet(db_used,id_device) {
5489
+ var query = "";
5490
+ if (db_used) {
5491
+ switch (db_used) {
5492
+ case 'SQLITE':
5493
+ query = updateSiteBySetSQLite(id_device);
5494
+ break;
5495
+ case 'MYSQL':
5496
+ query = updateSiteBySetMySQL(id_device);
5497
+ break;
5498
+ }
5499
+ }
5500
+ return query;
5501
+ }
4023
5502
  // End define updateSiteBySet
4024
5503
  // Define insertSiteBySet
4025
5504
  function insertSiteBySetSQLite(id_device) {
@@ -4038,6 +5517,20 @@ function insertSiteBySetMySQL(id_device) {
4038
5517
  query += "where ds.id_maindevice = :id_device";
4039
5518
  return query;
4040
5519
  }
5520
+ function insertSiteBySet(db_used,id_device) {
5521
+ var query = "";
5522
+ if (db_used) {
5523
+ switch (db_used) {
5524
+ case 'SQLITE':
5525
+ query = insertSiteBySetSQLite(id_device);
5526
+ break;
5527
+ case 'MYSQL':
5528
+ query = insertSiteBySetMySQL(id_device);
5529
+ break;
5530
+ }
5531
+ }
5532
+ return query;
5533
+ }
4041
5534
  //End define insertSiteBySet
4042
5535
  // Define insertSiteBySet
4043
5536
  function insertSiteBySetParamSQLite(id_device, id_site, id_place, start_date) {
@@ -4054,6 +5547,20 @@ function insertSiteBySetParamMySQL(id_device) {
4054
5547
  query += "where ds.id_maindevice = :id_device";
4055
5548
  return query;
4056
5549
  }
5550
+ function insertSiteBySetParam(db_used,id_device) {
5551
+ var query = "";
5552
+ if (db_used) {
5553
+ switch (db_used) {
5554
+ case 'SQLITE':
5555
+ query = insertSiteBySetParamSQLite(id_device);
5556
+ break;
5557
+ case 'MYSQL':
5558
+ query = insertSiteBySetParamMySQL(id_device);
5559
+ break;
5560
+ }
5561
+ }
5562
+ return query;
5563
+ }
4057
5564
  //End define insertSiteBySetParam
4058
5565
  //Define getDeviceAsSite
4059
5566
  function getDeviceAsSiteSQLite(id_device) {
@@ -4066,6 +5573,20 @@ function getDeviceAsSiteMySQL(id_device) {
4066
5573
  query += "where das.id_device = :id_device";
4067
5574
  return query;
4068
5575
  }
5576
+ function getDeviceAsSite(db_used,id_device) {
5577
+ var query = "";
5578
+ if (db_used) {
5579
+ switch (db_used) {
5580
+ case 'SQLITE':
5581
+ query = getDeviceAsSiteSQLite(id_device);
5582
+ break;
5583
+ case 'MYSQL':
5584
+ query = getDeviceAsSiteMySQL(id_device);
5585
+ break;
5586
+ }
5587
+ }
5588
+ return query;
5589
+ }
4069
5590
  //End define getDeviceAsSite
4070
5591
  // Define getLastSiteForDevice
4071
5592
  function getLastSiteForDeviceSQLite(id_device) {
@@ -4080,6 +5601,20 @@ function getLastSiteForDeviceMySQL(id_device) {
4080
5601
  query += "and CURDATE() >= ds.date_in and CURDATE() <= ds.date_out";
4081
5602
  return query;
4082
5603
  }
5604
+ function getLastSiteForDevice(db_used,id_device) {
5605
+ var query = "";
5606
+ if (db_used) {
5607
+ switch (db_used) {
5608
+ case 'SQLITE':
5609
+ query = getLastSiteForDeviceSQLite(id_device);
5610
+ break;
5611
+ case 'MYSQL':
5612
+ query = getLastSiteForDeviceMySQL(id_device);
5613
+ break;
5614
+ }
5615
+ }
5616
+ return query;
5617
+ }
4083
5618
  // End define getLastSiteForDevice
4084
5619
 
4085
5620
 
@@ -4110,6 +5645,20 @@ function queryStatisticMySQL(list_types) {
4110
5645
  query += "group by Tipo";
4111
5646
  return query;
4112
5647
  }
5648
+ function queryStatistic(db_used,list_types) {
5649
+ var query = "";
5650
+ if (db_used) {
5651
+ switch (db_used) {
5652
+ case 'SQLITE':
5653
+ query = queryStatisticSQLite(list_types);
5654
+ break;
5655
+ case 'MYSQL':
5656
+ query = queryStatisticMySQL(list_types);
5657
+ break;
5658
+ }
5659
+ }
5660
+ return query;
5661
+ }
4113
5662
  //End Get Devices for Statistics
4114
5663
  //Get Inventary for Statistics
4115
5664
  function queryStatisticInventarySQLite() {
@@ -4122,6 +5671,20 @@ function queryStatisticInventaryMySQL() {
4122
5671
  query += "where (is_removed is null or is_removed = 0) ";
4123
5672
  return query;
4124
5673
  }
5674
+ function queryStatisticInventary(db_used) {
5675
+ var query = "";
5676
+ if (db_used) {
5677
+ switch (db_used) {
5678
+ case 'SQLITE':
5679
+ query = queryStatisticInventarySQLite();
5680
+ break;
5681
+ case 'MYSQL':
5682
+ query = queryStatisticInventaryMySQL();
5683
+ break;
5684
+ }
5685
+ }
5686
+ return query;
5687
+ }
4125
5688
  //End Get Inventary for Statistics
4126
5689
  //Get Devices Statistics bt Status
4127
5690
  function queryStatisticsDeviceStatusSQLite() {
@@ -4135,6 +5698,20 @@ function queryStatisticsDeviceStatusSQLite() {
4135
5698
  }
4136
5699
  function queryStatisticsDeviceStatusMySQL() {
4137
5700
  }
5701
+ function queryStatisticsDeviceStatus(db_used) {
5702
+ var query = "";
5703
+ if (db_used) {
5704
+ switch (db_used) {
5705
+ case 'SQLITE':
5706
+ query = queryStatisticsDeviceStatusSQLite();
5707
+ break;
5708
+ case 'MYSQL':
5709
+ query = queryStatisticsDeviceStatusMySQL();
5710
+ break;
5711
+ }
5712
+ }
5713
+ return query;
5714
+ }
4138
5715
 
4139
5716
  function tokenizer(marker, input, marker2) {
4140
5717
  var retValue = "";
@@ -4340,9 +5917,6 @@ function getDevicesInUse(db_used) {
4340
5917
  break;
4341
5918
  }
4342
5919
  }
4343
- else {
4344
- query = getDevicesInUseSQLite();
4345
- }
4346
5920
  return query;
4347
5921
  }
4348
5922
 
@@ -4380,9 +5954,6 @@ function getDevicesInUseByPlaces(db_used) {
4380
5954
  break;
4381
5955
  }
4382
5956
  }
4383
- else {
4384
- query = getDevicesInUseByPlacesSQLite();
4385
- }
4386
5957
  return query;
4387
5958
  }
4388
5959
 
@@ -4398,6 +5969,22 @@ function getDatiAcquistoDeviceMySQL(id_device) {
4398
5969
  return query;
4399
5970
  }
4400
5971
 
5972
+ function getDatiAcquistoDevice(db_used,id_device) {
5973
+ var query = "";
5974
+ if (db_used) {
5975
+ switch (db_used) {
5976
+ case 'SQLITE':
5977
+ query = getDatiAcquistoDeviceSQLite(id_device);
5978
+ break;
5979
+ case 'MYSQL':
5980
+ query = getDatiAcquistoDeviceMySQL(id_device);
5981
+ break;
5982
+ }
5983
+ }
5984
+ return query;
5985
+ }
5986
+
5987
+
4401
5988
  //End reports
4402
5989
  function getPackageJsVersion() {
4403
5990
  var pjson = require('../package.json');
@@ -4408,162 +5995,90 @@ function getPackageJsVersion() {
4408
5995
  module.exports = {
4409
5996
  getDevicesInUse,
4410
5997
  getDevicesInUseByPlaces,
4411
- getDevicesAllocatedComboSQLite,
4412
- getDevicesAllocatedComboMySQL,
4413
- getDevicesNotAllocatedComboSQLite,
4414
- getDevicesNotAllocatedComboMySQL,
5998
+ getDevicesAllocatedCombo,
5999
+ getDevicesNotAllocatedCombo,
4415
6000
  queryDeviceTypes,
4416
6001
  queryDeviceManifactures,
4417
- getDevicesSelectByRelatedSQLite,
4418
- getDevicesSelectByRelatedMySQL,
4419
- getDevicesSelectSQLite,
4420
- getDevicesSelectMySQL,
4421
- getDevicesSelectBySiteSQLite,
4422
- getDevicesSelectBySiteMySQL,
4423
- queryDeviceByIdSQLite,
4424
- queryDeviceByIdMySQL,
4425
- queryDeviceByIdentificativoSQLite,
4426
- queryDeviceByIdentificativoMySQL,
4427
- getDevicesCounterBySiteSQLite,
4428
- getDevicesCounterBySiteMySQL,
4429
- getDevicesCounterByPlaceSQLite,
4430
- getDevicesCounterByPlaceMySQL,
4431
- queryDeviceStatusSQLite,
4432
- queryDeviceStatusMySQL,
4433
- updateDeviceStatusSQLite,
4434
- updateDeviceStatusMySQL,
4435
- insertDeviceStatusSQLite,
4436
- insertDeviceStatusMySQL,
4437
- getDevicesSelectByPlaceSQLite,
4438
- getDevicesSelectByPlaceMySQL,
4439
- queryLastDeviceIdSQLite,
4440
- queryLastDeviceIdMySQL,
6002
+ getDevicesSelectByRelated,
6003
+ getDevicesSelect,
6004
+ getDevicesSelectBySite,
6005
+ queryDeviceById,
6006
+ queryDeviceByIdentificativo,
6007
+ getDevicesCounterBySite,
6008
+ getDevicesCounterByPlace,
6009
+ queryDeviceStatus,
6010
+ updateDeviceStatus,
6011
+ insertDeviceStatus,
6012
+ getDevicesSelectByPlace,
6013
+ queryLastDeviceId,
4441
6014
  queryOSList,
4442
- getDevicesSelectComboSQLite,
4443
- getDevicesSelectComboMySQL,
4444
- getDevicesSelectBySiteComboSQLite,
4445
- getDevicesSelectBySiteComboMySQL,
4446
- getDevicesWithPropertiesSQLite,
4447
- getDevicesWithPropertiesMySQL,
4448
- getBeniAcquisitiSQLite,
4449
- getBeniAcquisitiMySQL,
4450
- getNetworksOnDeviceSQLite,
4451
- getNetworksOnDeviceMySQL,
4452
- getImportedPropertiesByIdDeviceSQLite,
4453
- getImportedPropertiesByIdDeviceMySQL,
4454
- getSetInfoByIdSetSQLite,
4455
- getSetInfoByIdSetMySQL,
4456
- getSetInfoByIdDeviceSQLite,
4457
- getSetInfoByIdDeviceMySQL,
4458
- insertSetInfoSQLite,
4459
- insertSetInfoMySQL,
4460
- insertSetInfoInverseSQLite,
4461
- insertSetInfoInverseMySQL,
4462
- removeSetInfoSQLite,
4463
- removeSetInfoMySQL,
4464
- updateSetInfoSQLite,
4465
- updateSetInfoMySQL,
6015
+ getDevicesSelectCombo,
6016
+ getDevicesSelectBySiteCombo,
6017
+ getDevicesWithProperties,
6018
+ getBeniAcquisiti,
6019
+ getNetworksOnDevice,
6020
+ getImportedPropertiesByIdDevice,
6021
+ getSetInfoByIdSet,
6022
+ getSetInfoByIdDevice,
6023
+ insertSetInfo,
6024
+ insertSetInfoInverse,
6025
+ removeSetInfo,
6026
+ updateSetInfo,
4466
6027
  setInfoObj,
4467
- selectSetsByIdDeviceSQLite,
4468
- selectSetsByIdDeviceMySQL,
4469
- insertDeviceSQLite,
4470
- insertDeviceMySQL,
4471
- updateDeviceSQLite,
4472
- updateDeviceMySQL,
4473
- removeDeviceSQLite,
4474
- removeDeviceMySQL,
6028
+ selectSetsByIdDevice,
6029
+ insertDevice,
6030
+ updateDevice,
6031
+ removeDevice,
4475
6032
  getDeviceMySQLPayload,
4476
- writeDevicePropertiesSQLite,
4477
- writeDevicePropertiesMySQL,
4478
- readDevicePropertiesSQLite,
4479
- readDevicePropertiesMySQL,
4480
- existsPCPropertiesSQLite,
4481
- existsPCPropertiesMySQL,
4482
- getPCPropertiesSQLite,
4483
- getPCPropertiesMySQL,
6033
+ writeDeviceProperties,
6034
+ readDeviceProperties,
6035
+ existsPCProperties,
6036
+ getPCProperties,
4484
6037
  createPCPropertiesMySQLObj,
4485
- insertPCPropertiesSQLite,
4486
- insertPCPropertiesMySQL,
4487
- updatePCPropertiesSQLite,
4488
- updatePCPropertiesMySQL,
4489
- existsDisplayPropertiesSQLite,
4490
- existsDisplayPropertiesMySQL,
4491
- getDisplayPropertiesSQLite,
4492
- getDisplayPropertiesMySQL,
6038
+ insertPCProperties,
6039
+ updatePCProperties,
6040
+ existsDisplayProperties,
6041
+ getDisplayProperties,
4493
6042
  createDisplayPropertiesMySQLObj,
4494
- insertDisplayPropertiesSQLite,
4495
- insertDisplayPropertiesMySQL,
4496
- updateDisplayPropertiesSQLite,
4497
- updateDisplayPropertiesMySQL,
4498
- getDisplayPartPropertiesSQLite,
4499
- getDisplayPartPropertiesMySQL,
4500
- getConnectorsByIdDeviceSQLite,
4501
- getConnectorsByIdDeviceMySQL,
4502
- getConnectorByIdSQLite,
4503
- getConnectorByIdMySQL,
4504
- insertConnectorSQLite,
4505
- insertConnectorMySQL,
4506
- updateConnectorSQLite,
4507
- updateConnectorMySQL,
4508
- removeConnectorSQLite,
4509
- removeConnectorMySQL,
4510
- getStorageByIdDeviceSQLite,
4511
- getStorageByIdDeviceMySQL,
4512
- getStorageByIdSQLite,
4513
- getStorageByIdMySQL,
4514
- insertStorageSQLite,
4515
- insertStorageMySQL,
4516
- updateStorageSQLite,
4517
- updateStorageMySQL,
4518
- removeStorageSQLite,
4519
- removeStorageMySQL,
4520
- getNetworkByIdDeviceSQLite,
4521
- getNetworkByIdDeviceMySQL,
4522
- getNetworkByIdSQLite,
4523
- getNetworkByIdMySQL,
4524
- insertNetworkSQLite,
4525
- insertNetworkMySQL,
4526
- updateNetworkSQLite,
4527
- updateNetworkMySQL,
4528
- removeNetworkSQLite,
4529
- removeNetworkMySQL,
4530
- getAddOnByIdDeviceSQLite,
4531
- getAddOnByIdDeviceMySQL,
4532
- getAddOnByIdSQLite,
4533
- getAddOnByIdMySQL,
4534
- insertAddOnSQLite,
4535
- insertAddOnMySQL,
4536
- updateAddOnSQLite,
4537
- updateAddOnMySQL,
4538
- removeAddOnSQLite,
4539
- removeAddOnMySQL,
6043
+ insertDisplayProperties,
6044
+ updateDisplayProperties,
6045
+ getDisplayPartProperties,
6046
+ getConnectorsByIdDevice,
6047
+ getConnectorById,
6048
+ insertConnector,
6049
+ updateConnector,
6050
+ removeConnector,
6051
+ getStorageByIdDevice,
6052
+ getStorageById,
6053
+ insertStorage,
6054
+ updateStorage,
6055
+ removeStorage,
6056
+ getNetworkByIdDevice,
6057
+ getNetworkById,
6058
+ insertNetwork,
6059
+ updateNetwork,
6060
+ removeNetwork,
6061
+ getAddOnByIdDevice,
6062
+ getAddOnById,
6063
+ insertAddOn,
6064
+ updateAddOn,
6065
+ removeAddOn,
4540
6066
  selectBeneDaInventario,
4541
6067
  getDevicesSelectForInventarioRaw,
4542
6068
  getDevicesSelectForInventarioRawById,
4543
6069
  getBeniConsumo,
4544
6070
  getBeniConsumoNotNull,
4545
- getBeneConsumoUsatoSQLite,
4546
- getBeneConsumoUsatoMySQL,
4547
- getBeneConsumoByIdSQLite,
4548
- getBeneConsumoByIdMySQL,
4549
- existBeneAbbinatoSQLite,
4550
- existBeneAbbinatoMySQL,
4551
- insertBeneConsumoAbbinatoSQLite,
4552
- insertBeneConsumoAbbinatoMySQL,
4553
- updateBeneConsumoAbbinatoSQLite,
4554
- updateBeneConsumoAbbinatoMySQL,
4555
- insertConnectionSetSQLite,
4556
- insertConnectionSetMySQL,
4557
- updateConnectionSetSQLite,
4558
- updateConnectionSetMySQL,
4559
- removeConnectionSetSQLite,
4560
- removeConnectionSetMySQL,
4561
- getConnectionByIdSetSQLite,
4562
- getConnectionByIdSetMySQL,
4563
- getConnectionSetByIdSQLite,
4564
- getConnectionSetByIdMySQL,
4565
- queryDetailsByIdDeviceSQLite,
4566
- queryDetailsByIdDeviceMySQL,
6071
+ getBeneConsumoUsato,
6072
+ getBeneConsumoById,
6073
+ existBeneAbbinato,
6074
+ insertBeneConsumoAbbinato,
6075
+ updateBeneConsumoAbbinato,
6076
+ insertConnectionSet,
6077
+ updateConnectionSet,
6078
+ removeConnectionSet,
6079
+ getConnectionByIdSet,
6080
+ getConnectionSetById,
6081
+ queryDetailsByIdDevice,
4567
6082
  //
4568
6083
  queryDocumentsIdDevice,
4569
6084
  selectDocumentoById,
@@ -4592,85 +6107,51 @@ module.exports = {
4592
6107
  removeDismissioneDeviceFromDismissione,
4593
6108
  queryLastDismissioneId,
4594
6109
  //
4595
- assignCategoryFromDBSQLite,
4596
- assignCategoryFromDBMySQL,
4597
- getBeniConsumoByIdDeviceSQLite,
4598
- getBeniConsumoByIdDeviceMySQL,
4599
- queryConsegneByIdDeviceSQLite,
4600
- queryConsegneByIdDeviceMySQL,
6110
+ assignCategoryFromDB,
6111
+ getBeniConsumoByIdDevice,
6112
+ queryConsegneByIdDevice,
4601
6113
  queryFornitoriGestoriCombo,
4602
- queryCloseGestioneDeviceSQLite,
4603
- queryCloseGestioneDeviceMySQL,
4604
- queryInsertGestioneDeviceSQLite,
4605
- queryInsertGestioneDeviceMySQL,
4606
- querySelectExistsGestioneDeviceByIdsSQLite,
4607
- querySelectExistsGestioneDeviceByIdsMySQL,
4608
- querySelectGestioniDeviceByIdDeviceSQLite,
4609
- querySelectGestioniDeviceByIdDeviceMySQL,
4610
- queryConsegneSQLite,
4611
- queryConsegneMySQL,
4612
- queryConsegnaByIdSQLite,
4613
- queryConsegnaByIdMySQL,
6114
+ queryCloseGestioneDevice,
6115
+ queryInsertGestioneDevice,
6116
+ querySelectExistsGestioneDeviceByIds,
6117
+ querySelectGestioniDeviceByIdDevice,
6118
+ queryConsegne,
6119
+ queryConsegnaById,
4614
6120
  queryDeviceStatusCombo,
4615
6121
  queryUsers,
4616
6122
  queryFunctions,
4617
6123
  queryAllFunctions,
4618
- queryInterventoByIdSQLite,
4619
- queryInterventoByIdMySQL,
4620
- insertDeviceInterventoSQLite,
4621
- insertDeviceInterventoMySQL,
4622
- updateDeviceInterventoSQLite,
4623
- updateDeviceInterventoMySQL,
4624
- removeDeviceInterventoSQLite,
4625
- removeDeviceInterventoMySQL,
4626
- getConnectionTypesSQLite,
4627
- getConnectionTypesMySQL,
4628
- getConnectionProtocolsSQLite,
4629
- getConnectionProtocolsMySQL,
4630
- getAdapterTypesSQLite,
4631
- getAdapterTypesMySQL,
4632
- getStorageTypesSQLite,
4633
- getStorageTypesMySQL,
4634
- getLaboratorioByIdSiteSQLite,
4635
- getLaboratorioByIdSiteMySQL,
6124
+ queryInterventoById,
6125
+ insertDeviceIntervento,
6126
+ updateDeviceIntervento,
6127
+ removeDeviceIntervento,
6128
+ //
6129
+ getConnectionTypes,
6130
+ getConnectionProtocols,
6131
+ getAdapterTypes,
6132
+ getStorageTypes,
6133
+ getLaboratorioByIdSite,
4636
6134
  getCategories,
4637
- getCategoriesByIdDeviceSQLite,
4638
- getCategoriesByIdDeviceMySQL,
6135
+ getCategoriesByIdDevice,
4639
6136
  createConsegnaMySQLObj,
4640
- insertConsegnaSQLite,
4641
- insertConsegnaMySQL,
4642
- updateConsegnaSQLite,
4643
- updateConsegnaMySQL,
4644
- removeConsegnaSQLite,
4645
- removeConsegnaMySQL,
4646
- queryLastConsegnaIdSQLite,
4647
- queryLastConsegnaIdMySQL,
6137
+ insertConsegna,
6138
+ updateConsegna,
6139
+ removeConsegna,
6140
+ queryLastConsegnaId,
4648
6141
  //
4649
- removeSiteBySetSQLite,
4650
- removeSiteBySetMySQL,
4651
- updateSiteBySetSQLite,
4652
- updateSiteBySetMySQL,
4653
- insertSiteBySetSQLite,
4654
- insertSiteBySetMySQL,
4655
- insertSiteBySetParamSQLite,
4656
- insertSiteBySetParamMySQL,
4657
- getDeviceAsSiteSQLite,
4658
- getDeviceAsSiteMySQL,
4659
- getLastSiteForDeviceSQLite,
4660
- getLastSiteForDeviceMySQL,
4661
- querySitesLabSQLite,
4662
- querySitesLabMySQL,
4663
- getSiteByIdSQLite,
4664
- getSiteByIdMySQL,
4665
- getSitesSelectComboSQLite,
4666
- getSitesSelectComboMySQL,
6142
+ removeSiteBySet,
6143
+ updateSiteBySet,
6144
+ insertSiteBySet,
6145
+ insertSiteBySetParam,
6146
+ getDeviceAsSite,
6147
+ getLastSiteForDevice,
6148
+ querySitesLab,
6149
+ getSiteById,
6150
+ getSitesSelectCombo,
4667
6151
  verifyPrevDeviceSite,
4668
- insertDeviceSiteSQLite,
4669
- insertDeviceSiteMySQL,
4670
- updateDeviceSiteSQLite,
4671
- updateDeviceSiteMySQL,
4672
- removeDeviceSiteSQLite,
4673
- removeDeviceSiteMySQL,
6152
+ insertDeviceSite,
6153
+ updateDeviceSite,
6154
+ removeDeviceSite,
4674
6155
  queryPlaces,
4675
6156
  queryFloorsByPlace,
4676
6157
  queryFunzioneByPlaceAndFloor,
@@ -4680,17 +6161,13 @@ module.exports = {
4680
6161
  querySitesWithDefaults,
4681
6162
  getPorteByIdSite,
4682
6163
  //
4683
- queryStatisticSQLite,
4684
- queryStatisticMySQL,
4685
- queryStatisticInventarySQLite,
4686
- queryStatisticInventaryMySQL,
4687
- queryStatisticsDeviceStatusSQLite,
4688
- queryStatisticsDeviceStatusMySQL,
6164
+ queryStatistic,
6165
+ queryStatisticInventary,
6166
+ queryStatisticsDeviceStatus,
4689
6167
  getPropertiesFromBLOB,
4690
6168
  getOpSystemFromBLOB,
4691
6169
  getAllPropertiesFromBLOB,
4692
- getDatiAcquistoDeviceSQLite,
4693
- getDatiAcquistoDeviceMySQL,
6170
+ getDatiAcquistoDevice,
4694
6171
  getPackageJsVersion
4695
6172
  };
4696
6173
  // end of source