alsmanager_lib 1.0.66 → 1.0.68

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 +30 -7
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -7893,26 +7893,49 @@ function getPackageJsVersion() {
7893
7893
 
7894
7894
  // Export DB
7895
7895
 
7896
- function exportDBSQLSQLite(dump_path, dump_source, dump_date) {
7896
+ function exportDBSQLSQLite(db_path, dump_path, dump_source, dump_date) {
7897
+ var datestring = "";
7898
+ if (!dump_date) {
7899
+ var d = new Date();
7900
+ datestring = d.getFullYear() + ("0" + d.getDate()).slice(-2) + ("0"+(d.getMonth()+1)).slice(-2) +
7901
+ "_" + ("0" + d.getHours()).slice(-2) + ":" + ("0" + d.getMinutes()).slice(-2);
7902
+ }
7903
+ else {
7904
+ datestring = dump_date;
7905
+ }
7906
+
7897
7907
  var path = require('path');
7898
- var fileOut = path.join(dump_path, "ALSnr_" + dump_source + dump_date + ".sql");
7908
+ var fileOut = path.join(dump_path, "ALSnr_" + dump_source + datestring + ".sql");
7899
7909
  var query = ".output " + fileOut + ";";
7900
7910
  query += ".dump;";
7901
7911
  query += ".exit;";
7902
- return query;
7912
+
7913
+ let cmd = "sqlite3 " + db_path + "\"" + query + "\"";
7914
+
7915
+ const exec = require('child_process').exec;
7916
+ const child = exec(cmd,
7917
+ (error, stdout, stderr) => {
7918
+ console.log(`stdout: ${stdout}`);
7919
+ console.log(`stderr: ${stderr}`);
7920
+ if (error !== null) {
7921
+ console.log(`exec error: ${error}`);
7922
+ }
7923
+ });
7924
+
7925
+ return cmd;
7903
7926
  }
7904
- function exportDBSQLMySQL(dump_path, dump_source, dump_date) {
7927
+ function exportDBSQLMySQL(db_path, dump_path, dump_source, dump_date) {
7905
7928
 
7906
7929
  }
7907
- function exportDBSQL(db_used, dump_path, dump_source, dump_date) {
7930
+ function exportDBSQL(db_used, db_path, dump_path, dump_source, dump_date) {
7908
7931
  var query = "";
7909
7932
  if (db_used) {
7910
7933
  switch (db_used) {
7911
7934
  case 'SQLITE':
7912
- query = exportDBSQLSQLite(dump_path, dump_source, dump_date);
7935
+ query = exportDBSQLSQLite(db_path, dump_path, dump_source, dump_date);
7913
7936
  break;
7914
7937
  case 'MYSQL':
7915
- query = exportDBSQLMySQL(dump_path, dump_source, dump_date);
7938
+ query = exportDBSQLMySQL(db_path, dump_path, dump_source, dump_date);
7916
7939
  break;
7917
7940
  }
7918
7941
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alsmanager_lib",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
4
4
  "description": "Funzioni per ALSManager",
5
5
  "license": "ISC",
6
6
  "author": "Luca Cattani",