@ejfdelgado/ejflab-common 1.13.4 → 1.14.0
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/package.json
CHANGED
package/src/MyDates.js
CHANGED
|
@@ -10,7 +10,8 @@ class CommandPostgres extends CommandBasic {
|
|
|
10
10
|
const script = this.args[3];
|
|
11
11
|
const destination = this.args[4];
|
|
12
12
|
const postgresSrv = this.context.getSuperContext().getPostgresClient();
|
|
13
|
-
|
|
13
|
+
const paging = action == "page";
|
|
14
|
+
if (["execute", "page"].indexOf(action) >= 0) {
|
|
14
15
|
//console.log("Starting execute...");
|
|
15
16
|
const dbIdData = SimpleObj.getValue(this.context.data, dbIdPath, null);
|
|
16
17
|
let bodyData = {};
|
|
@@ -35,7 +36,21 @@ class CommandPostgres extends CommandBasic {
|
|
|
35
36
|
const payload = JSON.parse(JSON.stringify(dbIdData));
|
|
36
37
|
payload.object = bodyData[i];
|
|
37
38
|
payload.now = now;
|
|
38
|
-
const result =
|
|
39
|
+
const result = { rows: [], rowCount: 0, command: null };
|
|
40
|
+
let localResult = { rows: [], rowCount: 0, command: null };
|
|
41
|
+
if (paging) {
|
|
42
|
+
if (typeof payload.limit !== "number") {
|
|
43
|
+
payload.limit = 20;
|
|
44
|
+
}
|
|
45
|
+
payload.offset = 0;
|
|
46
|
+
}
|
|
47
|
+
do {
|
|
48
|
+
localResult = await postgresSrv.executeFile(script, payload, client);
|
|
49
|
+
result.rows.push(...localResult.rows);
|
|
50
|
+
result.rowCount += localResult.rowCount;
|
|
51
|
+
result.command = localResult.command;
|
|
52
|
+
payload.offset += result.rows.length;
|
|
53
|
+
} while (paging && localResult.rows.length > 0);
|
|
39
54
|
response.push(result);
|
|
40
55
|
}
|
|
41
56
|
await client.query("COMMIT");
|