new SqlConnection()
A connection to database server.
Methods
begin() → {Transaction}
Begin a transaction and returns a Transaction for controlling and tracking
this transaction.
When the connection is explicitely closed, any inflight transaction is rollbacked.
Returns:
the transaction instance
- Type
- Transaction
close()
Close the current connection after all the pending commands have been processed.
closeHandler(handler) → {SqlConnection}
Set an handler called when the connection is closed.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler |
Returns:
a reference to this, so the API can be used fluently
- Type
- SqlConnection
exceptionHandler(handler) → {SqlConnection}
Set an handler called with connection errors.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler |
Returns:
a reference to this, so the API can be used fluently
- Type
- SqlConnection
isSSL() → {boolean}
Returns:
whether the connection uses SSL
- Type
- boolean
prepare(sql, handler) → {SqlConnection}
Create a prepared query.
Parameters:
| Name | Type | Description |
|---|---|---|
sql |
string | the sql |
handler |
function | the handler notified with the prepared query asynchronously |
Returns:
- Type
- SqlConnection
preparedBatch(sql, batch, handler) → {SqlConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
sql |
string | |
batch |
Array.<Tuple> | |
handler |
function |
Returns:
- Type
- SqlConnection
preparedQuery(sql, arguments, handler) → {SqlConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
sql |
string | |
arguments |
Tuple | |
handler |
function |
Returns:
- Type
- SqlConnection
query(sql, handler) → {SqlConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
sql |
string | |
handler |
function |
Returns:
- Type
- SqlConnection