new MySQLConnection()
A connection to MySQL server.
Methods
changeUser(options, handler) → {MySQLConnection}
Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object | authentication options, only username, password, database, collation and properties will be used. |
handler |
function | the handler |
Returns:
a reference to this, so the API can be used fluently
- Type
- MySQLConnection
closeHandler(handler) → {MySQLConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
Returns:
- Type
- MySQLConnection
debug(handler) → {MySQLConnection}
Send a DEBUG command to dump debug information to the server's stdout.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler notified with the execution result |
Returns:
a reference to this, so the API can be used fluently
- Type
- MySQLConnection
exceptionHandler(handler) → {MySQLConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
Returns:
- Type
- MySQLConnection
getInternalStatistics(handler) → {MySQLConnection}
Send a STATISTICS command to get a human readable string of the server internal status.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler notified with the execution result |
Returns:
a reference to this, so the API can be used fluently
- Type
- MySQLConnection
ping(handler) → {MySQLConnection}
Send a PING command to check if the server is alive.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler notified when the server responses to client |
Returns:
a reference to this, so the API can be used fluently
- Type
- MySQLConnection
prepare(sql, handler) → {MySQLConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
sql |
string | |
handler |
function |
Returns:
- Type
- MySQLConnection
preparedQuery(sql, arguments, handler) → {MySQLConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
sql |
string | |
arguments |
Tuple | |
handler |
function |
Returns:
- Type
- MySQLConnection
query(sql, handler) → {MySQLConnection}
Parameters:
| Name | Type | Description |
|---|---|---|
sql |
string | |
handler |
function |
Returns:
- Type
- MySQLConnection
resetConnection(handler) → {MySQLConnection}
Send a RESET_CONNECTION command to reset the session state.
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function | the handler notified with the execution result |
Returns:
a reference to this, so the API can be used fluently
- Type
- MySQLConnection
setOption(option, handler) → {MySQLConnection}
Send a SET_OPTION command to set options for the current connection.
Parameters:
| Name | Type | Description |
|---|---|---|
option |
Object | the options to set |
handler |
function | the handler notified with the execution result |
Returns:
a reference to this, so the API can be used fluently
- Type
- MySQLConnection
specifySchema(schemaName, handler) → {MySQLConnection}
Send a INIT_DB command to change the default schema of the connection.
Parameters:
| Name | Type | Description |
|---|---|---|
schemaName |
string | name of the schema to change to |
handler |
function | the handler notified with the execution result |
Returns:
a reference to this, so the API can be used fluently
- Type
- MySQLConnection