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