badmfck-api-server 4.0.86 → 4.0.87
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/dist/apiServer/DBService.d.ts +1 -0
- package/dist/apiServer/DBService.js +6 -0
- package/dist/apiServer/db/IDBAdapter.d.ts +1 -0
- package/dist/apiServer/db/MysqlAdapter.d.ts +1 -0
- package/dist/apiServer/db/MysqlAdapter.js +3 -0
- package/dist/apiServer/db/PostgresAdapter.d.ts +1 -0
- package/dist/apiServer/db/PostgresAdapter.js +3 -0
- package/package.json +1 -1
|
@@ -127,6 +127,7 @@ export declare class DBService extends BaseService {
|
|
|
127
127
|
adapter: IDBAdapter | null;
|
|
128
128
|
constructor(options: IDBSericeOptions);
|
|
129
129
|
init(): Promise<void>;
|
|
130
|
+
escape(id: string, value: string): string;
|
|
130
131
|
getAdapter(dbid?: string | null): IDBAdapter | IDBError;
|
|
131
132
|
reportQuery(result: IDBResult, req: IDBQuery): Promise<void>;
|
|
132
133
|
finishService(): Promise<void>;
|
|
@@ -240,6 +240,12 @@ class DBService extends BaseService_1.BaseService {
|
|
|
240
240
|
return errorResult;
|
|
241
241
|
};
|
|
242
242
|
}
|
|
243
|
+
escape(id, value) {
|
|
244
|
+
const adapter = this.getAdapter(id);
|
|
245
|
+
if (!adapter || "errno" in adapter)
|
|
246
|
+
return value;
|
|
247
|
+
return adapter.escape(value);
|
|
248
|
+
}
|
|
243
249
|
getAdapter(dbid) {
|
|
244
250
|
if (!dbid && DBService.allInstances.length === 1 && DBService.allInstances[0].adapter)
|
|
245
251
|
return DBService.allInstances[0].adapter;
|
|
@@ -31,6 +31,7 @@ export declare class MysqlAdapter implements IDBAdapter {
|
|
|
31
31
|
poolConnections: number;
|
|
32
32
|
acquiredPoolConnections: number;
|
|
33
33
|
constructor(options: DBAdapterOptions);
|
|
34
|
+
escape(value: string): string;
|
|
34
35
|
init(): Promise<void>;
|
|
35
36
|
poolStatus(): {
|
|
36
37
|
lastSuccessQueryTime: string;
|
|
@@ -39,6 +39,9 @@ class MysqlAdapter {
|
|
|
39
39
|
if (this.options.password.startsWith("_"))
|
|
40
40
|
this.options.password = decrypt(this.options.password.substring(1)) ?? this.options.password;
|
|
41
41
|
}
|
|
42
|
+
escape(value) {
|
|
43
|
+
return promise_1.default.escape(value);
|
|
44
|
+
}
|
|
42
45
|
async init() {
|
|
43
46
|
if (this.options.transactionFailReportDir) {
|
|
44
47
|
try {
|
|
@@ -18,6 +18,7 @@ export declare class PostgresAdapter implements IDBAdapter {
|
|
|
18
18
|
poolConnections: number;
|
|
19
19
|
acquiredPoolConnections: number;
|
|
20
20
|
constructor(options: DBAdapterOptions);
|
|
21
|
+
escape(value: string): string;
|
|
21
22
|
tBegin?(): Promise<IDBResult>;
|
|
22
23
|
tCommit?(trxid: number): Promise<IDBResult>;
|
|
23
24
|
tRollback?(trxid: number): Promise<IDBResult>;
|