stimulsoft-data-adapter 2024.2.6 → 2024.3.2

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: 2024.2.6
4
- Build date: 2024.05.20
3
+ Version: 2024.3.2
4
+ Build date: 2024.07.09
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 = "2024.2.6";
11
+ result.adapterVersion = "2024.3.2";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
@@ -31,7 +31,7 @@ exports.process = function (command, onResult) {
31
31
  var query = function (queryString) {
32
32
  db.query(queryString, undefined, function (error, recordset) {
33
33
  if (error) onError(error.message);
34
- else onQuery(recordset);
34
+ else onQuery(recordset, maxDataRows);
35
35
  db.detach();
36
36
  });
37
37
  }
@@ -39,12 +39,12 @@ exports.process = function (command, onResult) {
39
39
  var onConnect = function () {
40
40
  if (command.queryString) {
41
41
  var queryString = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
42
- query(queryString);
42
+ query(queryString, command.maxDataRows);
43
43
  }
44
44
  else end({ success: true });
45
45
  }
46
46
 
47
- var onQuery = function (recordset) {
47
+ var onQuery = function (recordset, maxDataRows) {
48
48
  var columns = [];
49
49
  var rows = [];
50
50
  var types = [];
@@ -69,6 +69,7 @@ exports.process = function (command, onResult) {
69
69
  row[columnIndex] = recordset[recordIndex][columnName];
70
70
  }
71
71
  isColumnsFill = true;
72
+ if (maxDataRows != null && maxDataRows <= rows.length) break;
72
73
  rows.push(row);
73
74
  }
74
75
 
package/MSSQLAdapter.js CHANGED
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2024.2.6
4
- Build date: 2024.05.20
3
+ Version: 2024.3.2
4
+ Build date: 2024.07.09
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 = "2024.2.6";
11
+ result.adapterVersion = "2024.3.2";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
@@ -27,7 +27,7 @@ exports.process = function (command, onResult) {
27
27
  });
28
28
  }
29
29
 
30
- var query = function (queryString, parameters) {
30
+ var query = function (queryString, parameters, maxDataRows) {
31
31
  var request = connection.request();
32
32
 
33
33
  for (var index in parameters) {
@@ -39,7 +39,7 @@ exports.process = function (command, onResult) {
39
39
  var onExecute = function (error, recordset) {
40
40
  if (error) onError(error.message);
41
41
  else {
42
- onQuery(recordset);
42
+ onQuery(recordset, maxDataRows);
43
43
  }
44
44
  };
45
45
 
@@ -51,12 +51,12 @@ exports.process = function (command, onResult) {
51
51
 
52
52
  var onConnect = function () {
53
53
  if (command.queryString) {
54
- query(command.queryString, command.parameters);
54
+ query(command.queryString, command.parameters, command.maxDataRows);
55
55
  }
56
56
  else end({ success: true });
57
57
  }
58
58
 
59
- var onQuery = function (recordset) {
59
+ var onQuery = function (recordset, maxDataRows) {
60
60
  recordset = recordset.recordset;
61
61
  var columns = [];
62
62
  var rows = [];
@@ -145,6 +145,8 @@ exports.process = function (command, onResult) {
145
145
  else
146
146
  row[columnIndex] = recordset[recordIndex][columnName];
147
147
  }
148
+
149
+ if (maxDataRows != null && maxDataRows <= rows.length) break;
148
150
  rows.push(row);
149
151
  }
150
152
 
package/MongoDBAdapter.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2024.2.6
4
- Build date: 2024.05.20
3
+ Version: 2024.3.2
4
+ Build date: 2024.07.09
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
  exports.process = function (command, onResult) {
@@ -115,6 +115,7 @@ exports.process = function (command, onResult) {
115
115
  row[columnIndex] = value;
116
116
  }
117
117
 
118
+ if (command.maxDataRows != null && command.maxDataRows <= rows.length) break;
118
119
  rows.push(row);
119
120
  }
120
121
 
@@ -126,7 +127,7 @@ exports.process = function (command, onResult) {
126
127
  }
127
128
 
128
129
  client.close();
129
- result.adapterVersion = "2024.2.6";
130
+ result.adapterVersion = "2024.3.2";
130
131
  onResult(result);
131
132
  });
132
133
  }
package/MySQLAdapter.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2024.2.6
4
- Build date: 2024.05.20
3
+ Version: 2024.3.2
4
+ Build date: 2024.07.09
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 = "2024.2.6";
16
+ result.adapterVersion = "2024.3.2";
17
17
  onResult(result);
18
18
  }
19
19
  }
@@ -30,12 +30,12 @@ exports.process = function (command, onResult) {
30
30
  });
31
31
  }
32
32
 
