alsmanager_lib 1.0.66 → 1.0.67

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