Repository navigation
ConnectionPromises.Function.execSql
tedious-plus / ConnectionPromises / execSql
function execSql(connection, request): Promise<RequestResult<"ObjectRow">>;Defined in: ConnectionPromises.ts:236
Executes an SQL query and returns the result.
This is a promisified version of Connection.execSql().
The rows of the result set are buffered in an array and returned on completion.
The optional parameter rowType specifies the format of the rows (default: "ObjectRow").
Usage:
const request = new Tedious.Request("select name from sys.databases", () => {});
const result = await ConnectionPromises.execSql(connection, request);
console.log(result.rows);Connection
An open Tedious connection.
Request
The Tedious request to be executed.
Promise<RequestResult<"ObjectRow">>
A promise for the result of the request. The promise is rejected when the request fails.
function execSql<RT>(
connection,
request,
rowType
): Promise<RequestResult<RT>>;Defined in: ConnectionPromises.ts:237
Executes an SQL query and returns the result.
This is a promisified version of Connection.execSql().
The rows of the result set are buffered in an array and returned on completion.
The optional parameter rowType specifies the format of the rows (default: "ObjectRow").
Usage:
const request = new Tedious.Request("select name from sys.databases", () => {});
const result = await ConnectionPromises.execSql(connection, request);
console.log(result.rows);RT extends RowType
Connection
An open Tedious connection.
Request
The Tedious request to be executed.
RT
Promise<RequestResult<RT>>
A promise for the result of the request. The promise is rejected when the request fails.