alsmanager_lib 1.0.92 → 1.0.94

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 +41 -3
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1196,9 +1196,10 @@ function removeDeviceConfiguration(db_used, id_conf) {
1196
1196
  return query;
1197
1197
  }
1198
1198
  //
1199
- function insertPartChangedSQLite(id_conf, id_part, part_type, operation, id_part_replaced) {
1200
- var query = "insert into change_config (id_conf, part_type, id_part, operation, id_part_replaced) values (";
1199
+ function insertPartChangedSQLite(id_conf, id_device, id_part, part_type, operation, id_part_replaced) {
1200
+ var query = "insert into change_config (id_conf, id_device, part_type, id_part, operation, id_part_replaced) values (";
1201
1201
  query += id_conf + ", ";
1202
+ query += id_device + ", ";
1202
1203
  query += "'" + part_type + "', ";
1203
1204
  query += id_part + ", ";
1204
1205
  query += "'" + operation + "', ";
@@ -1207,8 +1208,9 @@ function insertPartChangedSQLite(id_conf, id_part, part_type, operation, id_part
1207
1208
  return query;
1208
1209
  }
1209
1210
  function insertPartChangedMySQL() {
1210
- var query = "insert into change_config (id_conf, part_type, id_part, operation, id_part_replaced) values (";
1211
+ var query = "insert into change_config (id_conf, id_device, part_type, id_part, operation, id_part_replaced) values (";
1211
1212
  query += ":id_conf, ";
1213
+ query += ":id_device, ";
1212
1214
  query += ":part_type, ";
1213
1215
  query += ":id_part, ";
1214
1216
  query += ":operation, ";
@@ -1323,6 +1325,41 @@ function getLastPartInserted(db_used, id_device, id_conf, part_type) {
1323
1325
  }
1324
1326
  return query;
1325
1327
  }
1328
+
1329
+ function existPartInConfigSQLite(id_device, id_conf, id_part, part_type) {
1330
+ var query = "select count(*) as num from change_config ";
1331
+ query += "where id_device = " + id_device + " ";
1332
+ query += "and part_type = '" + part_type + "' ";
1333
+ query += "and id_conf = " + id_conf + " ";
1334
+ query += "and id_part = " + id_part;
1335
+ return query;
1336
+ }
1337
+
1338
+ function existPartInConfigMySQL(id_device, id_conf, id_part, part_type) {
1339
+ var query = "select count(*) as num from change_config ";
1340
+ query += "where id_device = :id_device ";
1341
+ query += "and part_type = :part_type ";
1342
+ query += "and id_conf = :id_conf ";
1343
+ query += "and id_part = :id_part";
1344
+ return query;
1345
+ }
1346
+
1347
+ function existPartInConfig(db_used, id_device, id_conf, id_part, part_type) {
1348
+ var query = "";
1349
+ if (db_used) {
1350
+ switch (db_used) {
1351
+ case 'SQLITE':
1352
+ query = existPartInConfigSQLite(id_device, id_conf, id_part, part_type);
1353
+ break;
1354
+ case 'MYSQL':
1355
+ query = existPartInConfigMySQL(id_device, id_conf, id_part, part_type);
1356
+ break;
1357
+ }
1358
+ }
1359
+ return query;
1360
+ }
1361
+
1362
+
1326
1363
  //End Device configurations
1327
1364
  // Disk usage
1328
1365
  function getDiskUsagesByIdStorageSQLite(id_storage) {
@@ -8970,6 +9007,7 @@ module.exports = {
8970
9007
  updatePartChanged,
8971
9008
  removePartChanged,
8972
9009
  getLastPartInserted,
9010
+ existPartInConfig,
8973
9011
  //
8974
9012
  selectBeneDaInventario,
8975
9013
  getDevicesSelectForInventarioRaw,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.92",
3
+ "version": "1.0.94",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",