You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-4Lines changed: 36 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,12 +187,12 @@ Javascript code:
187
187
188
188
### Querying large tables
189
189
190
-
To query large tables you should use a reader:
190
+
To query large tables you should use a _reader_:
191
191
192
-
* `connection.reader(sql, args)` creates a reader
193
-
* `reader.nextRow(callback)` returns the next row through the callback
192
+
* `reader =connection.reader(sql, args)`: creates a reader
193
+
* `reader.nextRow(callback)`: returns the next row through the callback
194
194
* `reader.nextRows(count, callback)` returns the next `count` rows through the callback. `count` is optional and `nextRows` uses the prefetch row count when `count` is omitted.
195
-
* `connection.setPrefetchRowCount(count)` configures the prefetch row count for the connection. Prefetching can have a dramatic impact on performance but uses more memory.
195
+
* `connection.setPrefetchRowCount(count)`: configures the prefetch row count for the connection. Prefetching can have a dramatic impact on performance but uses more memory.
196
196
197
197
Example:
198
198
@@ -221,6 +221,38 @@ doRead(function(err) {
221
221
});
222
222
```
223
223
224
+
### Large inserts or updates
225
+
226
+
To insert or update a large number of records you should use _prepared statements_ rather than individual `execute` calls on the connection object:
227
+
228
+
* `statement =connection.prepare(sql)`: creates a prepared statement.
229
+
* `statement.execute(args, callback)`: executes the prepared statement with the values in `args`. You can call this repeatedly on the same `statement`.
0 commit comments