stimulsoft-data-adapter 2024.4.4 → 2025.1.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.
- package/FirebirdAdapter.js +147 -156
- package/MSSQLAdapter.js +3 -3
- package/MongoDBAdapter.js +3 -3
- package/MySQLAdapter.js +3 -3
- package/PostgreSQLAdapter.js +3 -3
- package/index.js +3 -3
- package/package.json +7 -7
package/FirebirdAdapter.js
CHANGED
|
@@ -1,189 +1,180 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Stimulsoft.Reports.JS
|
|
3
|
-
Version:
|
|
4
|
-
Build date: 2024.
|
|
3
|
+
Version: 2025.1.1
|
|
4
|
+
Build date: 2024.12.12
|
|
5
5
|
License: https://www.stimulsoft.com/en/licensing/reports
|
|
6
6
|
*/
|
|
7
7
|
exports.process = function (command, onResult) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
end({ success: false, notice: message });
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
var connect = function () {
|
|
24
|
-
Firebird.attach(options, function (error, db1) {
|
|
25
|
-
db = db1;
|
|
26
|
-
if (error) onError(error.message);
|
|
27
|
-
else onConnect();
|
|
28
|
-
});
|
|
8
|
+
setTimeout(async () => {
|
|
9
|
+
var db;
|
|
10
|
+
|
|
11
|
+
var end = function (result) {
|
|
12
|
+
try {
|
|
13
|
+
if (db) db.detach();
|
|
14
|
+
result.adapterVersion = "2025.1.1";
|
|
15
|
+
onResult(result);
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
}
|
|
29
19
|
}
|
|
30
20
|
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
if (error) onError(error.message);
|
|
34
|
-
else onQuery(recordset, maxDataRows);
|
|
35
|
-
db.detach();
|
|
36
|
-
});
|
|
21
|
+
var error = function (message) {
|
|
22
|
+
end({ success: false, notice: message });
|
|
37
23
|
}
|
|
38
24
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
try {
|
|
26
|
+
var connect = async function () {
|
|
27
|
+
db = await firebird.attachDataBase(options);
|
|
28
|
+
|
|
29
|
+
if (command.queryString) {
|
|
30
|
+
var queryString = applyQueryParameters(command.queryString, command.parameters, command.escapeQueryParameters);
|
|
31
|
+
await query(queryString, command.maxDataRows);
|
|
32
|
+
}
|
|
33
|
+
else end({ success: true });
|
|
43
34
|
}
|
|
44
|
-
else end({ success: true });
|
|
45
|
-
}
|
|
46
35
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
for (var
|
|
55
|
-
|
|
56
|
-
var
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
recordset[recordIndex][columnName]
|
|
60
|
-
recordset[recordIndex][columnName]
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
recordset[recordIndex][columnName]
|
|
66
|
-
|
|
67
|
-
|
|
36
|
+
var query = async function (queryString, maxDataRows) {
|
|
37
|
+
var recordset = await db.query(queryString);
|
|
38
|
+
|
|
39
|
+
var columns = [];
|
|
40
|
+
var rows = [];
|
|
41
|
+
var types = [];
|
|
42
|
+
var isColumnsFill = false;
|
|
43
|
+
for (var recordIndex in recordset) {
|
|
44
|
+
var row = [];
|
|
45
|
+
for (var columnName in recordset[recordIndex]) {
|
|
46
|
+
if (!isColumnsFill) columns.push(columnName);
|
|
47
|
+
var columnIndex = columns.indexOf(columnName);
|
|
48
|
+
types[columnIndex] = typeof recordset[recordIndex][columnName];
|
|
49
|
+
if (recordset[recordIndex][columnName] instanceof Uint8Array ||
|
|
50
|
+
recordset[recordIndex][columnName] instanceof Buffer) {
|
|
51
|
+
recordset[recordIndex][columnName] = recordset[recordIndex][columnName].toString();
|
|
52
|
+
types[columnIndex] = "string";
|
|
53
|
+
}
|
|
54
|
+
if (recordset[recordIndex][columnName] != null && typeof recordset[recordIndex][columnName].toISOString === "function") {
|
|
55
|
+
var dateTime = new Date(recordset[recordIndex][columnName].getTime() - (recordset[recordIndex][columnName].getTimezoneOffset() * 60000)).toISOString();
|
|
56
|
+
recordset[recordIndex][columnName] = dateTime.replace("Z", "");
|
|
57
|
+
types[columnIndex] = "datetime";
|
|
58
|
+
}
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
row[columnIndex] = recordset[recordIndex][columnName];
|
|
61
|
+
}
|
|
62
|
+
isColumnsFill = true;
|
|
63
|
+
if (maxDataRows != null && maxDataRows <= rows.length) break;
|
|
64
|
+
rows.push(row);
|
|
70
65
|
}
|
|
71
|
-
isColumnsFill = true;
|
|
72
|
-
if (maxDataRows != null && maxDataRows <= rows.length) break;
|
|
73
|
-
rows.push(row);
|
|
74
|
-
}
|
|
75
66
|
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
end({ success: true, columns: columns, rows: rows, types: types });
|
|
68
|
+
}
|
|
78
69
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
70
|
+
var getConnectionStringInfo = function (connectionString) {
|
|
71
|
+
var info = { host: "localhost", port: "3050" };
|
|
72
|
+
var isCorrect = false;
|
|
73
|
+
for (var propertyIndex in connectionString.split(";")) {
|
|
74
|
+
var property = connectionString.split(";")[propertyIndex];
|
|
75
|
+
if (property) {
|
|
76
|
+
var match = property.split("=");
|
|
77
|
+
if (match && match.length >= 2) {
|
|
78
|
+
match[0] = match[0].trim().toLowerCase();
|
|
79
|
+
match[1] = match[1].trim();
|
|
80
|
+
|
|
81
|
+
switch (match[0]) {
|
|
82
|
+
case "server":
|
|
83
|
+
case "host":
|
|
84
|
+
case "location":
|
|
85
|
+
case "datasource":
|
|
86
|
+
case "data source":
|
|
87
|
+
info["host"] = match[1];
|
|
88
|
+
break;
|
|
89
|
+
|
|
90
|
+
case "port":
|
|
91
|
+
info["port"] = match[1];
|
|
92
|
+
break;
|
|
93
|
+
|
|
94
|
+
case "database":
|
|
95
|
+
info["database"] = match[1];
|
|
96
|
+
isCorrect = true;
|
|
97
|
+
break;
|
|
98
|
+
|
|
99
|
+
case "uid":
|
|
100
|
+
case "user":
|
|
101
|
+
case "user id":
|
|
102
|
+
info["userId"] = match[1];
|
|
103
|
+
break;
|
|
104
|
+
|
|
105
|
+
case "pwd":
|
|
106
|
+
case "password":
|
|
107
|
+
info["password"] = match[1];
|
|
108
|
+
break;
|
|
109
|
+
|
|
110
|
+
case "charset":
|
|
111
|
+
info["charset"] = match[1];
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
122
114
|
}
|
|
123
115
|
}
|
|
124
116
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
};
|
|
117
|
+
if (!isCorrect) {
|
|
118
|
+
error("Connection String parse error");
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
return info;
|
|
122
|
+
};
|
|
132
123
|
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
var applyQueryParameters = function (baseSqlCommand, parameters, escapeQueryParameters) {
|
|
125
|
+
if (baseSqlCommand == null || baseSqlCommand.indexOf("@") < 0) return baseSqlCommand;
|
|
135
126
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
127
|
+
var result = "";
|
|
128
|
+
while (baseSqlCommand.indexOf("@") >= 0 && parameters != null && parameters.length > 0) {
|
|
129
|
+
result += baseSqlCommand.substring(0, baseSqlCommand.indexOf("@"));
|
|
130
|
+
baseSqlCommand = baseSqlCommand.substring(baseSqlCommand.indexOf("@") + 1);
|
|
140
131
|
|
|
141
|
-
|
|
132
|
+
var parameterName = "";
|
|
142
133
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
134
|
+
while (baseSqlCommand.length > 0) {
|
|
135
|
+
var char = baseSqlCommand.charAt(0);
|
|
136
|
+
if (char.length === 1 && char.match(/[a-zA-Z0-9_-]/i)) {
|
|
137
|
+
parameterName += char;
|
|
138
|
+
baseSqlCommand = baseSqlCommand.substring(1);
|
|
139
|
+
}
|
|
140
|
+
else break;
|
|
148
141
|
}
|
|
149
|
-
else break;
|
|
150
|
-
}
|
|
151
142
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
143
|
+
var parameter = parameters.find(parameter => parameter.name.toLowerCase() == parameterName.toLowerCase());
|
|
144
|
+
if (parameter) {
|
|
145
|
+
if (parameter.typeGroup != "number") {
|
|
146
|
+
if (escapeQueryParameters)
|
|
147
|
+
result += "'" + parameter.value.toString().replace(/\\/gi, "\\\\").replace(/\'/gi, "\\\'").replace(/\"/gi, "\\\"") + "'";
|
|
148
|
+
else
|
|
149
|
+
result += "'" + parameter.value.toString() + "'";
|
|
150
|
+
}
|
|
157
151
|
else
|
|
158
|
-
result +=
|
|
152
|
+
result += parameter.value.toString();
|
|
159
153
|
}
|
|
160
154
|
else
|
|
161
|
-
result +=
|
|
155
|
+
result += "@" + parameterName;
|
|
162
156
|
}
|
|
163
|
-
|
|
164
|
-
|
|
157
|
+
|
|
158
|
+
return result + baseSqlCommand;
|
|
165
159
|
}
|
|
166
160
|
|
|
167
|
-
|
|
161
|
+
const firebird = require("limber-firebird-client");
|
|
162
|
+
command.connectionStringInfo = getConnectionStringInfo(command.connectionString);
|
|
163
|
+
if (command.connectionStringInfo) {
|
|
164
|
+
var options = {
|
|
165
|
+
host: command.connectionStringInfo.host,
|
|
166
|
+
port: command.connectionStringInfo.port,
|
|
167
|
+
database: command.connectionStringInfo.database,
|
|
168
|
+
user: command.connectionStringInfo.userId,
|
|
169
|
+
password: command.connectionStringInfo.password,
|
|
170
|
+
charset: command.connectionStringInfo.charset,
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
await connect();
|
|
174
|
+
}
|
|
168
175
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
command.connectionStringInfo = getConnectionStringInfo(command.connectionString);
|
|
172
|
-
if (command.connectionStringInfo) {
|
|
173
|
-
var options = {
|
|
174
|
-
host: command.connectionStringInfo.host,
|
|
175
|
-
port: command.connectionStringInfo.port,
|
|
176
|
-
database: command.connectionStringInfo.database,
|
|
177
|
-
user: command.connectionStringInfo.userId,
|
|
178
|
-
password: command.connectionStringInfo.password,
|
|
179
|
-
charset: command.connectionStringInfo.charset,
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
connect();
|
|
183
|
-
var db;
|
|
176
|
+
catch (e) {
|
|
177
|
+
error(e.message);
|
|
184
178
|
}
|
|
185
|
-
}
|
|
186
|
-
catch (e) {
|
|
187
|
-
onError(e.stack);
|
|
188
|
-
}
|
|
179
|
+
});
|
|
189
180
|
}
|
package/MSSQLAdapter.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Stimulsoft.Reports.JS
|
|
3
|
-
Version:
|
|
4
|
-
Build date: 2024.
|
|
3
|
+
Version: 2025.1.1
|
|
4
|
+
Build date: 2024.12.12
|
|
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 = "
|
|
11
|
+
result.adapterVersion = "2025.1.1";
|
|
12
12
|
onResult(result);
|
|
13
13
|
}
|
|
14
14
|
catch (e) {
|
package/MongoDBAdapter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Stimulsoft.Reports.JS
|
|
3
|
-
Version:
|
|
4
|
-
Build date: 2024.
|
|
3
|
+
Version: 2025.1.1
|
|
4
|
+
Build date: 2024.12.12
|
|
5
5
|
License: https://www.stimulsoft.com/en/licensing/reports
|
|
6
6
|
*/
|
|
7
7
|
exports.process = function (command, onResult) {
|
|
@@ -127,7 +127,7 @@ exports.process = function (command, onResult) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
client.close();
|
|
130
|
-
result.adapterVersion = "
|
|
130
|
+
result.adapterVersion = "2025.1.1";
|
|
131
131
|
onResult(result);
|
|
132
132
|
});
|
|
133
133
|
}
|
package/MySQLAdapter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Stimulsoft.Reports.JS
|
|
3
|
-
Version:
|
|
4
|
-
Build date: 2024.
|
|
3
|
+
Version: 2025.1.1
|
|
4
|
+
Build date: 2024.12.12
|
|
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 = "
|
|
16
|
+
result.adapterVersion = "2025.1.1";
|
|
17
17
|
onResult(result);
|
|
18
18
|
}
|
|
19
19
|
}
|
package/PostgreSQLAdapter.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Stimulsoft.Reports.JS
|
|
3
|
-
Version:
|
|
4
|
-
Build date: 2024.
|
|
3
|
+
Version: 2025.1.1
|
|
4
|
+
Build date: 2024.12.12
|
|
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 = "
|
|
11
|
+
result.adapterVersion = "2025.1.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:
|
|
4
|
-
Build date: 2024.
|
|
3
|
+
Version: 2025.1.1
|
|
4
|
+
Build date: 2024.12.12
|
|
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 = "
|
|
78
|
+
result.handlerVersion = "2025.1.1";
|
|
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": "
|
|
3
|
+
"version": "2025.1.1",
|
|
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
|
-
"
|
|
14
|
+
"limber-firebird-client": "^3.0.17",
|
|
15
|
+
"mongodb": "^6.11.0",
|
|
15
16
|
"mssql": "^11.0.1",
|
|
16
|
-
"mysql2": "^3.11.
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"pg": "^8.13.0",
|
|
17
|
+
"mysql2": "^3.11.5",
|
|
18
|
+
"oracledb": "^6.7.0",
|
|
19
|
+
"pg": "^8.13.1",
|
|
20
20
|
"tzdata": "^1.0.42"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
@@ -50,4 +50,4 @@
|
|
|
50
50
|
],
|
|
51
51
|
"license": "Closed Source",
|
|
52
52
|
"homepage": "https://github.com/stimulsoft/DataAdapters.JS/tree/main/NodejsDataAdapters"
|
|
53
|
-
}
|
|
53
|
+
}
|