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
constrequest=newsql.Request(/* [pool or transaction] */)
859
+
constrequest=newsql.Request(/* [pool or transaction], [options]*/)
860
860
```
861
861
862
862
If you omit pool/transaction argument, global pool is used instead.
863
863
864
+
The optional `options` argument allows per-request configuration overrides:
865
+
866
+
-**requestTimeout** - Override the pool's default request timeout (in ms) for this request only. This applies to queries and stored procedure executions; it does not apply to bulk data transfers (`request.bulk()`), which stream to completion as long as the connection is healthy. If you need to bound a bulk transfer, wrap the call with your own timer and call `request.cancel()`.
867
+
868
+
```javascript
869
+
// Request with a 60-second timeout instead of the pool default
**Note:** When using the global pool, you must still pass `undefined` as the first argument to use options: `new sql.Request(undefined, { requestTimeout: 60000 })`.
874
+
864
875
### Events
865
876
866
877
-**recordset(columns)** - Dispatched when metadata for new recordset are parsed.
@@ -1226,11 +1237,13 @@ request.cancel()
1226
1237
**IMPORTANT:** always use `Transaction` class to create transactions - it ensures that all your requests are executed on one connection. Once you call `begin`, a single connection is acquired from the connection pool and all subsequent requests (initialized with the `Transaction` object) are executed exclusively on this connection. After you call `commit` or `rollback`, connection is then released back to the connection pool.
If you omit connection argument, global connection is used instead.
1233
1244
1245
+
The optional `options` argument allows per-transaction configuration overrides (e.g. `{ requestTimeout: 60000 }`). These are inherited by any requests created from this transaction unless overridden at the request level. Note that the timeout applies to data requests only, not to the `begin`/`commit`/`rollback` operations themselves.
1246
+
1234
1247
__Example__
1235
1248
1236
1249
```javascript
@@ -1378,11 +1391,13 @@ __Errors__
1378
1391
**IMPORTANT:** always use `PreparedStatement` class to create prepared statements - it ensures that all your executions of prepared statement are executed on one connection. Once you call `prepare`, a single connection is acquired from the connection pool and all subsequent executions are executed exclusively on this connection. After you call `unprepare`, the connection is then released back to the connection pool.
If you omit the connection argument, the global connection is used instead.
1385
1398
1399
+
The optional `options` argument allows per-statement configuration overrides (e.g. `{ requestTimeout: 60000 }`). The timeout is applied to the `prepare`, `execute`, and `unprepare` operations.
0 commit comments