stimulsoft-data-adapter 2023.1.8 → 2023.2.1

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.
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.1.8
4
- Build date: 2023.02.22
3
+ Version: 2023.2.1
4
+ Build date: 2023.03.22
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
8
8
  var end = function (result) {
9
9
  try {
10
10
  if (db) db.detach();
11
- result.adapterVersion = "2023.1.8";
11
+ result.adapterVersion = "2023.2.1";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
package/MSSQLAdapter.js CHANGED
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.1.8
4
- Build date: 2023.02.22
3
+ Version: 2023.2.1
4
+ Build date: 2023.03.22
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
8
8
  var end = function (result) {
9
9
  try {
10
10
  if (connection) connection.close();
11
- result.adapterVersion = "2023.1.8";
11
+ result.adapterVersion = "2023.2.1";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
@@ -27,40 +27,31 @@ exports.process = function (command, onResult) {
27
27
  });
28
28
  }
29
29
 
30
- var query = function (queryString) {
31
- var request = connection.request();
32
- request.query(queryString, function (error, recordset) {
33
- if (error) onError(error.message);
34
- else {
35
- onQuery(recordset);
36
- }
37
- });
38
- }
39
-
40
- var execute = function (queryString, parameters) {
30
+ var query = function (queryString, parameters) {
41
31
  var request = connection.request();
42
32
 
43
33
  for (var index in parameters) {
44
34
  var parameter = parameters[index];
35
+ if (parameter.type == 4) parameter.value = new Date(parameter.value);
45
36
  request.input(parameter.name, sql[parameter.typeName], parameter.value);
46
37
  }
47
38
 
48
- request.execute(queryString, function (error, recordset) {
39
+ var onExecute = function (error, recordset) {
49
40
  if (error) onError(error.message);
50
41
  else {
51
42
  onQuery(recordset);
52
43
  }
53
- });
44
+ };
45
+
46
+ if (command.command == "Execute")
47
+ request.execute(queryString, onExecute);
48
+ else
49
+ request.query(queryString, onExecute);
54
50
  }
55
51
 
56
52
  var onConnect = function () {
57
53
  if (command.queryString) {
58
- if (command.command == "Execute")
59
- execute(command.queryString, command.parameters);
60
- else {
61
- var queryString = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
62
- query(queryString);
63
- }
54
+ query(command.queryString, command.parameters);
64
55
  }
65
56
  else end({ success: true });
66
57
  }
@@ -164,42 +155,6 @@ exports.process = function (command, onResult) {
164
155
  end({ success: true, columns: columns, rows: rows, types: types });
165
156
  }
166
157
 
167
- var applyQueryParameters = function (baseSqlCommand, parameters, escapeQueryParameters) {
168
- if (baseSqlCommand == null || baseSqlCommand.indexOf("@") < 0) return baseSqlCommand;
169
-
170
- var result = "";
171
- while (baseSqlCommand.indexOf("@") >= 0 && parameters != null && parameters.length > 0) {
172
- result += baseSqlCommand.substring(0, baseSqlCommand.indexOf("@"));
173
- baseSqlCommand = baseSqlCommand.substring(baseSqlCommand.indexOf("@") + 1);
174
-
175
- var parameterName = "";
176
-
177
- while (baseSqlCommand.length > 0) {
178
- var char = baseSqlCommand.charAt(0);
179
- if (char.length === 1 && char.match(/[a-zA-Z0-9_-]/i)) {
180
- parameterName += char;
181
- baseSqlCommand = baseSqlCommand.substring(1);
182
- }
183
- else break;
184
- }
185
-
186
- var parameter = parameters.find(parameter => parameter.name.toLowerCase() == parameterName.toLowerCase());
187
- if (parameter) {
188
- if (parameter.typeGroup != "number") {
189
- if (escapeQueryParameters)
190
- result += "'" + parameter.value.toString().replace(/\\/gi, "\\\\").replace(/\'/gi, "\\\'").replace(/\"/gi, "\\\"") + "'";
191
- else
192
- result += "'" + parameter.value.toString() + "'";
193
- }
194
- else
195
- result += parameter.value.toString();
196
- }
197
- else
198
- result += "@" + parameterName;
199
- }
200
-
201
- return result + baseSqlCommand;
202
- }
203
158
  var getHostInfo = function (host) {
204
159
  const info = {};
205
160
  const regexPort = /(.*),([0-9]+)/;
package/MySQLAdapter.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.1.8
4
- Build date: 2023.02.22
3
+ Version: 2023.2.1
4
+ Build date: 2023.03.22
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
@@ -13,7 +13,7 @@ exports.process = function (command, onResult) {
13
13
  catch (e) {
14
14
  }
15
15
  finally {
16
- result.adapterVersion = "2023.1.8";
16
+ result.adapterVersion = "2023.2.1";
17
17
  onResult(result);
18
18
  }
19
19
  }
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.1.8
4
- Build date: 2023.02.22
3
+ Version: 2023.2.1
4
+ Build date: 2023.03.22
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
8
8
  var end = function (result) {
9
9
  try {
10
10
  if (client) client.end();
11
- result.adapterVersion = "2023.1.8";
11
+ result.adapterVersion = "2023.2.1";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2023.1.8
4
- Build date: 2023.02.22
3
+ Version: 2023.2.1
4
+ Build date: 2023.03.22
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
 
@@ -67,7 +67,7 @@ function getResponse(result) {
67
67
  return result
68
68
  }
69
69
  function onProcess(onResult, encryptData, result) {
70
- result.handlerVersion = "2023.1.8";
70
+ result.handlerVersion = "2023.2.1";
71
71
  result.checkVersion = true;
72
72
  result.encryptData = encryptData;
73
73
  onResult(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stimulsoft-data-adapter",
3
- "version": "2023.1.8",
3
+ "version": "2023.2.1",
4
4
  "description": "Nodejs data adapter for Stimulsoft Reports.JS",
5
5
  "main": "index.js",
6
6
  "scripts": {