import { type CryptoMetadata } from './always-encrypted/types'; import { type InternalConnectionOptions } from './connection'; import { Collation } from './collation'; export interface Parameter { type: DataType; name: string; value: unknown; output: boolean; length?: number | undefined; precision?: number | undefined; scale?: number | undefined; nullable?: boolean | undefined; forceEncrypt?: boolean | undefined; cryptoMetadata?: CryptoMetadata | undefined; encryptedVal?: Buffer | undefined; } export interface ParameterData { length?: number | undefined; scale?: number | undefined; precision?: number | undefined; collation?: Collation | undefined; value: T; } export interface DataType { id: number; type: string; name: string; declaration(parameter: Parameter): string; generateTypeInfo(parameter: ParameterData, options: InternalConnectionOptions): Buffer; generateParameterLength(parameter: ParameterData, options: InternalConnectionOptions): Buffer; generateParameterData(parameter: ParameterData, options: InternalConnectionOptions): Generator; validate(value: any, collation: Collation | undefined, options?: InternalConnectionOptions): any; hasTableName?: boolean; resolveLength?: (parameter: Parameter) => number; resolvePrecision?: (parameter: Parameter) => number; resolveScale?: (parameter: Parameter) => number; } export declare const TYPE: { [x: number]: DataType; }; /** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
TypeConstantJavaScriptResult setParameter
Exact numerics
bit[[TYPES.Bit]]boolean
tinyint[[TYPES.TinyInt]]number
smallint[[TYPES.SmallInt]]number
int[[TYPES.Int]]number
bigint1[[TYPES.BigInt]]string
numeric2[[TYPES.Numeric]]number
decimal2[[TYPES.Decimal]]number
smallmoney[[TYPES.SmallMoney]]number
money[[TYPES.Money]]number
Approximate numerics
float[[TYPES.Float]]number
real[[TYPES.Real]]number
Date and Time
smalldatetime[[TYPES.SmallDateTime]]Date
datetime[[TYPES.DateTime]]Date
datetime2[[TYPES.DateTime2]]Date
datetimeoffset[[TYPES.DateTimeOffset]]Date
time[[TYPES.Time]]Date
date[[TYPES.Date]]Date
Character Strings
char[[TYPES.Char]]string
varchar3[[TYPES.VarChar]]string
text[[TYPES.Text]]string
Unicode Strings
nchar[[TYPES.NChar]]string
nvarchar3[[TYPES.NVarChar]]string
ntext[[TYPES.NText]]string-
Binary Strings4
binary[[TYPES.Binary]]Buffer
varbinary[[TYPES.VarBinary]]Buffer
image[[TYPES.Image]]Buffer
Other Data Types
TVP[[TYPES.TVP]]Object-
UDT[[TYPES.UDT]]Buffer-
uniqueidentifier4[[TYPES.UniqueIdentifier]]string
variant[[TYPES.Variant]]any-
xml[[TYPES.Xml]]string-
* *
    *
  1. *

    BigInt

    *

    * Values are returned as a string. This is because values can exceed 53 bits of significant data, which is greater than a * Javascript number type can represent as an integer. *

    *
  2. *
  3. *

    Numerical, Decimal

    *

    * For input parameters, default precision is 18 and default scale is 0. Maximum supported precision is 19. *

    *
  4. *
  5. *

    VarChar, NVarChar

    *

    * varchar(max) and nvarchar(max) are also supported. *

    *
  6. *
  7. *

    UniqueIdentifier

    *

    * Values are returned as a 16 byte hexadecimal string. *

    *

    * Note that the order of bytes is not the same as the character representation. See * Using uniqueidentifier Data * for an example of the different ordering of bytes. *

    *
  8. *
*/ export declare const TYPES: { TinyInt: DataType; Bit: DataType; SmallInt: DataType; Int: DataType; SmallDateTime: DataType; Real: DataType; Money: DataType; DateTime: DataType; Float: DataType; Decimal: DataType & { resolvePrecision: NonNullable; resolveScale: NonNullable; }; Numeric: DataType & { resolveScale: NonNullable; resolvePrecision: NonNullable; }; SmallMoney: DataType; BigInt: DataType; Image: DataType; Text: DataType; UniqueIdentifier: DataType; NText: DataType; VarBinary: { maximumLength: number; } & DataType; VarChar: { maximumLength: number; } & DataType; Binary: { maximumLength: number; } & DataType; Char: { maximumLength: number; } & DataType; NVarChar: { maximumLength: number; } & DataType; NChar: DataType & { maximumLength: number; }; Xml: DataType; Time: DataType; Date: DataType; DateTime2: DataType & { resolveScale: NonNullable; }; DateTimeOffset: DataType & { resolveScale: NonNullable; }; UDT: DataType; TVP: DataType; Variant: DataType; }; export declare const typeByName: { TinyInt: DataType; Bit: DataType; SmallInt: DataType; Int: DataType; SmallDateTime: DataType; Real: DataType; Money: DataType; DateTime: DataType; Float: DataType; Decimal: DataType & { resolvePrecision: NonNullable; resolveScale: NonNullable; }; Numeric: DataType & { resolveScale: NonNullable; resolvePrecision: NonNullable; }; SmallMoney: DataType; BigInt: DataType; Image: DataType; Text: DataType; UniqueIdentifier: DataType; NText: DataType; VarBinary: { maximumLength: number; } & DataType; VarChar: { maximumLength: number; } & DataType; Binary: { maximumLength: number; } & DataType; Char: { maximumLength: number; } & DataType; NVarChar: { maximumLength: number; } & DataType; NChar: DataType & { maximumLength: number; }; Xml: DataType; Time: DataType; Date: DataType; DateTime2: DataType & { resolveScale: NonNullable; }; DateTimeOffset: DataType & { resolveScale: NonNullable; }; UDT: DataType; TVP: DataType; Variant: DataType; };