SQL

Collection of SQL functions.

Methods

execute

execute(connectionString: string | {
                                    server: string,
                                    authenticationType?: string,
                                    userName: string,
                                    password: string,
                                    database: string,
                                    port?: Number,
                                    encrypt?: Boolean,
                                }, query: string, params?: { name: string, value: any, type: SQL.TYPES }[])

Executes a T-SQL query. Returns an array of rows with columns as key/value pairs.

Parameters

connectionString string | { server: string, authenticationType?: string, userName: string, password: string, database: string, port?: Number, encrypt?: Boolean, }

The connection string or object to the SQL database.

query string

The SQL statement to be executed.

params { name: string, value: any, type: SQL.TYPES }[]

(optional) Parameters to be used within the query. Use parameters to avoid SQL injection. See OWASP SQL Injection cheat sheet.

Return type

{ [key: string]: any; }[]

Examples

executeStoredProcedure

Executes a SQL Stored Procedure. Use parameters to avoid SQL injection. OWASP SQL Injection cheat sheet.

Parameters

connectionString string | { server: string, authenticationType: string, userName: string, password: string, database: string, port: Number, encrypt: Boolean, }

The connection string or object to the SQL database.

query string

The SQL statement to be executed.

params { name: string, value: any, type: SQL.TYPES }[]

(optional) Parameters to be used within the query. Use parameters to avoid SQL injection. See OWASP SQL Injection cheat sheet.

Return type

{ [key: string]: any; }[]

Examples

Last updated