Skip to content

Commit 1da7a2a

Browse files
committed
doc: Fix MySQLTable.insert() example with using only the sqlString argument
[ci skip]
1 parent 79c5acb commit 1da7a2a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,11 @@ userTable.insert(data, onDuplicateKeySQL, [data.points])
694694

695695
**Example**: With only the `sqlString` argument
696696
```js
697-
placeTable.insert('`location` = POINT(0, 0)');
697+
placeTable.insert('SET `location` = POINT(0, 0)');
698698
// INSERT INTO `place` SET `location` = POINT(0, 0);
699699

700-
placeTable.insert('`location` = POINT(?, ?)', [8, 2]);
701-
// INSERT INTO `place` SET `location` = POINT(8, 2);
700+
placeTable.insert('(`location`) VALUES (POINT(?, ?))', [8, 2]);
701+
// INSERT INTO `place` (`location`) VALUES (POINT(8, 2));
702702
```
703703

704704
**Example**: Bulk insert

lib/MySQLTable.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ class MySQLTable {
135135
* // ON DUPLICATE KEY UPDATE `points` = `points` + 100;
136136
*
137137
* @example <caption>With only the `sqlString` argument</caption>
138-
* placeTable.insert('`location` = POINT(0, 0)');
138+
* placeTable.insert('SET `location` = POINT(0, 0)');
139139
* // INSERT INTO `place` SET `location` = POINT(0, 0);
140140
*
141-
* placeTable.insert('`location` = POINT(?, ?)', [8, 2]);
142-
* // INSERT INTO `place` SET `location` = POINT(8, 2);
141+
* placeTable.insert('(`location`) VALUES (POINT(?, ?))', [8, 2]);
142+
* // INSERT INTO `place` (`location`) VALUES (POINT(8, 2));
143143
*
144144
* @example <caption>Bulk insert</caption>
145145
* const users = [

0 commit comments

Comments
 (0)