alsmanager_lib 2.0.59 → 2.0.61

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 +27 -3
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -156,12 +156,36 @@ function removeConnector(db_used, id_device, conn_obj) {
156
156
  //End Manage connectors
157
157
  // Manage Storage
158
158
  function queryStorageManifactures() {
159
- var query = "SELECT DISTINCT storage_manifacturer as marca from device_storages order by storage_manifacturer";
159
+ var query = "SELECT DISTINCT upper(trim(storage_manifacturer)) as marca from device_storages order by storage_manifacturer";
160
160
  return query;
161
161
  }
162
162
 
163
- function queryStorageModels() {
164
- var query = "SELECT DISTINCT storage_model as modello from device_storages order by storage_model";
163
+ function queryStorageModelsSQLite(marca) {
164
+ var query = "SELECT DISTINCT upper(trim(storage_model)) as modello from device_storages ";
165
+ query += "where upper(trim(storage_manifacturer)) = '" + marca + "' ";
166
+ query += "order by storage_model";
167
+ return query;
168
+ }
169
+
170
+ function queryStorageModelsMySQL(marca) {
171
+ var query = "SELECT DISTINCT upper(trim(storage_model)) as modello from device_storages ";
172
+ query += "where upper(trim(storage_manifacturer)) = :marca ";
173
+ query += "order by storage_model";
174
+ return query;
175
+ }
176
+
177
+ function queryStorageModels(db_used, marca) {
178
+ var query = "";
179
+ if (db_used) {
180
+ switch (db_used) {
181
+ case 'SQLITE':
182
+ query = queryStorageModelsSQLite(marca);
183
+ break;
184
+ case 'MYSQL':
185
+ query = queryStorageModelsMySQL(marca);
186
+ break;
187
+ }
188
+ }
165
189
  return query;
166
190
  }
167
191
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "2.0.59",
7
+ "version": "2.0.61",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",