dbgate-datalib 5.1.2 → 5.1.4
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/lib/PerspectiveCache.js
CHANGED
|
@@ -6,4 +6,5 @@ export declare class PerspectiveDataLoader {
|
|
|
6
6
|
buildCondition(props: PerspectiveDataLoadProps): Condition;
|
|
7
7
|
loadGrouping(props: PerspectiveDataLoadProps): Promise<any>;
|
|
8
8
|
loadData(props: PerspectiveDataLoadProps): Promise<any>;
|
|
9
|
+
loadRowCount(props: PerspectiveDataLoadProps): Promise<any>;
|
|
9
10
|
}
|
|
@@ -135,5 +135,32 @@ class PerspectiveDataLoader {
|
|
|
135
135
|
return response.rows;
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
+
loadRowCount(props) {
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
const { schemaName, pureName, bindingColumns, bindingValues, dataColumns, orderBy, condition } = props;
|
|
141
|
+
const select = {
|
|
142
|
+
commandType: 'select',
|
|
143
|
+
from: {
|
|
144
|
+
name: { schemaName, pureName },
|
|
145
|
+
},
|
|
146
|
+
columns: [
|
|
147
|
+
{
|
|
148
|
+
exprType: 'raw',
|
|
149
|
+
sql: 'COUNT(*)',
|
|
150
|
+
alias: 'count',
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
where: this.buildCondition(props),
|
|
154
|
+
};
|
|
155
|
+
const response = yield this.apiCall('database-connections/sql-select', {
|
|
156
|
+
conid: props.databaseConfig.conid,
|
|
157
|
+
database: props.databaseConfig.database,
|
|
158
|
+
select,
|
|
159
|
+
});
|
|
160
|
+
if (response.errorMessage)
|
|
161
|
+
return response;
|
|
162
|
+
return response.rows[0];
|
|
163
|
+
});
|
|
164
|
+
}
|
|
138
165
|
}
|
|
139
166
|
exports.PerspectiveDataLoader = PerspectiveDataLoader;
|
|
@@ -177,5 +177,19 @@ class PerspectiveDataProvider {
|
|
|
177
177
|
return tableCache.getRowsResult(props);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
|
+
loadRowCount(props) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
const tableCache = this.cache.getTableCache(props);
|
|
183
|
+
if (tableCache.allRowCount != null) {
|
|
184
|
+
return tableCache.allRowCount;
|
|
185
|
+
}
|
|
186
|
+
const result = yield this.loader.loadRowCount(Object.assign({}, props));
|
|
187
|
+
if (result.errorMessage) {
|
|
188
|
+
throw new Error(result.errorMessage);
|
|
189
|
+
}
|
|
190
|
+
tableCache.allRowCount = parseInt(result.count);
|
|
191
|
+
return tableCache.allRowCount;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
180
194
|
}
|
|
181
195
|
exports.PerspectiveDataProvider = PerspectiveDataProvider;
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.1.
|
|
2
|
+
"version": "5.1.4",
|
|
3
3
|
"name": "dbgate-datalib",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"typings": "lib/index.d.ts",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"lib"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"dbgate-sqltree": "^5.1.
|
|
17
|
-
"dbgate-tools": "^5.1.
|
|
18
|
-
"dbgate-filterparser": "^5.1.
|
|
16
|
+
"dbgate-sqltree": "^5.1.4",
|
|
17
|
+
"dbgate-tools": "^5.1.4",
|
|
18
|
+
"dbgate-filterparser": "^5.1.4"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"dbgate-types": "^5.1.
|
|
21
|
+
"dbgate-types": "^5.1.4",
|
|
22
22
|
"@types/node": "^13.7.0",
|
|
23
23
|
"jest": "^28.1.3",
|
|
24
24
|
"ts-jest": "^28.0.7",
|