Skip to content

Commit a6271c6

Browse files
committed
docs: move connection event location
1 parent 6413790 commit a6271c6

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Readme.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,6 @@ pool.getConnection(function(err, connection) {
290290
});
291291
```
292292

293-
If you need to set session variables on the connection before it gets used,
294-
you can listen to the `connection` event.
295-
296-
```js
297-
pool.on('connection', function(connection) {
298-
connection.query('SET SESSION auto_increment_increment=1')
299-
});
300-
```
301-
302293
When you are done with a connection, just call `connection.release()` and the
303294
connection will return to the pool, ready to be used again by someone else.
304295

@@ -350,6 +341,18 @@ addition to those options pools accept a few extras:
350341

351342
## Pool events
352343

344+
### connection
345+
346+
The pool will emit a `connection` event when a new connection is made within the pool.
347+
If you need to set session variables on the connection before it gets used, you can
348+
listen to the `connection` event.
349+
350+
```js
351+
pool.on('connection', function (connection) {
352+
connection.query('SET SESSION auto_increment_increment=1')
353+
});
354+
```
355+
353356
### enqueue
354357

355358
The pool will emit an `enqueue` event when a callback has been queued to wait for

0 commit comments

Comments
 (0)