Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions node.js/cds-ql.md
Original file line number Diff line number Diff line change
Expand Up @@ -704,30 +704,37 @@ If a queried record is already exclusively locked by another transaction, the `.

Passes hints to the database query optimizer that can influence the execution plan. The hints can be passed as individual arguments or as an array.


```js
SELECT ... .hints ('IGNORE_PLAN_CACHE')
SELECT ... .hints ('IGNORE_PLAN_CACHE', 'MAX_CONCURRENCY(1)')
SELECT ... .hints (['IGNORE_PLAN_CACHE', 'MAX_CONCURRENCY(1)'])
```

### pipeline() {.method}

Returns the data from the database as a raw stream.
### pipeline() {.method}

Pipes the data from the database into the given writable stream.

```js
SELECT ... .pipeline ()
SELECT ... .pipeline (cds.context.http.res)
```

> Please note that the after handlers don't have effect if this stream is piped to the HTTP response.


### stream() {.method}

Returns the data from the database as a raw stream.

```js
SELECT ... .stream ()
```


### foreach() {.method}

Creates an object stream and calls the provided callback for each object.


```js
await SELECT.from(Books).foreach ((book) => { ... })
```
Expand All @@ -742,6 +749,8 @@ for await (const book of SELECT.from(Books)) { ... }
As of now, `SELECT.foreach()` and `SELECT.pipeline()` are only supported by `cds.DatabaseService`. `cds.RemoteService` does not support the streaming APIs yet.
:::



## INSERT {.class}

Fluent API to construct [CQN INSERT](../cds/cqn#insert) query objects in a [CQL](../cds/cql)/SQL-like style. In contrast to SQL, though, the clauses can be arrayed in arbitrary order.
Expand Down