viva-server-mssql

library for work with Microsoft SQL Server


Keywords
Microsoft SQL Server
License
MIT
Install
npm install viva-server-mssql@3.1.1

Documentation

Classes

Typedefs

Server_mssql

(license MIT) library for work with Microsoft SQL Server, full example - see example.js

Kind: global class

server_mssql.connected : boolean

Kind: instance property of Server_mssql

server_mssql.utc_offset : number

Kind: instance property of Server_mssql

server_mssql.init(connection_config, callback)

init library, check connect to MS SQL Server

Kind: instance method of Server_mssql

Param Type Description
connection_config type_connection_config connection setting
callback function callback function, (error) => {}

server_mssql.exec(queries, [options], callback)

exec query or queries

Kind: instance method of Server_mssql

Param Type Description
queries string | Array.<string> query or array of queries (for run on one open connection)
[options] type_exec_options
callback function callback function, (error, result) => {}

server_mssql.action_add(action) ⇒ string

add one action

Kind: instance method of Server_mssql
Returns: string - error that prevented load action

Param Type Description
action lib_vaction.type_action single action

server_mssql.action_exec(key, params, options, callback)

exec action

Kind: instance method of Server_mssql

Param Type Description
key string uniq key of action
params any
options lib_vaction.type_exec_option
callback function callback function, (error, result) => {}

server_mssql.schedule_go(job)

add new schedule or replace existsing schedule

Kind: instance method of Server_mssql

Param Type
job lib_vschedule.type_job

server_mssql.schedule_delete(job_key)

remove existsing schedule

Kind: instance method of Server_mssql

Param Type
job_key string

type_connection_config

Kind: global typedef
Properties

Name Type Description
server string MS SQL instance, for example - 'server\instance1'
password string passrord for ms sql authentication or windows authentication
[login] string login for ms sql authentication, if empty - os authentication
[database] string name database for connect, default - 'tempdb'
[app_name] string app name, which will be visible in profiler
[connection_timeout] number connection timeout in milliseconds, default - 15000
[execution_timeout] number execution timeout in milliseconds, default - 0 (infinity)
[encrypt_connection] boolean encrypt connection, default - false
[useUTC] boolean default - true
[action_allow] boolean use action subsystem, default - false
[again_connect_count] number count to try to connect to the server if the connection is unavailable, default - 0 (again try connect is disabled)
[again_connect_timeout] number timeout in milliseconds between attempts to connect to the server, default - 2000

type_exec_options

Kind: global typedef
Properties

Name Type Description
[pack] string | number chunk return data, variants: 'all' - all data in one chunk, 'step' - each step individual chunk, 'table' - each table individual chunk, {number} - row chunk. default - 'all'
[correction_utc_offset] number correct field with datetime type by this value (in minutes)
[correction_utc_mode] string which fields correct by utc offset, example - '{#all}{}{fdm;ldm}' - in first table correct all datetime fields, second table is missing, in the third table correct only two fields
[lock] string one thread - name
[lock_wait] number one thread - wait timeout in milliseconds (0 - no wait), default 0