Skip to content

(cds 9) Std DB functions by default #1829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
18 changes: 1 addition & 17 deletions guides/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,6 @@ The database services guarantee the identical behavior of these operators:

In particular, the translation of `!=` to `IS NOT` in SQLite — or to `IS DISTINCT FROM` in standard SQL, or to an equivalent polyfill in SAP HANA — greatly improves the portability of your code.

::: warning Runtime Only
The operator mappings are available for runtime queries only, but not in CDS files.
:::


### Session Variables {.node}

Expand Down Expand Up @@ -886,20 +882,8 @@ Instead, they protect the integrity of your data in the database layer against p
## Standard Database Functions
{ #functions-mappings-for-runtime-queries }

A specified set of standard functions - inspired by [OData](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_StringandCollectionFunctions) and [SAP HANA](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/alphabetical-list-of-functions?locale=en-US) - is supported in a **database-agnostic**, hence portable way, and translated to the best-possible native SQL functions or polyfills.

Those functions are automatically mapped during runtime (Node.js) already today.
To switch on the same mappings for your CDL files, you have to set:

<Config>cds.cdsc.standardDatabaseFunctions = true</Config>

::: tip
this will be the default starting with `@sap/cds-compiler >= 9` and hence is only needed for earlier versions.
:::
A specified set of standard functions - inspired by [OData](https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part2-url-conventions.html#sec_StringandCollectionFunctions) and [SAP HANA](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-sql-reference-guide/alphabetical-list-of-functions?locale=en-US) - is supported in a **database-agnostic**, hence portable way, and translated to the best-possible native SQL functions or polyfills during runtime (currently only Node.js) and for your CDL files.

<!--
TODO: remove the above with cds9
-->

### OData standard functions

Expand Down
Loading