Interface to Microsoft Sql Server
- Source:
Classes
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. it is mandatory 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
Unfortunately there is NO named parameter calling in MySql so it will call the SP by param order
mysql> CALL test(@a, @b);
mysql> SELECT @a AS a, @b AS b;
User-defined variables (prefixed with @): You can access any user-defined variable without declaring it or initializing it.
If you refer to a variable that has not been initialized, it has a value of NULL and a type of string.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
- Source:
Returns:
- Type
- String
(inner) callSPWithNamedParams(options) → {Array.<Array.<ObjectRow>>}
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
|
- Source:
Returns:
- Type
- Array.<Array.<ObjectRow>>
(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
|
- 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
|
- Source:
Returns:
- Type
- string
(inner) getSelectCount(options) → {string}
Get the string representing a select count(*) command
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
- Source:
Returns:
- Type
- string
(inner) getUpdateCommand(options) → {string}
Get the string representing an update command
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
- Source:
Returns:
- Type
- 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
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) → {defer}
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
- defer
(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) 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. MySql does not support schemas
Parameters:
Name | Type | Description |
---|---|---|
schema |
string |
- Source:
Returns:
- Type
- *