Skip to content

Commit c4e08f8

Browse files
committed
Mention tagged literal templates for WHERE IN
1 parent e3d5129 commit c4e08f8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/api.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11092,11 +11092,11 @@ This will construct a SQL statement:
1109211092
SELECT first_name, last_name FROM employees WHERE first_name IN (:0, :1, :2)
1109311093
```
1109411094

11095-
Binds are still used for security. But, depending how often this
11096-
query is executed, and how changeable the number of bind values is,
11097-
you can end up with lots of 'unique' query strings being executed.
11098-
You might not get the statement caching benefits that re-executing a
11099-
fixed SQL statement would have.
11095+
You could use a [tagged literal template][160] to do this conveniently. Binds
11096+
are still used for security. But, depending how often this query is executed,
11097+
and how changeable the number of bind values is, you can end up with lots of
11098+
'unique' query strings being executed. You might not get the statement caching
11099+
benefits that re-executing a fixed SQL statement would have.
1110011100

1110111101
Another solution for a larger number of values is to construct a SQL
1110211102
statement like:
@@ -14190,3 +14190,4 @@ can be asked at [AskTom][158].
1419014190
[157]: https://livesql.oracle.com/
1419114191
[158]: https://asktom.oracle.com/
1419214192
[159]: https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-1070805B-0703-457C-8D2E-4EEC26193E5F
14193+
[160]: https://github.com/oracle/node-oracledb/issues/699#issuecomment-524009129

0 commit comments

Comments
 (0)