33
- var query = function (queryString, parameters, timeout) {
33
+ var query = function (queryString, parameters, timeout, maxDataRows) {
34
34
  connection.query("USE " + command.connectionStringInfo.database);
35
35
  connection.query({ sql: queryString, timeout: timeout }, parameters, function (error, rows, fields) {
36
36
  if (error) onError(error.message);
37
37
  else {
38
- onQuery(rows, fields);
38
+ onQuery(rows, fields, maxDataRows);
39
39
  }
40
40
  });
41
41
  }
@@ -46,12 +46,12 @@ exports.process = function (command, onResult) {
46
46
  command.queryString = "CALL " + command.queryString + "(" + command.parameters.map(parameter => "@" + parameter.name).join(", ") + ")";
47
47
 
48
48
  var { queryString, parameters } = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
49
- query(queryString, parameters, command.timeout);
49
+ query(queryString, parameters, command.timeout, command.maxDataRows);
50
50
  }
51
51
  else end({ success: true });
52
52
  }
53
53
 
54
- var onQuery = function (recordset, fields) {
54
+ var onQuery = function (recordset, fields, maxDataRows) {
55
55
  var columns = [];
56
56
  var rows = [];
57
57
  var types = [];
@@ -119,6 +119,7 @@ exports.process = function (command, onResult) {
119
119
  if (recordset.length > 0 && Array.isArray(recordset[0])) recordset = recordset[0];
120
120
  for (var recordIndex in recordset) {
121
121
  var row = [];
122
+
122
123
  for (var columnName in recordset[recordIndex]) {
123
124
  var columnIndex = columns.indexOf(columnName);
124
125
  if (recordset[recordIndex][columnName] instanceof Uint8Array ||
@@ -140,6 +141,7 @@ exports.process = function (command, onResult) {
140
141
 
141
142
  row[columnIndex] = recordset[recordIndex][columnName];
142
143
  }
144
+ if (maxDataRows != null && maxDataRows <= rows.length) break;
143
145
  rows.push(row);
144
146
  }
145
147
 
package/OracleAdapter.js CHANGED
@@ -26,24 +26,24 @@ exports.process = function (command, onResult) {
26
26
  command.queryString = "BEGIN " + command.queryString + "(" + command.parameters.map(parameter => "@" + parameter.name).join(", ") + "); END;";
27
27
 
28
28
  var { queryString, parameters } = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
29
- query(connection, queryString, parameters);
29
+ query(connection, queryString, parameters, command.maxDataRows);
30
30
  }
31
31
  else end({ success: true });
32
32
  }
33
33
 
34
- var query = function (connection, queryString, parameters) {
34
+ var query = function (connection, queryString, parameters, maxDataRows) {
35
35
  var args = [queryString];
36
36
  if (parameters) args.push(parameters);
37
37
 
38
38
  connection.execute(...args, function (error, result) {
39
39
  if (error) onError(error.message);
40
40
  else {
41
- onQuery(result);
41
+ onQuery(result, maxDataRows);
42
42
  }
43
43
  });
44
44
  }
45
45
 
46
- var onQuery = function (result) {
46
+ var onQuery = function (result, maxDataRows) {
47
47
  var columns = [];
48
48
  var rows = [];
49
49
  var types = [];
@@ -92,6 +92,7 @@ exports.process = function (command, onResult) {
92
92
  row.push(value);
93
93
  }
94
94
 
95
+ if (maxDataRows != null && maxDataRows <= rows.length) break;
95
96
  rows.push(row);
96
97
  }
97
98
 
@@ -150,10 +151,10 @@ exports.process = function (command, onResult) {
150
151
  var parameters = null;
151
152
  var result = "";
152
153
 
153
- if (baseSqlCommand != null && baseSqlCommand.indexOf("@") > -1) {
154
- while (baseSqlCommand.indexOf("@") >= 0 && baseParameters != null && baseParameters.length > 0) {
155
- result += baseSqlCommand.substring(0, baseSqlCommand.indexOf("@"));
156
- baseSqlCommand = baseSqlCommand.substring(baseSqlCommand.indexOf("@") + 1);
154
+ if (baseSqlCommand != null && baseSqlCommand.indexOf(":") > -1) {
155
+ while (baseSqlCommand.indexOf(":") >= 0 && baseParameters != null && baseParameters.length > 0) {
156
+ result += baseSqlCommand.substring(0, baseSqlCommand.indexOf(":"));
157
+ baseSqlCommand = baseSqlCommand.substring(baseSqlCommand.indexOf(":") + 1);
157
158
 
158
159
  var parameterName = "";
159
160
 
@@ -172,13 +173,13 @@ exports.process = function (command, onResult) {
172
173
  var parameterValue = parameter.value;
173
174
  if (parameter.typeGroup == "number") parameterValue = +parameter.value;
174
175
  else if (parameter.typeGroup == "datetime") parameterValue = new Date(parameter.value);
175
- if (parameters == null) parameter = {};
176
+ else if (parameter.typeGroup == "date") parameterValue = new Date(parameter.value);
177
+ else if (parameter.typeGroup == "time") parameterValue = new Date(parameter.value);
178
+ if (parameters == null) parameters = {};
176
179
  parameters[parameter.name] = parameterValue;
177
180
  }
178
- result += ':' + parameter.name;
179
181
  }
180
- else
181
- result += "@" + parameterName;
182
+ result += ':' + parameter.name;
182
183
  }
183
184
  }
184
185
 
@@ -1,14 +1,14 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2024.2.6
4
- Build date: 2024.05.20
3
+ Version: 2024.3.2
4
+ Build date: 2024.07.09
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 = "2024.2.6";
11
+ result.adapterVersion = "2024.3.2";
12
12
  onResult(result);
13
13
  }
14
14
  catch (e) {
@@ -27,11 +27,11 @@ exports.process = function (command, onResult) {
27
27
  });
28
28
  }
29
29
 
30
- var query = function (queryString, parameters) {
30
+ var query = function (queryString, parameters, maxDataRows) {
31
31
  client.query(queryString, parameters, function (error, recordset) {
32
32
  if (error) onError(error.message);
33
33
  else {
34
- onQuery(recordset);
34
+ onQuery(recordset, maxDataRows);
35
35
  }
36
36
  });
37
37
  }
@@ -42,16 +42,25 @@ exports.process = function (command, onResult) {
42
42
  command.queryString = "CALL " + command.queryString + "(" + command.parameters.map(parameter => "@" + parameter.name).join(", ") + ")";
43
43
 
44
44
  var { queryString, parameters } = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
45
- query(queryString, parameters);
45
+ query(queryString, parameters, command.maxDataRows);
46
46
  }
47
47
  else end({ success: true });
48
48
  }
49
49
 
50
- var onQuery = function (recordset) {
50
+ var onQuery = function (recordset, maxDataRows) {
51
51
  var columns = [];
52
52
  var rows = [];
53
53
  var types = [];
54
54
 
55
+ if (Array.isArray(recordset)) {
56
+ for (var resultIndex of recordset) {
57
+ if (recordset[resultIndex].command == "SELECT") {
58
+ recordset = recordset[resultIndex];
59
+ break;
60
+ }
61
+ }
62
+ }
63
+
55
64
  for (var columnIndex in recordset.fields) {
56
65
  var column = recordset.fields[columnIndex]
57
66
  columns.push(column.name);
@@ -137,7 +146,8 @@ exports.process = function (command, onResult) {
137
146
  }
138
147
  }
139
148
 
140
- if (recordset.rows.length > 0 && Array.isArray(recordset.rows[0])) recordset.rows = recordset.rows[0];
149
+ if (recordset.rows && recordset.rows.length > 0 && Array.isArray(recordset.rows[0])) recordset.rows = recordset.rows[0];
150
+
141
151
  for (var recordIndex in recordset.rows) {
142
152
  var row = [];
143
153
  for (var columnName in recordset.rows[recordIndex]) {
@@ -169,6 +179,7 @@ exports.process = function (command, onResult) {
169
179
 
170
180
  row[columnIndex] = recordset.rows[recordIndex][columnName];
171
181
  }
182
+ if (maxDataRows != null && maxDataRows <= rows.length) break;
172
183
  rows.push(row);
173
184
  }
174
185
 
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  Stimulsoft.Reports.JS
3
- Version: 2024.2.6
4
- Build date: 2024.05.20
3
+ Version: 2024.3.2
4
+ Build date: 2024.07.09
5
5
  License: https://www.stimulsoft.com/en/licensing/reports
6
6
  */
7
7
 
@@ -75,7 +75,7 @@ function getResponse(result) {
75
75
  return result
76
76
  }
77
77
  function onProcess(onResult, encryptData, result) {
78
- result.handlerVersion = "2024.2.6";
78
+ result.handlerVersion = "2024.3.2";
79
79
  result.checkVersion = true;
80
80
  result.encryptData = encryptData;
81
81
  onResult(result);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stimulsoft-data-adapter",
3
- "version": "2024.2.6",
3
+ "version": "2024.3.2",
4
4
  "description": "Nodejs data adapter for Stimulsoft Reports.JS",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -11,12 +11,12 @@
11
11
  "url": "https://github.com/stimulsoft/DataAdapters.JS/tree/main/NodejsDataAdapters"
12
12
  },
13
13
  "dependencies": {
14
- "mongodb": "^6.3.0",
14
+ "mongodb": "^6.7.0",
15
15
  "mssql": "^6.2.1",
16
- "mysql2": "^3.9.1",
16
+ "mysql2": "^3.10.0",
17
17
  "node-firebird": "^1.1.8",
18
- "oracledb": "^6.3.0",
19
- "pg": "^8.11.3",
18
+ "oracledb": "^6.5.1",
19
+ "pg": "^8.12.0",
20
20
  "tzdata": "^1.0.40"
21
21
  },
22
22
  "files": [