alsmanager_lib 1.0.83 → 1.0.84

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 +31 -0
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1161,6 +1161,36 @@ function removePartChanged(db_used, id_change, id_conf) {
1161
1161
  return query;
1162
1162
  }
1163
1163
 
1164
+ function getLastPartInsertedSQLite(id_device, id_conf, part_type) {
1165
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
1166
+ query += "where id_device = " + id_device + " ";
1167
+ query += "and id_conf = " + id_conf + " ";
1168
+ query += "and part_type = '" + part_type + "' ";
1169
+ query += "order by id desc LIMIT 1";
1170
+ return query;
1171
+ }
1172
+ function getLastPartInsertedMySQL(id_device, id_conf, part_type) {
1173
+ var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
1174
+ query += "where id_device = :id_device ";
1175
+ query += "and id_conf = :id_conf ";
1176
+ query += "and part_type = :part_type ";
1177
+ query += "order by id desc LIMIT 1";
1178
+ return query;
1179
+ }
1180
+ function getLastPartInserted(db_used, id_device, id_conf, part_type) {
1181
+ var query = "";
1182
+ if (db_used) {
1183
+ switch (db_used) {
1184
+ case 'SQLITE':
1185
+ query = getLastPartInsertedSQLite(id_device, id_conf, part_type);
1186
+ break;
1187
+ case 'MYSQL':
1188
+ query = getLastPartInsertedMySQL(id_device, id_conf, part_type);
1189
+ break;
1190
+ }
1191
+ }
1192
+ return query;
1193
+ }
1164
1194
  //End Device configurations
1165
1195
  // Disk usage
1166
1196
  function getDiskUsagesByIdStorageSQLite(id_storage) {
@@ -8716,6 +8746,7 @@ module.exports = {
8716
8746
  insertPartChanged,
8717
8747
  updatePartChanged,
8718
8748
  removePartChanged,
8749
+ getLastPartInserted,
8719
8750
  //
8720
8751
  selectBeneDaInventario,
8721
8752
  getDevicesSelectForInventarioRaw,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.83",
3
+ "version": "1.0.84",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",