Skip to content

Connection.Interface.QueryScalarOptions

Christian d'Heureuse edited this page Nov 27, 2026 · 1 revision

tedious-plus / Connection / QueryScalarOptions

Interface: QueryScalarOptions<DT>

Defined in: Connection.ts:48

Options for Connection.queryScalar.

Extends

Type Parameters

DT

DT extends JsValueDataType = JsValueDataType

Properties

dataType?

dataType?: DT;

Defined in: Connection.ts:56

The expected data type of the returned value.

The data type is verified at runtime and determines the TypeScript type of the returned value. Without this option, the value is returned with the type any.


paramDefArray?

paramDefArray?: SqlParamDef[];

Defined in: utils/TediousUtils.ts:394

This variant is used to specify full parameter definitions as an array.

Example:

[
   {name: "p1", type: Tedious.TYPES.Int, value: 123},
   {name: "p2", type: Tedious.TYPES.NVarChar, value: "abc"}
]

Inherited from

CommonRequestOptions.paramDefArray


paramDefs?

paramDefs?: Record<string, SqlParamValueAndDataType>;

Defined in: utils/TediousUtils.ts:381

This variant is used to specify full parameter definitions as an object.

Example:

{
   p1: {type: Tedious.TYPES.Int, value: 123},
   p2: {type: Tedious.TYPES.NVarChar, value: "abc"}
}

Inherited from

CommonRequestOptions.paramDefs


params?

params?: Record<string, unknown>;

Defined in: utils/TediousUtils.ts:357

This variant is used to specify parameter names and values.

Example: {p1: 123, p2: "abc"}

The data types are derived from the values (see deriveParamDataTypeFromValue).

Inherited from

CommonRequestOptions.params


paramValues?

paramValues?: unknown[];

Defined in: utils/TediousUtils.ts:368

This variant is used to specify only the parameter values.

Example: [123, "abc"]

The parameter names a, b, c, ... are generated (see genParamName), so the parameters are referenced as @a, @b, @c, ... in the SQL code. The data types are derived from the values (see deriveParamDataTypeFromValue).

Inherited from

CommonRequestOptions.paramValues


timeoutMs?

timeoutMs?: number;

Defined in: Connection.ts:26

The number of milliseconds before the request is considered failed, or 0 for no timeout. When no timeout is set, the options.requestTimeout of the Connection is used.

Inherited from

CommonRequestOptions.timeoutMs

Clone this wiki locally