Skip to content

Commit 9b4b56a

Browse files
committed
[CONJS-131] Duplication error now indicating option checkDuplicate.
Improvement of `checkDuplicate` option documentation
1 parent 366ffd6 commit 9b4b56a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

documentation/connection-options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,8 @@ mariadb.createConnection({
353353
| **initSql** | When a connection is established, permit to execute commands before using connection|*string|array* |
354354
| **bulk** | disabled bulk command in batch|*boolean* |
355355
| **permitConnectionWhenExpired** | Permit a user with expired password to connect. Only possible operation in this case will be to change password ('SET PASSWORD=PASSWORD('XXX')')|*boolean* |false|
356-
| **forceVersionCheck** | Force server version check by explicitly using SELECT VERSION(), not relying on server initial packet. |*boolean* |false|
357-
| **checkDuplicate** | indicate to throw an exception if result-set will not contain some data due to having duplicate identifier|*boolean* | true |
356+
| **forceVersionCheck** | Force server version check by explicitly using SELECT VERSION(), not relying on server initial packet.<br/><i><small>Since version 2.2.0</small></i> |*boolean* |false|
357+
| **checkDuplicate** | Indicate to throw an exception if result-set will not contain some data due to having duplicate identifier. <br/>JSON cannot have multiple identical key, so query like `SELECT 1 as i, 2 as i` cannot result in { i:1, i:2 }, 'i:1' would be skipped. <br/>When `checkDuplicate` is enable (default) driver will throw an error if some data are skipped. Duplication error can be avoided by multiple ways, like using unique aliases or using options [`rowsAsArray`](https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/documentation/promise-api.md#rowsasarray) / [`nestTables`](https://github.com/mariadb-corporation/mariadb-connector-nodejs/blob/master/documentation/promise-api.md#nestTables) for example <br/><i><small>Since version 2.3.0</small></i>|*boolean* | true |
358358

359359

360360

lib/cmd/resultset.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ class ResultSet extends Command {
283283
[]
284284
);
285285
this.throwUnexpectedError(
286-
'Error in results, duplicate field name `' + dupes[0] + '`',
286+
'Error in results, duplicate field name `' +
287+
dupes[0] +
288+
'`.\n' +
289+
'(see option `checkDuplicate`)',
287290
false,
288291
null,
289292
'42000',
@@ -307,7 +310,8 @@ class ResultSet extends Command {
307310
this.tableHeader[i][0] +
308311
'`.`' +
309312
this.tableHeader[i][1] +
310-
'`',
313+
'`\n' +
314+
'(see option `checkDuplicate`)',
311315
false,
312316
null,
313317
'42000',

0 commit comments

Comments
 (0)