From 5b9d1a8c6a805bac49ceac5ceb33b6921fa4ada4 Mon Sep 17 00:00:00 2001 From: Pierre Anctil Date: Thu, 24 Dec 2015 08:44:46 +0100 Subject: [PATCH] Add typing for execute methods --- mssql/mssql-tests.ts | 18 ++++++++++++++++++ mssql/mssql.d.ts | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mssql/mssql-tests.ts b/mssql/mssql-tests.ts index eda326c4a..f1f1a20b2 100644 --- a/mssql/mssql-tests.ts +++ b/mssql/mssql-tests.ts @@ -66,6 +66,15 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) } }); + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(returnValue); + } + }); + var requestStoredProcedureWithOutput = new sql.Request(connection); var testId: number = 0; var testString: string = 'test'; @@ -90,6 +99,15 @@ var connection: sql.Connection = new sql.Connection(config, function (err: any) console.info(requestStoredProcedureWithOutput.parameters['output'].value); } }); + + requestStoredProcedure.execute('StoredProcedureName', function (err, recordsets, returnValue) { + if (err != null) { + console.error('Error happened calling Query: ' + err.name + " " + err.message); + } + else { + console.info(requestStoredProcedureWithOutput.parameters['output'].value); + } + }); } }); diff --git a/mssql/mssql.d.ts b/mssql/mssql.d.ts index 1e203582b..2b3db4807 100644 --- a/mssql/mssql.d.ts +++ b/mssql/mssql.d.ts @@ -200,7 +200,7 @@ declare module "mssql" { public constructor(transaction: Transaction); public constructor(preparedStatement: PreparedStatement); public execute(procedure: string): Promise; - public execute(procedure: string, callback: (err?: any, recordsets?: any, returnValue?: any) => void): void; + public execute(procedure: string, callback: (err?: any, recordsets?: Entity[], returnValue?: any) => void): void; public input(name: string, value: any): void; public input(name: string, type: any, value: any): void; public output(name: string, type: any, value?: any): void; @@ -258,7 +258,9 @@ declare module "mssql" { public prepare(statement?: string): Promise; public prepare(statement?: string, callback?: (err?: any) => void): void; public execute(values: Object): Promise; + public execute(values: Object): Promise; public execute(values: Object, callback: (err: any, recordSet: recordSet) => void): void; + public execute(values: Object, callback: (err: any, recordSet: Entity[]) => void): void; public unprepare(): Promise; public unprepare(callback: (err?: any) => void): void; }