Module: sqlServerDriver

Interface to Microsoft Sql Server
Source:

Classes

Connection
Connection
SqlParameter

Members

(inner, constant) mapIsolationLevels :Object

Maps Standard isolation levels to DBMS-level isolation levels. In case of MS SqlServer, the corrispondence is 1:1
Type:
  • Object
Properties:
Name Type Description
allIsolationLevels
Source:

Methods

(inner) appendCommands(cmd) → {string}

get a sql command given by a sequence of specified sql commands
Parameters:
Name Type Description
cmd Array.<string>
Source:
Returns:
Type
string

(inner) beginTransaction(isolationLevel) → {*}

Begins a transaction
Parameters:
Name Type Description
isolationLevel string one of 'READ_UNCOMMITTED','READ_COMMITTED','REPEATABLE_READ','SNAPSHOT','SERIALIZABLE'
Source:
Returns:
Type
*

(inner) callSPWithNamedParams(options) → {String}

evaluates the sql command to call aSP with a list of parameters each of which is an object having: value, optional 'sqltype' name compatible with the used db, necessary if is an output parameter optional out: true if it is an output parameter The SP eventually returns a collection of tables and at the end an object with a property for each output parameter of the SP declare @s1 smallint; set @s1=0; exec check_fin_u_pre @res=@s1 output,@sys_idflowchart=null,@OLD_flag='2',@NEW_flag='2',@NEW_ayear=2021,@NEW_printingorder='04',@NEW_idfin=19468,@sys_esercizio=2021; SELECT @s1 AS s1
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
spName string
paramList Array.<SqlParameter>
skipSelect boolean <optional>
when true, the select of output parameter is omitted
Source:
Returns:
Type
String

(inner) callSPWithNamedParams(options) → {Array.<object>}

call SP with a list of parameters each of which is an object having: value, optional 'sqltype' name compatible with the used db, necessary if is an output parameter optional out: true if it is an output parameter The SP eventually returns a collection of tables and at the end an object with a property for each output parameter of the SP
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Default Description
spName string
paramList Array.<SqlParameter>
raw boolean <optional>
false
timeout number <optional>
Source:
Returns:
[] }
Type
Array.<object>

(inner) clone() → {Connection}

Creates a duplicate of this connection
Source:
Returns:
Type
Connection

(inner) close() → {promise}

Closes the underlying connection
Source:
Returns:
Type
promise

(inner) commit() → {*}

Commits a transaction
Source:
Returns:
Type
*

(inner) destroy() → {Deferred}

Destroy this connection and closes the underlying connection
Source:
Returns:
Type
Deferred

(inner) getDeleteCommand(options) → {string}

Get the string representing a delete command
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
tableName string
filter sqlFun <optional>
environment object <optional>
Source:
Returns:
Type
string

(inner) getFormatter() → {sqlFormatter}

Gets the formatter for this kind of connection
Source:
Returns:
Type
sqlFormatter

(inner) getInsertCommand(table, columns, values) → {string}

Get the string representing an insert command
Parameters:
Name Type Description
table string
columns Array.<string>
values Array.<Object>
Source:
Returns:
Type
string

(inner) getSelectCommand(options) → {string}

Get the string representing a select command
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
tableName string
columns string list of columns or expressions, this is taken "as is" to compose the command
filter sqlFun <optional>
this is skipped if it is a constantly true condition
top string <optional>
orderBy string <optional>
environment object <optional>
Source:
Returns:
Type
string

(inner) getSelectCount(options) → {string}

Get the string representing a select count(*) command
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
tableName string
filter sqlFun <optional>
environment object <optional>
Source:
Returns:
Type
string

(inner) getUpdateCommand(options) → {string}

Get the string representing an update command
Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
table string
filter sqlFun
columns Array.<string>
values Array.<Object>
environment object <optional>
Source:
Returns:
Type
string

(inner) giveConstant(c)

Returns a command that should return a constant number
Parameters:
Name Type Description
c object
Source:
Returns:
string

(inner) giveErrorNumberDataWasNotWritten(errNumber)

Returns a command that should return a number if last write operation did not have success
Parameters:
Name Type Description
errNumber number
Source:
Returns:
string

(inner) objectify(colNames, rows) → {Array}

Transforms raw data into plain objects This must be the same as the objectify existing in jsDataAccess
Parameters:
Name Type Description
colNames Array
rows Array
Source:
Returns:
Type
Array

(inner) open() → {Connection}

Opens the underlying connection and sets the current specified schema
Source:
Returns:
Type
Connection

(inner) queryBatch(query, rawopt, timeoutopt) → {Promise}

Executes a sql command and returns all sets of results. Each Results is given via a notify or resolve
Parameters:
Name Type Attributes Description
query string
raw boolean <optional>
if true, data are left in raw state and will be objectified by the client
timeout number <optional>
Source:
Returns:
a sequence of {[array of plain objects]} or {meta:[column names],rows:[arrays of raw data]}
Type
Promise

(inner) queryLines(query, rawopt, timeoutopt) → {*}

Gets a table and returns each SINGLE row by notification. Could eventually return more than a table indeed For each table read emits a {meta:[column descriptors]} notification, and for each row of data emits a if raw= false: {row:object read from db} if raw= true: {row: [array of values read from db]}
Parameters:
Name Type Attributes Default Description
query string
raw boolean <optional>
false
timeout number <optional>
Source:
Returns:
Type
*

(inner) queryPackets(query, rawopt, packSizeopt, timeoutopt) → {*}

Gets data packets row at a time
Parameters:
Name Type Attributes Default Description
query string
raw boolean <optional>
false
packSize number <optional>
0
timeout number <optional>
Source:
Returns:
Type
*

(inner) rollBack() → {*}

RollBacks a transaction
Source:
Returns:
Type
*

(inner) run(script, timeoutopt) → {*}

Runs a sql script, eventually composed of multiple blocks separed by GO lines
Parameters:
Name Type Attributes Description
script string
timeout number <optional>
Source:
Returns:
Type
*

(inner) setTransactionIsolationLevel(isolationLevel) → {promise}

Sets the Transaction isolation level for current connection
Parameters:
Name Type Description
isolationLevel string one of 'READ_UNCOMMITTED','READ_COMMITTED','REPEATABLE_READ','SNAPSHOT','SERIALIZABLE'
Source:
Returns:
Type
promise

(inner) sqlTypeForNBits(nbits) → {string}

get Sql type to contain n bits
Parameters:
Name Type Description
nbits int
Source:
Returns:
Type
string

(inner) tableDescriptor(tableName) → {TableDescriptor}

Gets information about a db table
Parameters:
Name Type Description
tableName string
Source:
Returns:
Type
TableDescriptor

(inner) updateBatch(query, timeoutopt) → {*}

Executes a series of sql update/insert/delete commands
Parameters:
Name Type Attributes Description
query string
timeout number <optional>
Source:
Returns:
Type
*

(inner) useSchema(schema) → {*}

Change current used schema for this connection
Parameters:
Name Type Description
schema string
Source:
Returns:
Type
*