alsmanager_lib 1.0.75 → 1.0.76
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 +70 -24
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -707,12 +707,14 @@ function getAddonsByConfig(db_used, id_device, id_conf) {
|
|
|
707
707
|
// Device configurations
|
|
708
708
|
function getDeviceConfigurationsSQLite(id_device) {
|
|
709
709
|
var query = "select id, date_conf, note from device_changes ";
|
|
710
|
-
query += "where id_device = " + id_device;
|
|
710
|
+
query += "where id_device = " + id_device + " ";
|
|
711
|
+
query += "order by date_conf desc"
|
|
711
712
|
return query;
|
|
712
713
|
}
|
|
713
714
|
function getDeviceConfigurationsMySQL(id_device) {
|
|
714
715
|
var query = "select id, date_conf, note from device_changes ";
|
|
715
|
-
query += "where id_device = :id_device";
|
|
716
|
+
query += "where id_device = :id_device ";
|
|
717
|
+
query += "order by date_conf desc"
|
|
716
718
|
return query;
|
|
717
719
|
}
|
|
718
720
|
function getDeviceConfigurations(db_used, id_device) {
|
|
@@ -730,6 +732,33 @@ function getDeviceConfigurations(db_used, id_device) {
|
|
|
730
732
|
return query;
|
|
731
733
|
}
|
|
732
734
|
|
|
735
|
+
function getLastDeviceConfigurationSQLite(id_device) {
|
|
736
|
+
var query = "select id, date_conf, note from device_changes ";
|
|
737
|
+
query += "where id_device = " + id_device + " ";
|
|
738
|
+
query += "order by date_conf desc LIMIT 1";
|
|
739
|
+
return query;
|
|
740
|
+
}
|
|
741
|
+
function getLastDeviceConfigurationMySQL(id_device) {
|
|
742
|
+
var query = "select id, date_conf, note from device_changes ";
|
|
743
|
+
query += "where id_device = :id_device ";
|
|
744
|
+
query += "order by date_conf desc LIMIT 1";
|
|
745
|
+
return query;
|
|
746
|
+
}
|
|
747
|
+
function getLastDeviceConfiguration(db_used, id_device) {
|
|
748
|
+
var query = "";
|
|
749
|
+
if (db_used) {
|
|
750
|
+
switch (db_used) {
|
|
751
|
+
case 'SQLITE':
|
|
752
|
+
query = getLastDeviceConfigurationSQLite(id_device);
|
|
753
|
+
break;
|
|
754
|
+
case 'MYSQL':
|
|
755
|
+
query = getLastDeviceConfigurationMySQL(id_device);
|
|
756
|
+
break;
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return query;
|
|
760
|
+
}
|
|
761
|
+
|
|
733
762
|
|
|
734
763
|
function getDeviceConfigurationByIdSQLite(id_conf) {
|
|
735
764
|
var query = "select id, id_device, date_conf, note from device_changes ";
|
|
@@ -738,7 +767,7 @@ function getDeviceConfigurationByIdSQLite(id_conf) {
|
|
|
738
767
|
}
|
|
739
768
|
function getDeviceConfigurationByIdMySQL(id_conf) {
|
|
740
769
|
var query = "select id, id_device, date_conf, note from device_changes ";
|
|
741
|
-
query += "where id = "
|
|
770
|
+
query += "where id = :id_conf";
|
|
742
771
|
return query;
|
|
743
772
|
}
|
|
744
773
|
function getDeviceConfigurationById(db_used, id_conf) {
|
|
@@ -756,63 +785,79 @@ function getDeviceConfigurationById(db_used, id_conf) {
|
|
|
756
785
|
return query;
|
|
757
786
|
}
|
|
758
787
|
|
|
759
|
-
function insertDeviceConfigurationSQLite(id_device,
|
|
760
|
-
|
|
788
|
+
function insertDeviceConfigurationSQLite(id_device, data, note) {
|
|
789
|
+
var query = "insert into device_changes (id_device, date_conf, note) values (";
|
|
790
|
+
query += id_device + ", '" + data + "', '" + note + "')";
|
|
791
|
+
return query;
|
|
761
792
|
}
|
|
762
|
-
function insertDeviceConfigurationMySQL(id_device,
|
|
763
|
-
|
|
793
|
+
function insertDeviceConfigurationMySQL(id_device, data, note) {
|
|
794
|
+
var query = "insert into device_changes (id_device, date_conf, note) values (";
|
|
795
|
+
query += ":id_device, :data, :note)";
|
|
796
|
+
return query;
|
|
764
797
|
}
|
|
765
|
-
function insertDeviceConfiguration(db_used, id_device,
|
|
798
|
+
function insertDeviceConfiguration(db_used, id_device, data, note) {
|
|
766
799
|
var query = "";
|
|
767
800
|
if (db_used) {
|
|
768
801
|
switch (db_used) {
|
|
769
802
|
case 'SQLITE':
|
|
770
|
-
query = insertDeviceConfigurationSQLite(id_device,
|
|
803
|
+
query = insertDeviceConfigurationSQLite(id_device, data, note);
|
|
771
804
|
break;
|
|
772
805
|
case 'MYSQL':
|
|
773
|
-
query = insertDeviceConfigurationMySQL(id_device,
|
|
806
|
+
query = insertDeviceConfigurationMySQL(id_device, data, note);
|
|
774
807
|
break;
|
|
775
808
|
}
|
|
776
809
|
}
|
|
777
810
|
return query;
|
|
778
811
|
}
|
|
779
812
|
|
|
780
|
-
function updateDeviceConfigurationSQLite(
|
|
781
|
-
|
|
813
|
+
function updateDeviceConfigurationSQLite(id_conf, data, note) {
|
|
814
|
+
var query = "update device_changes set ";
|
|
815
|
+
query += "date_conf = '" + data +"',";
|
|
816
|
+
query += "note = '" + note + "' ";
|
|
817
|
+
query += "where id = " + id_conf;
|
|
818
|
+
return query;
|
|
782
819
|
}
|
|
783
|
-
function updateDeviceConfigurationMySQL(
|
|
784
|
-
|
|
820
|
+
function updateDeviceConfigurationMySQL(id_conf, data, note) {
|
|
821
|
+
var query = "update device_changes set ";
|
|
822
|
+
query += "date_conf = :data,";
|
|
823
|
+
query += "note = :note ";
|
|
824
|
+
query += "where id = :id_conf";
|
|
825
|
+
return query;
|
|
785
826
|
}
|
|
786
|
-
function updateDeviceConfiguration(db_used, id_conf,
|
|
827
|
+
function updateDeviceConfiguration(db_used, id_conf, data, note) {
|
|
787
828
|
var query = "";
|
|
788
829
|
if (db_used) {
|
|
789
830
|
switch (db_used) {
|
|
790
831
|
case 'SQLITE':
|
|
791
|
-
query = updateDeviceConfigurationSQLite(id_conf,
|
|
832
|
+
query = updateDeviceConfigurationSQLite(id_conf, data, note);
|
|
792
833
|
break;
|
|
793
834
|
case 'MYSQL':
|
|
794
|
-
query = updateDeviceConfigurationMySQL(id_conf,
|
|
835
|
+
query = updateDeviceConfigurationMySQL(id_conf, data, note);
|
|
795
836
|
break;
|
|
796
837
|
}
|
|
797
838
|
}
|
|
798
839
|
return query;
|
|
799
840
|
}
|
|
800
841
|
|
|
801
|
-
function removeDeviceConfigurationSQLite(id_conf
|
|
802
|
-
|
|
842
|
+
function removeDeviceConfigurationSQLite(id_conf) {
|
|
843
|
+
var query = "delete from device_changes ";
|
|
844
|
+
query += "where id = " + id_conf;
|
|
845
|
+
return query;
|
|
803
846
|
}
|
|
804
|
-
function removeDeviceConfigurationMySQL(id_conf
|
|
805
|
-
|
|
847
|
+
function removeDeviceConfigurationMySQL(id_conf) {
|
|
848
|
+
var query = "delete from device_changes ";
|
|
849
|
+
query += "where id = :id_conf";
|
|
850
|
+
return query;
|
|
806
851
|
}
|
|
807
|
-
function removeDeviceConfiguration(db_used, id_conf
|
|
852
|
+
function removeDeviceConfiguration(db_used, id_conf) {
|
|
808
853
|
var query = "";
|
|
809
854
|
if (db_used) {
|
|
810
855
|
switch (db_used) {
|
|
811
856
|
case 'SQLITE':
|
|
812
|
-
query = removeDeviceConfigurationSQLite(id_conf
|
|
857
|
+
query = removeDeviceConfigurationSQLite(id_conf);
|
|
813
858
|
break;
|
|
814
859
|
case 'MYSQL':
|
|
815
|
-
query = removeDeviceConfigurationMySQL(id_conf
|
|
860
|
+
query = removeDeviceConfigurationMySQL(id_conf);
|
|
816
861
|
break;
|
|
817
862
|
}
|
|
818
863
|
}
|
|
@@ -8220,6 +8265,7 @@ module.exports = {
|
|
|
8220
8265
|
getAddonsByConfig,
|
|
8221
8266
|
//
|
|
8222
8267
|
getDeviceConfigurations,
|
|
8268
|
+
getLastDeviceConfiguration,
|
|
8223
8269
|
getDeviceConfigurationById,
|
|
8224
8270
|
insertDeviceConfiguration,
|
|
8225
8271
|
updateDeviceConfiguration,
|