alsmanager_lib 1.0.78 → 1.0.79

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 +100 -0
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -218,6 +218,39 @@ function getStorageComboByIdDevice(db_used, id_device, id_exclude) {
218
218
  return query;
219
219
  }
220
220
 
221
+
222
+ function getStorageByIdPartAndIdConfSQLite(id_storage, id_conf) {
223
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
224
+ query += "where part_type = 'STORAGE' ";
225
+ query += "and id_conf = " + id_conf + " ";
226
+ query += "and id_storage = " + id_storage;
227
+ return query;
228
+ }
229
+
230
+ function getStorageByIdPartAndIdConfMySQL(id_storage, id_conf) {
231
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
232
+ query += "where part_type = 'STORAGE' ";
233
+ query += "and id_conf = :id_conf ";
234
+ query += "and id_storage = :id_storage";
235
+ return query;
236
+ }
237
+
238
+ function getStorageByIdPartAndIdConf(db_used, id_storage, id_conf) {
239
+ var query = "";
240
+ if (db_used) {
241
+ switch (db_used) {
242
+ case 'SQLITE':
243
+ query = getStorageByIdPartAndIdConfSQLite(id_storage, id_conf);
244
+ break;
245
+ case 'MYSQL':
246
+ query = getStorageByIdPartAndIdConfMySQL(id_storage, id_conf);
247
+ break;
248
+ }
249
+ }
250
+ return query;
251
+ }
252
+
253
+
221
254
  function getStorageByIdSQLite(id_storage) {
222
255
  var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model from device_storages ";
223
256
  query += "where id = " + id_storage;
@@ -445,6 +478,38 @@ function getNetworkComboByIdDevice(db_used, id_device, id_exclude) {
445
478
  return query;
446
479
  }
447
480
 
481
+ function getNetworkByIdPartAndIdConfSQLite(id_network, id_conf) {
482
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
483
+ query += "where part_type = 'NETWORK' ";
484
+ query += "and id_conf = " + id_conf + " ";
485
+ query += "and id_storage = " + id_network;
486
+ return query;
487
+ }
488
+
489
+ function getNetworkByIdPartAndIdConfMySQL(id_network, id_conf) {
490
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
491
+ query += "where part_type = 'NETWORK' ";
492
+ query += "and id_conf = :id_conf ";
493
+ query += "and id_storage = :id_network";
494
+ return query;
495
+ }
496
+
497
+ function getNetworkByIdPartAndIdConf(db_used, id_network, id_conf) {
498
+ var query = "";
499
+ if (db_used) {
500
+ switch (db_used) {
501
+ case 'SQLITE':
502
+ query = getNetworkByIdPartAndIdConfSQLite(id_network, id_conf);
503
+ break;
504
+ case 'MYSQL':
505
+ query = getNetworkByIdPartAndIdConfMySQL(id_network, id_conf);
506
+ break;
507
+ }
508
+ }
509
+ return query;
510
+ }
511
+
512
+
448
513
  function getNetworkByIdSQLite(id_network) {
449
514
  var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
450
515
  query += "where id = " + id_network;
@@ -680,6 +745,37 @@ function getAddOnComboByIdDevice(db_used, id_device, id_exclude) {
680
745
  return query;
681
746
  }
682
747
 
748
+ function getAddOnByIdPartAndIdConfSQLite(id_addon, id_conf) {
749
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
750
+ query += "where part_type = 'ADDON' ";
751
+ query += "and id_conf = " + id_conf + " ";
752
+ query += "and id_storage = " + id_addon;
753
+ return query;
754
+ }
755
+
756
+ function getAddOnByIdPartAndIdConfMySQL(id_addon, id_conf) {
757
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
758
+ query += "where part_type = 'ADDON' ";
759
+ query += "and id_conf = :id_conf ";
760
+ query += "and id_storage = :id_addon";
761
+ return query;
762
+ }
763
+
764
+ function getAddOnByIdPartAndIdConf(db_used, id_addon, id_conf) {
765
+ var query = "";
766
+ if (db_used) {
767
+ switch (db_used) {
768
+ case 'SQLITE':
769
+ query = getAddOnByIdPartAndIdConfSQLite(id_addon, id_conf);
770
+ break;
771
+ case 'MYSQL':
772
+ query = getAddOnByIdPartAndIdConfMySQL(id_addon, id_conf);
773
+ break;
774
+ }
775
+ }
776
+ return query;
777
+ }
778
+
683
779
  function getAddOnByIdSQLite(id_addon) {
684
780
  var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
685
781
  query += "where id = " + id_addon;
@@ -8388,6 +8484,7 @@ module.exports = {
8388
8484
  existsDisplayPartProperties,
8389
8485
  insertDisplayPartProperties,
8390
8486
  updateDisplayPartProperties,
8487
+ //
8391
8488
  getConnectorsByIdDevice,
8392
8489
  getConnectorById,
8393
8490
  createConnectorObjMySQL,
@@ -8396,6 +8493,7 @@ module.exports = {
8396
8493
  removeConnector,
8397
8494
  getStorageByIdDevice,
8398
8495
  getStorageComboByIdDevice,
8496
+ getStorageByIdPartAndIdConf,
8399
8497
  getStorageById,
8400
8498
  createStorageObjMySQL,
8401
8499
  insertStorage,
@@ -8404,6 +8502,7 @@ module.exports = {
8404
8502
  getStoragesByConfig,
8405
8503
  getNetworkByIdDevice,
8406
8504
  getNetworkComboByIdDevice,
8505
+ getNetworkByIdPartAndIdConf,
8407
8506
  getNetworkById,
8408
8507
  createNetworkObjMySQL,
8409
8508
  insertNetwork,
@@ -8413,6 +8512,7 @@ module.exports = {
8413
8512
  getAddOnTypes,
8414
8513
  getAddOnByIdDevice,
8415
8514
  getAddOnComboByIdDevice,
8515
+ getAddOnByIdPartAndIdConf,
8416
8516
  getAddOnById,
8417
8517
  createAddOnObjMySQL,
8418
8518
  insertAddOn,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.78",
3
+ "version": "1.0.79",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",