Starts a new transaction
Starts a new transaction
connection.beginTransaction(function(err) { ... })
Commits a transaction
Commits a transaction
the error callback
commit(function(err) { ... })
Creates a new connection
Creates a new connection
the results callback
An alternative way to end the connection is to call the destroy() method.
An alternative way to end the connection is to call the destroy() method. This will cause an immediate termination of the underlying socket. Additionally destroy() guarantees that no more events or callbacks will be triggered for the connection.
There are two ways to end a connection.
There are two ways to end a connection. Terminating a connection gracefully is done by calling the end() method
the error callback
connection.end(function(err) { ... })
A ping packet can be sent over a connection using the connection.ping method.
A ping packet can be sent over a connection using the connection.ping method. This method will send a ping packet to the server and when the server responds, the callback will fire. If an error occurred, the callback will fire with an error argument.
connection.ping(function (err) { ... })
Asynchronously executes a query
Asynchronously executes a query
the given query options
the given query parameters
the results callback
connection.query('INSERT INTO log SET data=?', log, function(err, result) { ... })
Asynchronously executes a query
Asynchronously executes a query
the given query options
the results callback
connection.query(options, function(err, results) { ... })
Asynchronously executes a query
Asynchronously executes a query
the given query string
the results callback
connection.query('INSERT INTO log SET data=?', log, function(err, result) { ... })
Executes a query and streams the results
Executes a query and streams the results
the given query string
a readable for streaming the results
When you are done with a connection, just call connection.release() and the connection will return to the pool, ready to be used again by someone else.
Rolls back a transaction
Rolls back a transaction
the response callback (empty arguments)
MySQL Connection