alsmanager_lib 3.0.100 → 3.0.102

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 +45 -4
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -11365,14 +11365,16 @@ function querySitesWithDefaults(db_used, def_values) {
11365
11365
  }
11366
11366
 
11367
11367
  function getPorteByIdSiteSQLite(id_site) {
11368
- var query = "select port_type as Tipo, port_sign as Porta, note as Note from site_ports sp ";
11369
- query += "where sp.id_site = " + id_site;
11368
+ var query = "select id, port_type as Tipo, port_sign as Porta, note as Note from site_ports sp ";
11369
+ query += "where sp.id_site = " + id_site + " ";
11370
+ query += "order by port_type, port_sign";
11370
11371
  return query;
11371
11372
  }
11372
11373
 
11373
11374
  function getPorteByIdSiteMySQL(id_site) {
11374
- var query = "select port_type as Tipo, port_sign as Porta, note as Note from site_ports sp ";
11375
- query += "where sp.id_site = :id_site";
11375
+ var query = "select id, port_type as Tipo, port_sign as Porta, note as Note from site_ports sp ";
11376
+ query += "where sp.id_site = :id_site ";
11377
+ query += "order by port_type, port_sign";
11376
11378
  return query;
11377
11379
  }
11378
11380
 
@@ -11394,6 +11396,41 @@ function getPorteByIdSite(db_used, id_site) {
11394
11396
  return query;
11395
11397
  }
11396
11398
 
11399
+ function getPortById(id_port) {
11400
+ var query = "select id_site, id_place, port_sign, port_type, port_switch, local_switch_exists, note, is_connected, installed_date, last_replaced_date ";
11401
+ query += "from site_ports ";
11402
+ query += "where id = " + id_port;
11403
+ return query;
11404
+ }
11405
+
11406
+ function writePortPerSite(id_site, id_place, port_sign, port_type, port_switch, id_switch, local_switch_exists, port_note, is_connected, installed_date, last_replaced_date) {
11407
+ var query = "insert into site_ports (id_site, id_place, port_sign, port_type, port_switch, local_switch_exists, note, is_connected, installed_date, last_replaced_date) values ";
11408
+ query += "(";
11409
+ query += id_site + ", '" + id_place + "', '" + port_sign + "', '" + port_type + "', '" + port_switch + "', " + local_switch_exists + ", '" + port_note + "', " + is_connected + ", " + id_switch + ", '" + installed_date + "', '" + last_replaced_date + "'";
11410
+ query += ")";
11411
+ return query;
11412
+ }
11413
+
11414
+ function updatePortPerSite(id_port, port_type, port_switch, id_switch, local_switch_exists, port_note, is_connected, last_replaced_date) {
11415
+ var query = "update site_ports set ";
11416
+ query += "port_sign = '" + port_sign + "', ";
11417
+ query += "port_type = '" + port_type + "', ";
11418
+ query += "port_switch = '" + port_switch + "', ";
11419
+ query += "local_switch_exists = " + local_switch_exists + ", ";
11420
+ query += "note = '" + port_note + "', ";
11421
+ query += "is_connected = " + is_connected + ", ";
11422
+ query += "id_switch = " + id_switch + ", ";
11423
+ query += "last_replaced_date = '" + last_replaced_date + "' ";
11424
+ query += "where id = " + id_port;
11425
+ return query;
11426
+ }
11427
+
11428
+ function deletePortPerSite(id_port) {
11429
+ var query = "delete from site_ports ";
11430
+ query += "where id = " + id_port;
11431
+ return query;
11432
+ }
11433
+
11397
11434
  // Manage updateDevicesSite
11398
11435
  function verifyPrevDeviceSiteSQLite(id_device) {
11399
11436
  var query = "select count(id_site) as numero from device_site ";
@@ -14971,6 +15008,10 @@ module.exports = {
14971
15008
  getSitesWithDatesFromDevice,
14972
15009
  querySitesWithDefaults,
14973
15010
  getPorteByIdSite,
15011
+ getPortById,
15012
+ writePortPerSite,
15013
+ updatePortPerSite,
15014
+ deletePortPerSite,
14974
15015
  //
14975
15016
  queryStatistic,
14976
15017
  queryStatisticInventary,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "3.0.100",
7
+ "version": "3.0.102",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",