[misc] documentation improvement for connection.reset().

Error now indicate that minimum version server is required.
This commit is contained in:
rusher
2019-08-28 11:28:09 +02:00
parent 940bdbcf86
commit 993003bdc2
3 changed files with 11 additions and 1 deletions

View File

@ -229,6 +229,7 @@ Specific options for pools are :
| **`minimumIdle`** | Permit to set a minimum number of connection in pool. **Recommendation is to use fixed pool, so not setting this value**.|*integer* | *set to connectionLimit value* |
| **`minDelayValidation`** | When asking a connection to pool, the pool will validate the connection state. "minDelayValidation" permits disabling this validation if the connection has been borrowed recently avoiding useless verifications in case of frequent reuse of connections. 0 means validation is done each time the connection is asked. (in ms) |*integer*| 500|
| **`noControlAfterUse`** | After giving back connection to pool (connection.end) connector will reset or rollback connection to ensure a valid state. This option permit to disable those controls|*boolean*| false|
| **`resetAfterUse`** | When a connection is given back to pool, reset the connection if the server allows it (MariaDB >=10.2.4 / MySQL >= 5.7.3). If disabled or server version doesn't allows reset, pool will only rollback open transaction if any|*boolean*| true|
## Pool events
@ -565,6 +566,10 @@ reset the connection. Reset will:
* remove temporary tables
* remove all PREPARE statement
This command is only available for MariaDB >=10.2.4 or MySQL >= 5.7.3.
function will be rejected with error "Reset command not permitted for server XXX" if version doesn't permit reset.
For previous MariaDB version, reset connection can be done using [`connection.changeUser(options[, callback])`](#connectionchangeuseroptions-callback) that do the same + redo authentication phase.
## `connection.isValid() → boolean`

View File

@ -232,6 +232,7 @@ Specific options for pools are :
| **`minimumIdle`** | Permit to set a minimum number of connection in pool. **Recommendation is to use fixed pool, so not setting this value**.|*integer* | *set to connectionLimit value* |
| **`minDelayValidation`** | When asking a connection to pool, the pool will validate the connection state. "minDelayValidation" permits disabling this validation if the connection has been borrowed recently avoiding useless verifications in case of frequent reuse of connections. 0 means validation is done each time the connection is asked. (in ms) |*integer*| 500|
| **`noControlAfterUse`** | After giving back connection to pool (connection.end) connector will reset or rollback connection to ensure a valid state. This option permit to disable those controls|*boolean*| false|
| **`resetAfterUse`** | When a connection is given back to pool, reset the connection if the server allows it (MariaDB >=10.2.4 / MySQL >= 5.7.3). If disabled or server version doesn't allows reset, pool will only rollback open transaction if any|*boolean*| true|
### `createPoolCluster(options) → PoolCluster`
@ -777,6 +778,10 @@ reset the connection. Reset will:
* remove temporary tables
* remove all PREPARE statement
This command is only available for MariaDB >=10.2.4 or MySQL >= 5.7.3.
function will be rejected with error "Reset command not permitted for server XXX" if version doesn't permit reset.
For previous MariaDB version, reset connection can be done using [`connection.changeUser(options) → Promise`](#connectionchangeuseroptions--promise) that do the same + redo authentication phase.
## `connection.isValid() → boolean`

View File

@ -256,7 +256,7 @@ function Connection(options) {
});
}
return Promise.reject(
new Error('Reset command not permitted for server ' + this.info.serverVersion)
new Error('Reset command not permitted for server ' + this.info.serverVersion + ' (requires server MariaDB version 10.2.4+ or MySQL 5.7.3+)')
);
};