|
|
|
@ -10,19 +10,17 @@ export default class XcProcedure {
|
|
|
|
|
public async callFunction(name: string, args: any[]) { |
|
|
|
|
try { |
|
|
|
|
if (this.builder.getDbType() === 'mssql') { |
|
|
|
|
const result = await (await this.builder |
|
|
|
|
.getDbDriver()) |
|
|
|
|
.raw( |
|
|
|
|
`select dbo.??(${new Array(args.length) |
|
|
|
|
.fill('?') |
|
|
|
|
.join(',')}) as ??`,
|
|
|
|
|
const result = await ( |
|
|
|
|
await this.builder.getDbDriver() |
|
|
|
|
).raw( |
|
|
|
|
`select dbo.??(${new Array(args.length).fill('?').join(',')}) as ??`, |
|
|
|
|
[name, ...args, name] |
|
|
|
|
); |
|
|
|
|
return result[0]; |
|
|
|
|
} else { |
|
|
|
|
const result = await (await this.builder |
|
|
|
|
.getDbDriver()) |
|
|
|
|
.raw( |
|
|
|
|
const result = await ( |
|
|
|
|
await this.builder.getDbDriver() |
|
|
|
|
).raw( |
|
|
|
|
`select ??(${new Array(args.length).fill('?').join(',')}) as ??`, |
|
|
|
|
[name, ...args, name] |
|
|
|
|
); |
|
|
|
@ -76,9 +74,9 @@ export default class XcProcedure {
|
|
|
|
|
); |
|
|
|
|
return [result[count][0][0]]; |
|
|
|
|
} else if (this.builder.getDbType() === 'pg') { |
|
|
|
|
const result = await (await this.builder |
|
|
|
|
.getDbDriver()) |
|
|
|
|
.raw(`Call ??(${new Array(args.length).fill('?').join(',')})`, [ |
|
|
|
|
const result = await ( |
|
|
|
|
await this.builder.getDbDriver() |
|
|
|
|
).raw(`Call ??(${new Array(args.length).fill('?').join(',')})`, [ |
|
|
|
|
name, |
|
|
|
|
...args, |
|
|
|
|
]); |
|
|
|
|