new Connection(options)
Provides function to interact with a Sql Server database
Parameters:
Name | Type | Description |
---|---|---|
options |
object | {string} [options.driver='SQL Server Native Client 11.0'] Driver name {string} [options.useTrustedConnection=true] is assumed true if no user name is provided {string} [options.user] user name for connecting to db {string} [options.pwd] user password for connecting to db {string} [options.timeOut] time out to connect default 600 {string} [options.database] database name {string} [options.defaultSchema=options.user ||'DBO'] default schema associated with user name {string} [options.connectionString] connection string to connect (can be used instead of all previous listed) |
- Source:
Members
edgeConnection :EdgeConnection
Type:
- Source:
isolationLevel :String
current isolation level
Type:
- String
Properties:
Name | Type | Description |
---|---|---|
isolationLevel |
- Source:
isOpen :boolean
Indicates the open/closed state of the underlying connection
Type:
- boolean
Properties:
Name | Type | Description |
---|---|---|
isOpen |
- Source:
opt :object
Stores the sql-connect options used for this connection
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
opt |
- Source:
schema :string
Current schema in use for this connection
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
schema |
- Source:
transError :boolean
Current transaction state, true if any rollback has been invoked
Type:
- boolean
- Source:
Methods
checkLogin(login, password) → {boolean}
Check login/password, returns true if successful, false if user/password does not match
Parameters:
Name | Type | Description |
---|---|---|
login |
string | |
password |
string |
- Source:
Returns:
- Type
- boolean
colNameFromVarName(varName) → {string}
Gives the column name for a variable name
Parameters:
Name | Type | Description |
---|---|---|
varName |
string |
- Source:
Returns:
- Type
- string
createSqlParameter(paramValue, paramName, varName, sqlType, forOutput)
Create a sql parameter
Parameters:
Name | Type | Description |
---|---|---|
paramValue |
object | |
paramName |
string | parameter name, as declared in the stored procedure |
varName |
string | column name to extract as output |
sqlType |
string | |
forOutput |
boolean |
- Source:
getBitArray(value, nbits)
Type of value depends on nbits
Parameters:
Name | Type | Description |
---|---|---|
value |
object | |
nbits |
int | return {string} |
- Source:
getPagedTableCommand() → {string}
Get a command to select a bunch of rows
Parameters:
Name | Type | Description |
---|---|---|
options.tableName |
string | |
options.nRows |
int | |
options.filter |
string | , |
options.firstRow |
int | |
options.sorting |
string | , |
options.environment |
Context |
- Source:
Returns:
- Type
- string
getPagedTableCommand(tableName, filter, firstRow, nRowPerPage, sortBy) → {string}
Gets the sql command to read from a table nRowPerPage rows starting from firstRow
Parameters:
Name | Type | Description |
---|---|---|
tableName |
string | |
filter |
string | |
firstRow |
number | |
nRowPerPage |
number | |
sortBy |
string |
- Source:
Returns:
- Type
- string
getSelectListOfVariables(vars) → {string}
Get a command to convert a list of variables into a table with a column having a variable for each column
Parameters:
Name | Type | Description |
---|---|---|
vars |
Array.<varName:string, colName:string> |
- Source:
Returns:
- Type
- string
variableNameForNBits(num, nbits)
Returns a variable name identified by a number for a variable that can contain n bits of information
Parameters:
Name | Type | Description |
---|---|---|
num |
int | |
nbits |
int |
- Source: