mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 18:34:01 +00:00
tsql call
This commit is contained in:
@@ -785,7 +785,11 @@ export class SqlDumper implements AlterProcessor {
|
||||
}
|
||||
|
||||
declareVariable(name: string, type: string, defaultValueLiteral?: string) {}
|
||||
executeCallable(func: CallableObjectInfo, argLiterals: string[]) {
|
||||
this.putCmd('^call %f(%,s)', func, argLiterals);
|
||||
executeCallable(func: CallableObjectInfo, argLiteralsByName: { [name: string]: string }) {
|
||||
this.putCmd(
|
||||
'^call %f(%,s)',
|
||||
func,
|
||||
(func.parameters || []).map(x => argLiteralsByName[x.parameterName])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
2
packages/types/dumper.d.ts
vendored
2
packages/types/dumper.d.ts
vendored
@@ -18,7 +18,7 @@ export interface SqlDumper extends AlterProcessor {
|
||||
dropDatabase(name: string);
|
||||
|
||||
declareVariable(name: string, type: string, defaultValueLiteral?: string);
|
||||
executeCallable(func: CallableObjectInfo, argLiterals: string[]);
|
||||
executeCallable(func: CallableObjectInfo, argLiteralsByName: { [name: string]: string });
|
||||
|
||||
endCommand();
|
||||
allowIdentityInsert(table: NamedObjectInfo, allow: boolean);
|
||||
|
||||
@@ -77,7 +77,7 @@ export default async function applyScriptTemplate(
|
||||
const driver = findEngineDriver(connection, extensions) || driverBase;
|
||||
const dmp = driver.createDumper();
|
||||
if (procedureInfo) {
|
||||
const sqlVars = [];
|
||||
const argLiteralsByName = {};
|
||||
for (const param of procedureInfo.parameters || []) {
|
||||
const sqlVarName = param.parameterName?.startsWith('@')
|
||||
? param.parameterName?.substring(1)
|
||||
@@ -88,9 +88,9 @@ export default async function applyScriptTemplate(
|
||||
param.dataType,
|
||||
param.parameterMode == 'OUT' ? null : `:${sqlVarName}`
|
||||
);
|
||||
sqlVars.push(param.parameterName);
|
||||
argLiteralsByName[param.parameterName] = param.parameterName;
|
||||
}
|
||||
dmp.executeCallable(procedureInfo, sqlVars);
|
||||
dmp.executeCallable(procedureInfo, argLiteralsByName);
|
||||
}
|
||||
// if (procedureInfo) dmp.put('^execute %f', procedureInfo);
|
||||
return dmp.s;
|
||||
|
||||
Reference in New Issue
Block a user