@types/mssql
- Version 9.1.5
- Published
- 21.7 kB
- 3 dependencies
- MIT license
Install
npm i @types/mssql
yarn add @types/mssql
pnpm add @types/mssql
Overview
TypeScript definitions for mssql
Index
Variables
Functions
Classes
Interfaces
Type Aliases
Variables
variable BigInt
var BigInt: ISqlTypeFactoryWithNoParams;
variable Binary
var Binary: ISqlTypeFactoryWithNoParams;
variable Bit
var Bit: ISqlTypeFactoryWithNoParams;
variable Char
var Char: ISqlTypeFactoryWithLength;
variable Date
var Date: ISqlTypeFactoryWithNoParams;
variable DateTime
var DateTime: ISqlTypeFactoryWithNoParams;
variable DateTime2
var DateTime2: ISqlTypeFactoryWithScale;
variable DateTimeOffset
var DateTimeOffset: ISqlTypeFactoryWithScale;
variable Decimal
var Decimal: ISqlTypeFactoryWithPrecisionScale;
variable DRIVERS
var DRIVERS: string[];
variable fix
var fix: boolean;
variable Float
var Float: ISqlTypeFactoryWithNoParams;
variable Geography
var Geography: ISqlTypeFactoryWithNoParams;
variable Geometry
var Geometry: ISqlTypeFactoryWithNoParams;
variable Image
var Image: ISqlTypeFactoryWithNoParams;
variable Int
var Int: ISqlTypeFactoryWithNoParams;
variable ISOLATION_LEVEL
var ISOLATION_LEVEL: { READ_UNCOMMITTED: IIsolationLevel; READ_COMMITTED: IIsolationLevel; REPEATABLE_READ: IIsolationLevel; SERIALIZABLE: IIsolationLevel; SNAPSHOT: IIsolationLevel;};
variable map
var map: IMap;
variable MAX
var MAX: number;
variable Money
var Money: ISqlTypeFactoryWithNoParams;
variable NChar
var NChar: ISqlTypeFactoryWithLength;
variable NText
var NText: ISqlTypeFactoryWithNoParams;
variable Numeric
var Numeric: ISqlTypeFactoryWithPrecisionScale;
variable NVarChar
var NVarChar: ISqlTypeFactoryWithLength;
variable pool
var pool: ConnectionPool;
variable Promise
var Promise: any;
variable Real
var Real: ISqlTypeFactoryWithNoParams;
variable SmallDateTime
var SmallDateTime: ISqlTypeFactoryWithNoParams;
variable SmallInt
var SmallInt: ISqlTypeFactoryWithNoParams;
variable SmallMoney
var SmallMoney: ISqlTypeFactoryWithNoParams;
variable Text
var Text: ISqlTypeFactoryWithNoParams;
variable Time
var Time: ISqlTypeFactoryWithScale;
variable TinyInt
var TinyInt: ISqlTypeFactoryWithNoParams;
variable TVP
var TVP: ISqlTypeFactoryWithTvpType;
variable TYPES
var TYPES: { VarChar: ISqlTypeFactoryWithLength; NVarChar: ISqlTypeFactoryWithLength; Text: ISqlTypeFactoryWithNoParams; Int: ISqlTypeFactoryWithNoParams; BigInt: ISqlTypeFactoryWithNoParams; TinyInt: ISqlTypeFactoryWithNoParams; SmallInt: ISqlTypeFactoryWithNoParams; Bit: ISqlTypeFactoryWithNoParams; Float: ISqlTypeFactoryWithNoParams; Numeric: ISqlTypeFactoryWithPrecisionScale; Decimal: ISqlTypeFactoryWithPrecisionScale; Real: ISqlTypeFactoryWithNoParams; Date: ISqlTypeFactoryWithNoParams; DateTime: ISqlTypeFactoryWithNoParams; DateTime2: ISqlTypeFactoryWithScale; DateTimeOffset: ISqlTypeFactoryWithScale; SmallDateTime: ISqlTypeFactoryWithNoParams; Time: ISqlTypeFactoryWithScale; UniqueIdentifier: ISqlTypeFactoryWithNoParams; SmallMoney: ISqlTypeFactoryWithNoParams; Money: ISqlTypeFactoryWithNoParams; Binary: ISqlTypeFactoryWithNoParams; VarBinary: ISqlTypeFactoryWithLength; Image: ISqlTypeFactoryWithNoParams; Xml: ISqlTypeFactoryWithNoParams; Char: ISqlTypeFactoryWithLength; NChar: ISqlTypeFactoryWithLength; NText: ISqlTypeFactoryWithNoParams; TVP: ISqlTypeFactoryWithTvpType; UDT: ISqlTypeFactoryWithNoParams; Geography: ISqlTypeFactoryWithNoParams; Geometry: ISqlTypeFactoryWithNoParams; Variant: ISqlTypeFactoryWithNoParams;};
variable UDT
var UDT: ISqlTypeFactoryWithNoParams;
variable UniqueIdentifier
var UniqueIdentifier: ISqlTypeFactoryWithNoParams;
variable VarBinary
var VarBinary: ISqlTypeFactoryWithLength;
variable VarChar
var VarChar: ISqlTypeFactoryWithLength;
variable Variant
var Variant: ISqlTypeFactoryWithNoParams;
variable Xml
var Xml: ISqlTypeFactoryWithNoParams;
Functions
function connect
connect: { (config: config | string): Promise<ConnectionPool>; (config: string | config, callback?: (err?: Error) => void): void;};
Open global connection pool.
Parameter config
Connection configuration object or connection string
Open global connection pool.
Parameter config
Connection configuration object or connection string.
Parameter callback
A callback which is called after connection has established, or an error has occurred
function query
query: { (command: string): Promise<IResult<any>>; (command: TemplateStringsArray, ...interpolations: any[]): Promise<IResult<any>>; <Entity>(command: string): Promise<IResult<Entity>>; <Entity>(command: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<Entity> >; <Entity>( command: string, callback: (err?: Error, recordset?: IResult<Entity>) => void ): void;};
Classes
class columns
class columns extends Array<IColumn> {}
method add
add: ( name: string, type: (() => ISqlType) | ISqlType, options?: IColumnOptions) => number;
class ConnectionError
class ConnectionError extends MSSQLError {}
class ConnectionPool
class ConnectionPool extends events.EventEmitter {}
constructor
public constructor(config: config, callback?: (err?: any) => void);
constructor
public constructor(connectionString: string, callback?: (err?: any) => void);
property available
readonly available: number;
property borrowed
readonly borrowed: number;
property connected
readonly connected: boolean;
property connecting
readonly connecting: boolean;
property driver
readonly driver: string;
property healthy
readonly healthy: boolean;
property pending
readonly pending: number;
property pool
readonly pool: Pool<tds.Connection>;
property size
readonly size: number;
method batch
batch: { (batch: string): Promise<IResult<any>>; (strings: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<any> >; ( batch: string, callback: (err?: Error, recordset?: IResult<any>) => void ): void; <Entity>(batch: string): Promise<IResult<Entity>>; <Entity>(strings: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<Entity> >;};
method close
close: { (): Promise<void>; (callback: (err: any) => void): void };
method connect
connect: { (): Promise<ConnectionPool>; (callback: (err: any) => void): void };
method parseConnectionString
static parseConnectionString: ( connectionString: string) => config & { options: IOptions; pool: Partial<PoolOpts<Connection>> };
method query
query: { (command: string): Promise<IResult<any>>; (strings: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<any> >; <Entity>(command: string): Promise<IResult<Entity>>; <Entity>(strings: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<Entity> >; <Entity>( command: string, callback: (err?: Error, recordset?: IResult<Entity>) => void ): void;};
method request
request: () => Request;
method transaction
transaction: () => Transaction;
class MSSQLError
class MSSQLError extends Error {}
constructor
constructor(message: string | Error, code?: string);
property code
code: string;
property name
name: string;
property originalError
originalError?: Error;
class PreparedStatement
class PreparedStatement extends events.EventEmitter {}
constructor
public constructor(connection?: ConnectionPool);
constructor
public constructor(transaction: Transaction);
property parameters
parameters: IRequestParameters;
property prepared
prepared: boolean;
property statement
statement: string;
property stream
stream: any;
property transaction
transaction: Transaction;
method execute
execute: { (values: Object): Promise<IProcedureResult<any>>; <Entity>(values: Object): Promise<IProcedureResult<Entity>>; ( values: Object, callback: (err?: Error, result?: IProcedureResult<any>) => void ): Request; <Entity>( values: Object, callback: (err?: Error, result?: IProcedureResult<Entity>) => void ): Request;};
method input
input: (name: string, type: (() => ISqlType) | ISqlType) => PreparedStatement;
method output
output: (name: string, type: (() => ISqlType) | ISqlType) => PreparedStatement;
method prepare
prepare: { (statement?: string): Promise<void>; (statement?: string, callback?: (err?: Error) => void): PreparedStatement;};
method unprepare
unprepare: { (): Promise<void>; (callback: (err?: Error) => void): PreparedStatement;};
class PreparedStatementError
class PreparedStatementError extends MSSQLError {}
class Request
class Request extends events.EventEmitter {}
constructor
public constructor(connection?: ConnectionPool);
constructor
public constructor(transaction: Transaction);
constructor
public constructor(preparedStatement: PreparedStatement);
property arrayRowMode
arrayRowMode: boolean;
property canceled
canceled: boolean;
property multiple
multiple: boolean;
property parameters
parameters: IRequestParameters;
property pstatement
pstatement: PreparedStatement;
property stream
stream: boolean;
property transaction
transaction: Transaction;
property verbose
verbose: boolean;
method batch
batch: { (batch: string): Promise<IResult<any>>; (strings: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<any> >; ( batch: string, callback: (err?: Error, recordset?: IResult<any>) => void ): void; <Entity>(batch: string): Promise<IResult<Entity>>; <Entity>(strings: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<Entity> >; <Entity>( batch: string, callback: (err?: any, recordset?: IResult<Entity>) => void ): void;};
method bulk
bulk: { (table: Table): Promise<IBulkResult>; (table: Table, options: IBulkOptions): Promise<IBulkResult>; (table: Table, callback: (err: Error, result: IBulkResult) => void): void; ( table: Table, options: IBulkOptions, callback: (err: Error, result: IBulkResult) => void ): void;};
method cancel
cancel: () => void;
method execute
execute: { (procedure: string): Promise<IProcedureResult<any>>; <Entity>(procedure: string): Promise<IProcedureResult<Entity>>; <Entity>( procedure: string, callback: ( err?: any, recordsets?: IProcedureResult<Entity>, returnValue?: any ) => void ): void;};
method input
input: { (name: string, value: any): Request; (name: string, type: ISqlType | (() => ISqlType), value: any): Request;};
method output
output: ( name: string, type: (() => ISqlType) | ISqlType, value?: any) => Request;
method pause
pause: () => boolean;
method pipe
pipe: (stream: NodeJS.WritableStream) => NodeJS.WritableStream;
method query
query: { (command: string): Promise<IResult<any>>; (command: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<any> >; <Entity>(command: string): Promise<IResult<Entity>>; <Entity>(command: TemplateStringsArray, ...interpolations: any[]): Promise< IResult<Entity> >; <Entity>( command: string, callback: (err?: Error, recordset?: IResult<Entity>) => void ): void;};
method replaceInput
replaceInput: { (name: string, value: any): Request; (name: string, type: ISqlType | (() => ISqlType), value: any): Request;};
method resume
resume: () => boolean;
method toReadableStream
toReadableStream: (streamOptions?: ReadableOptions) => Readable;
class RequestError
class RequestError extends MSSQLError {}
property class
class?: string;
property lineNumber
lineNumber?: number;
property number
number?: number;
property procName
procName?: string;
property serverName
serverName?: string;
property state
state?: string;
class Table
class Table {}
class Transaction
class Transaction extends events.EventEmitter {}
constructor
public constructor(connection?: ConnectionPool);
property isolationLevel
isolationLevel: number;
method begin
begin: { (isolationLevel?: IIsolationLevel): Promise<Transaction>; ( isolationLevel?: number, callback?: (err?: ConnectionError | TransactionError) => void ): Transaction;};
Begin a transaction.
Parameter isolationLevel
Controls the locking and row versioning behavior of TSQL statements issued by a connection.
Parameter callback
A callback which is called after transaction has began, or an error has occurred. If omited, method returns Promise.
method commit
commit: { (): Promise<void>; (callback: (err?: any) => void): void };
method request
request: () => Request;
method rollback
rollback: { (): Promise<void>; (callback: (err?: any) => void): void };
class TransactionError
class TransactionError extends MSSQLError {}
Interfaces
interface config
interface config {}
property arrayRowMode
arrayRowMode?: boolean | undefined;
property authentication
authentication?: tds.ConnectionAuthentication | undefined;
property beforeConnect
beforeConnect?: ((conn: Connection) => void) | undefined;
Invoked before opening the connection. The parameter conn is the configured tedious Connection. It can be used for attaching event handlers.
property connectionTimeout
connectionTimeout?: number | undefined;
property database
database?: string | undefined;
property domain
domain?: string | undefined;
property driver
driver?: string | undefined;
property options
options?: IOptions | undefined;
property parseJSON
parseJSON?: boolean | undefined;
property password
password?: string | undefined;
property pool
pool?: PoolOpts<Connection> | undefined;
property port
port?: number | undefined;
property requestTimeout
requestTimeout?: number | undefined;
property server
server: string;
property stream
stream?: boolean | undefined;
property user
user?: string | undefined;
interface IBulkOptions
interface IBulkOptions {}
Options object to be passed through to driver (currently tedious only)
property checkConstraints
checkConstraints?: boolean | undefined;
Honors constraints during bulk load, using T-SQL CHECK_CONSTRAINTS. (default: false)
property fireTriggers
fireTriggers?: boolean | undefined;
Honors insert triggers during bulk load, using the T-SQL FIRE_TRIGGERS. (default: false)
property keepNulls
keepNulls?: boolean | undefined;
Honors null value passed, ignores the default values set on table, using T-SQL KEEP_NULLS. (default: false)
property tableLock
tableLock?: boolean | undefined;
Places a bulk update(BU) lock on table while performing bulk load, using T-SQL TABLOCK. (default: false)
interface IBulkResult
interface IBulkResult {}
property rowsAffected
rowsAffected: number;
interface IColumn
interface IColumn extends ISqlType {}
interface IColumnMetadata
interface IColumnMetadata {}
index signature
[name: string]: { index: number; name: string; length: number; type: (() => ISqlType) | ISqlType; udt?: any; scale?: number | undefined; precision?: number | undefined; nullable: boolean; caseSensitive: boolean; identity: boolean; readOnly: boolean;};
interface IColumnOptions
interface IColumnOptions {}
interface IMap
interface IMap extends Array<{ js: any; sql: any }> {}
method register
register: (jstype: any, sql: any) => void;
interface IOptions
interface IOptions extends Omit<tds.ConnectionOptions, 'useColumnNames'> {}
property beforeConnect
beforeConnect?: void | undefined;
property connectionString
connectionString?: string | undefined;
property trustedConnection
trustedConnection?: boolean | undefined;
interface IProcedureResult
interface IProcedureResult<T> extends IResult<T> {}
property returnValue
returnValue: any;
interface IRecordSet
interface IRecordSet<T> extends Array<T> {}
interface IRequestParameters
interface IRequestParameters {}
index signature
[name: string]: { name: string; type: (() => ISqlType) | ISqlType; io: number; value: any; length: number; scale: number; precision: number; tvpType: any;};
interface IResult
interface IResult<T> {}
property output
output: { [key: string]: any };
property recordset
recordset: IRecordSet<T extends any[] ? T[0] : T>;
property recordsets
recordsets: T extends any[] ? { [P in keyof T]: IRecordSet<T[P]> } : Array<IRecordSet<T>>;
property rowsAffected
rowsAffected: number[];
interface ISqlTypeFactory
interface ISqlTypeFactory {}
interface ISqlTypeFactoryWithLength
interface ISqlTypeFactoryWithLength extends ISqlTypeFactory {}
call signature
(length?: number): ISqlTypeWithLength;
interface ISqlTypeFactoryWithNoParams
interface ISqlTypeFactoryWithNoParams extends ISqlTypeFactory {}
call signature
(): ISqlTypeWithNoParams;
interface ISqlTypeFactoryWithPrecisionScale
interface ISqlTypeFactoryWithPrecisionScale extends ISqlTypeFactory {}
call signature
(precision?: number, scale?: number): ISqlTypeWithPrecisionScale;
interface ISqlTypeFactoryWithScale
interface ISqlTypeFactoryWithScale extends ISqlTypeFactory {}
call signature
(scale?: number): ISqlTypeWithScale;
interface ISqlTypeFactoryWithTvpType
interface ISqlTypeFactoryWithTvpType extends ISqlTypeFactory {}
call signature
(tvpType?: any): ISqlTypeWithTvpType;
interface ISqlTypeWithLength
interface ISqlTypeWithLength extends ISqlType {}
interface ISqlTypeWithNoParams
interface ISqlTypeWithNoParams extends ISqlType {}
property type
type: ISqlTypeFactoryWithNoParams;
interface ISqlTypeWithPrecisionScale
interface ISqlTypeWithPrecisionScale extends ISqlType {}
interface ISqlTypeWithScale
interface ISqlTypeWithScale extends ISqlType {}
interface ISqlTypeWithTvpType
interface ISqlTypeWithTvpType extends ISqlType {}
interface PoolOpts
interface PoolOpts<T> extends Omit<PoolOptions<T>, 'create' | 'destroy' | 'min' | 'max'> {}
Type Aliases
type Connection
type Connection = tds.Connection;
type IIsolationLevel
type IIsolationLevel = number;
type IRow
type IRow = Array<string | number | boolean | Date | Buffer | undefined | null>;
Package Files (1)
Dependencies (3)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/mssql
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/mssql)
- HTML<a href="https://www.jsdocs.io/package/@types/mssql"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 6253 ms. - Missing or incorrect documentation? Open an issue for this package.