alsmanager_lib 1.0.53 → 1.0.55
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.
- package/lib/modules.js +157 -0
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -7097,6 +7097,158 @@ function queryStatisticInventary(db_used) {
|
|
|
7097
7097
|
return query;
|
|
7098
7098
|
}
|
|
7099
7099
|
//End Get Inventary for Statistics
|
|
7100
|
+
// Benchmarking
|
|
7101
|
+
function getBenchmarkByIdSQLite(id_device) {
|
|
7102
|
+
var query = "select id_device, total_ref, evaluation_perfs from device_bmark ";
|
|
7103
|
+
query += "where id_device = " + id_device;
|
|
7104
|
+
return query;
|
|
7105
|
+
}
|
|
7106
|
+
|
|
7107
|
+
function getBenchmarkByIdMySQL(id_device) {
|
|
7108
|
+
var query = "select id_device, total_ref, evaluation_perfs from device_bmark ";
|
|
7109
|
+
query += "where id_device = :id_device";
|
|
7110
|
+
return query;
|
|
7111
|
+
}
|
|
7112
|
+
|
|
7113
|
+
function getBenchmarkById(db_used, id_device) {
|
|
7114
|
+
var query = "";
|
|
7115
|
+
if (db_used) {
|
|
7116
|
+
switch (db_used) {
|
|
7117
|
+
case 'SQLITE':
|
|
7118
|
+
query = getBenchmarkByIdSQLite(id_device);
|
|
7119
|
+
break;
|
|
7120
|
+
case 'MYSQL':
|
|
7121
|
+
query = getBenchmarkByIdMySQL(id_device);
|
|
7122
|
+
break;
|
|
7123
|
+
}
|
|
7124
|
+
}
|
|
7125
|
+
return query;
|
|
7126
|
+
}
|
|
7127
|
+
|
|
7128
|
+
function getBenchmarkPercentageByIdSQLite(id_device) {
|
|
7129
|
+
var query = "select id_device, total_ref, evaluation_perfs, ";
|
|
7130
|
+
query += "case ";
|
|
7131
|
+
query += "when total_ref is not null and total_ref > 0 then (evaluation_perfs/total_ref) * 100 ";
|
|
7132
|
+
query += "else 0 ";
|
|
7133
|
+
query += "end as perc_prestazioni from device_bmark ";
|
|
7134
|
+
query += "where id_device = " + id_device;
|
|
7135
|
+
return query;
|
|
7136
|
+
}
|
|
7137
|
+
|
|
7138
|
+
function getBenchmarkPercentageByIdMySQL(id_device) {
|
|
7139
|
+
var query = "select id_device, total_ref, evaluation_perfs, ";
|
|
7140
|
+
query += "case ";
|
|
7141
|
+
query += "when total_ref is not null and total_ref > 0 then (evaluation_perfs/total_ref) * 100 ";
|
|
7142
|
+
query += "else 0 ";
|
|
7143
|
+
query += "end as perc_prestazioni from device_bmark ";
|
|
7144
|
+
query += "where id_device = :id_device";
|
|
7145
|
+
return query;
|
|
7146
|
+
}
|
|
7147
|
+
|
|
7148
|
+
function getBenchmarkPercentageById(db_used, id_device) {
|
|
7149
|
+
var query = "";
|
|
7150
|
+
if (db_used) {
|
|
7151
|
+
switch (db_used) {
|
|
7152
|
+
case 'SQLITE':
|
|
7153
|
+
query = getBenchmarkPercentageByIdSQLite(id_device);
|
|
7154
|
+
break;
|
|
7155
|
+
case 'MYSQL':
|
|
7156
|
+
query = getBenchmarkPercentageByIdMySQL(id_device);
|
|
7157
|
+
break;
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
return query;
|
|
7161
|
+
}
|
|
7162
|
+
|
|
7163
|
+
|
|
7164
|
+
function insertBenchmarkSQLite(id_device, total_ref, eval_perfs) {
|
|
7165
|
+
var query = "insert into device_bmark (id_device, total_ref, evaluation_perfs) value ";
|
|
7166
|
+
query += "(" + id_device + ", " + total_ref + ", " + eval_perfs + ")";
|
|
7167
|
+
return query;
|
|
7168
|
+
}
|
|
7169
|
+
|
|
7170
|
+
function insertBenchmarkMySQL(id_device, total_ref, eval_perfs) {
|
|
7171
|
+
var query = "insert into device_bmark (id_device, total_ref, evaluation_perfs) value ";
|
|
7172
|
+
query += "(:id_device, :total_ref, :eval_perfs)";
|
|
7173
|
+
return query;
|
|
7174
|
+
}
|
|
7175
|
+
|
|
7176
|
+
function insertBenchmark(db_used, id_device, total_ref, eval_perfs) {
|
|
7177
|
+
var query = "";
|
|
7178
|
+
if (db_used) {
|
|
7179
|
+
switch (db_used) {
|
|
7180
|
+
case 'SQLITE':
|
|
7181
|
+
query = insertBenchmarkSQLite(id_device, total_ref, eval_perfs);
|
|
7182
|
+
break;
|
|
7183
|
+
case 'MYSQL':
|
|
7184
|
+
query = insertBenchmarkMySQL(id_device, total_ref, eval_perfs);
|
|
7185
|
+
break;
|
|
7186
|
+
}
|
|
7187
|
+
}
|
|
7188
|
+
return query;
|
|
7189
|
+
}
|
|
7190
|
+
|
|
7191
|
+
|
|
7192
|
+
function updateBenchmarkSQLite(id_device, total_ref, eval_perfs) {
|
|
7193
|
+
var query = "update device_bmark set ";
|
|
7194
|
+
query += "total_ref = " + total_ref + ", ";
|
|
7195
|
+
query += "evaluation_perfs = " + eval_perfs + " ";
|
|
7196
|
+
query += "where id_device = " + id_device;
|
|
7197
|
+
return query;
|
|
7198
|
+
}
|
|
7199
|
+
|
|
7200
|
+
function updateBenchmarkMySQL(id_device, total_ref, eval_perfs) {
|
|
7201
|
+
var query = "update device_bmark set ";
|
|
7202
|
+
query += "total_ref = " + total_ref + ", ";
|
|
7203
|
+
query += "evaluation_perfs = " + eval_perfs + " ";
|
|
7204
|
+
query += "where id_device = " + id_device;
|
|
7205
|
+
return query;
|
|
7206
|
+
}
|
|
7207
|
+
|
|
7208
|
+
function updateBenchmark(db_used, id_device, total_ref, eval_perfs) {
|
|
7209
|
+
var query = "";
|
|
7210
|
+
if (db_used) {
|
|
7211
|
+
switch (db_used) {
|
|
7212
|
+
case 'SQLITE':
|
|
7213
|
+
query = updateBenchmarkSQLite(id_device, total_ref, eval_perfs);
|
|
7214
|
+
break;
|
|
7215
|
+
case 'MYSQL':
|
|
7216
|
+
query = updateBenchmarkMySQL(id_device, total_ref, eval_perfs);
|
|
7217
|
+
break;
|
|
7218
|
+
}
|
|
7219
|
+
}
|
|
7220
|
+
return query;
|
|
7221
|
+
}
|
|
7222
|
+
|
|
7223
|
+
function removeBenchmarkByIdSQLite(id_device) {
|
|
7224
|
+
var query = "delete from device_bmark ";
|
|
7225
|
+
query += "where id_device = " + id_device;
|
|
7226
|
+
return query;
|
|
7227
|
+
}
|
|
7228
|
+
|
|
7229
|
+
function removeBenchmarkByIdMySQL(id_device) {
|
|
7230
|
+
var query = "delete from device_bmark ";
|
|
7231
|
+
query += "where id_device = " + id_device;
|
|
7232
|
+
return query;
|
|
7233
|
+
}
|
|
7234
|
+
|
|
7235
|
+
function removeBenchmarkById(db_used, id_device) {
|
|
7236
|
+
var query = "";
|
|
7237
|
+
if (db_used) {
|
|
7238
|
+
switch (db_used) {
|
|
7239
|
+
case 'SQLITE':
|
|
7240
|
+
query = removeBenchmarkByIdSQLite(id_device);
|
|
7241
|
+
break;
|
|
7242
|
+
case 'MYSQL':
|
|
7243
|
+
query = removeBenchmarkByIdMySQL(id_device);
|
|
7244
|
+
break;
|
|
7245
|
+
}
|
|
7246
|
+
}
|
|
7247
|
+
return query;
|
|
7248
|
+
}
|
|
7249
|
+
|
|
7250
|
+
//End benchmarking
|
|
7251
|
+
|
|
7100
7252
|
//Get Devices Statistics bt Status
|
|
7101
7253
|
function queryStatisticsDeviceStatusSQLite() {
|
|
7102
7254
|
var query = "select case when ds.status is null then 0 else ds.status end as Stato, sd.name as Descrizione, count(*) as Numero from devices d ";
|
|
@@ -7617,6 +7769,11 @@ module.exports = {
|
|
|
7617
7769
|
queryStatistic,
|
|
7618
7770
|
queryStatisticInventary,
|
|
7619
7771
|
queryStatisticsDeviceStatus,
|
|
7772
|
+
getBenchmarkById,
|
|
7773
|
+
getBenchmarkPercentageById,
|
|
7774
|
+
insertBenchmark,
|
|
7775
|
+
updateBenchmark,
|
|
7776
|
+
removeBenchmarkById,
|
|
7620
7777
|
getPropertiesFromBLOB,
|
|
7621
7778
|
getOpSystemFromBLOB,
|
|
7622
7779
|
getAllPropertiesFromBLOB,
|